Development environment with nix-shell: Difference between revisions

imported>Milahu
add stdenv.mkDerivation
imported>Milahu
add "dirty build" to stdenv.mkDerivation
Line 50: Line 50:
   name = "some-package";
   name = "some-package";
   version = "0.0.1";
   version = "0.0.1";
   src = /can/be/a/local/path;
   src = /home/yourname/path/to/project; # can be a local path, or fetchFromGitHub, fetchgit, ...
}
}
</syntaxHighlight>
</syntaxHighlight>
Line 63: Line 63:


<syntaxHighlight lang=bash>
<syntaxHighlight lang=bash>
cd $(mktemp -d) && \
# clean build: copy sources from /nix/store
unpackPhase && \
echo "src = $src" && cd $(mktemp -d) && unpackPhase && cd *
cd * && \
 
configurePhase && \
# dirty build: keep cache files from last buildPhase, to compile faster
buildPhase && \
# this is useful to make many small changes to a large project
checkPhase && \
# after each change, just run `buildPhase`
installPhase && \
#cd $HOME/path/to/project
fixupPhase
 
configurePhase
 
buildPhase # most time is spent here
 
checkPhase && installPhase && fixupPhase
</syntaxHighlight>
</syntaxHighlight>