Journal 2022-09-11
Nix stdenv.mkDerivation
The function requires a name and source and will return a derivation.
stdenv.mkDerivation {
name = "example";
src = ./src;
# buildInputs = [];
# nativeBuildInputs = [];
# installPhase = ...;
# etc ...
};
The source code for the function can be found here:
- make-derivation.nix: nix file fore the function.
- setup.sh: the script that is actually run when building. It’s useful to read how the hooks are configured.
Some useful configuration variables:
dontConfigure = true
;dontBuild = true;
You should use the post<hook-name>
(postInstall
, postPatch
) to run code
since it will not override te existing hook step like decompression, …