Skip to content

Instantly share code, notes, and snippets.

@massich
Created April 5, 2017 14:29
Show Gist options
  • Save massich/cbbccc6e68e0b4e4e29162c106550e4e to your computer and use it in GitHub Desktop.
Save massich/cbbccc6e68e0b4e4e29162c106550e4e to your computer and use it in GitHub Desktop.
# This is a nix packaging for ITKSnaps
#
# Assumptions:
# - Itksnaps has been downloaded and untar so that the tee looks as follow
# tar: /home/userName/itksnaps/itksnap-3.6.0-20170401-Linux-x86_64.tar.gz
# nix: /home/userName/itksnaps/itksnap.nix
# binary: /home/userName/itksnaps/itksnap-3.6.0-20170401-Linux-x86_64/bin/itksnap
# libraries: /home/userName/itksnaps/itksnap-3.6.0-20170401-Linux-x86_64/lib/snap-3.6.0/*
#
#
# How to call it:
# > cd /home/userName/itksnaps/
# > nix-build ./itksnap.nix
# > ./result/bin/itksnap
with import <nixpkgs> {}; with itk;
stdenv.mkDerivation rec {
name = "itksnaps";
buildInputs = [ makeWrapper ];
buildPhase = "true";
libPath = lib.makeLibraryPath [ ];
unpackPhase = "true";
installPhase = ''
mkdir -p $out/bin
cp ${./itksnap-3.6.0-20170401-Linux-x86_64/bin/itksnap} $out/bin/itksnap
wrapProgram $out/bin/itksnap \
--prefix LD_LIBRARY_PATH : "${libPath}"
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment