Skip to content

Instantly share code, notes, and snippets.

@eugeneia
Created August 13, 2018 13:36
Show Gist options
  • Save eugeneia/b5e1ca3a31594dd84d077ae670f7b257 to your computer and use it in GitHub Desktop.
Save eugeneia/b5e1ca3a31594dd84d077ae670f7b257 to your computer and use it in GitHub Desktop.
# Run like this:
# nix-build /path/to/this/directory
# ... and the files are produced in ./result/bin/snabb
{ pkgs ? (import <nixpkgs> {})
, source ? ./.
, version ? "dev"
}:
with pkgs;
stdenv.mkDerivation rec {
name = "athens-${version}";
src = lib.cleanSource source;
buildInputs = [ makeWrapper ccl openssl libxml2 ];
inherit version openssl libxml2;
LD_LIBRARY_PATH = lib.makeLibraryPath [ openssl libxml2 ];
# DRY :-(
preBuild = ''
make clean
'';
buildPhase = ''
XDG_CACHE_HOME="$TMP/.cache" make bin/athens
'';
installPhase = ''
mkdir -p $out/bin
cp bin/athens $out/bin/athens.orig
makeWrapper $out/bin/athens.orig $out/bin/athens \
--suffix LD_LIBRARY_PATH : $LD_LIBRARY_PATH
'';
dontStrip = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment