From f43d0473320b9b2297b1a00880316aee9066b81a Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Mon, 28 Apr 2025 11:53:26 +0200 Subject: vault backup: 2025-04-28 11:53:26 --- Nix derivations.md | 2 +- Nix stdenv.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 Nix stdenv.md diff --git a/Nix derivations.md b/Nix derivations.md index 9bd25a9..e62d44d 100644 --- a/Nix derivations.md +++ b/Nix derivations.md @@ -2,4 +2,4 @@ tags: - nix --- -Are sort of recipes for how to build a program. \ No newline at end of file +Are sort of recipes for how to build a program. Best use [[Nix stdenv]] mkDerivations \ No newline at end of file diff --git a/Nix stdenv.md b/Nix stdenv.md new file mode 100644 index 0000000..69ef515 --- /dev/null +++ b/Nix stdenv.md @@ -0,0 +1,51 @@ +--- +tags: + - nix +--- +Is itself a derivation containing a file `setup`. It is basically a builder. + +Exposed by nixpkgs so we can call it from nix: +https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/make-derivation.nix + +Runs in phases: +- unpackPhase +- configurePhase +- buildPhase +- checkPhase +- installPhase +- fixupPhase + +```console +nix-build '' -A stdenv +/nix/store/k4jklkcag4zq4xkqhkpy156mgfm34ipn-stdenv +``` + +```console +ls -R result/ +result/: +nix-support/ setup + +result/nix-support: +propagated-user-env-packages +``` + +```console +nix-store -q --references result +/nix/store/3a45nb37s0ndljp68228snsqr3qsyp96-bzip2-1.0.6 +/nix/store/a457ywa1haa0sgr9g7a1pgldrg3s798d-coreutils-8.24 +/nix/store/zmd4jk4db5lgxb8l93mhkvr3x92g2sx2-bash-4.3-p39 +/nix/store/47sfpm2qclpqvrzijizimk4md1739b1b-gcc-wrapper-4.9.3 +... +``` + +```console +head result/setup +export SHELL=/nix/store/zmd4jk4db5lgxb8l93mhkvr3x92g2sx2-bash-4.3-p39/bin/bash +initialPath="/nix/store/a457ywa1haa0sgr9g7a1pgldrg3s798d-coreutils-8.24 ..." +defaultNativeBuildInputs="/nix/store/sgwq15xg00xnm435gjicspm048rqg9y6-patchelf-0.8 ..." +``` + + +--- +https://nixos.org/guides/nix-pills/19-fundamentals-of-stdenv.html +https://nixos.org/manual/nixpkgs/stable/#chap-stdenv \ No newline at end of file -- cgit v1.2.3