diff --git a/pills/19-fundamentals-of-stdenv.xml b/pills/19-fundamentals-of-stdenv.xml index ae6ece6..cea606a 100644 --- a/pills/19-fundamentals-of-stdenv.xml +++ b/pills/19-fundamentals-of-stdenv.xml @@ -7,35 +7,35 @@ Fundamentals of Stdenv - Welcome to the 19th Nix pill. In the previous 18th pill we did dive into the algorithm used by Nix to compute the store paths, and also introduced fixed-output store paths. + Welcome to the 19th Nix pill. In the previous 18th pill we dived into the algorithm used by Nix to compute the store paths, and also introduced fixed-output store paths. - This time we will instead look into nixpkgs, in particular one of its core derivation: stdenv. + This time we will instead look into nixpkgs, in particular one of its core derivations: stdenv. - The stdenv is not a special derivation to Nix, but it's very important for the nixpkgs repository. It serves as base for packaging software. It is used to pull in dependencies such as the GCC toolchain, GNU make, core utilities, patch and diff utilities, and so on. Basic tools needed to compile a huge pile of software currently present in nixpkgs. + The stdenv is not treated as a special derivation by Nix, but it's very important for the nixpkgs repository. It serves as a base for packaging software. It is used to pull in dependencies such as the GCC toolchain, GNU make, core utilities, patch and diff utilities, and so on: basic tools needed to compile a huge pile of software currently present in nixpkgs.
- What is stdenv + What is stdenv? - First of all stdenv is a derivation. And it's a very simple one: + First of all, stdenv is a derivation, and it's a very simple one: - It has just two files: /setup and /nix-support/propagated-user-env-packages. Don't care about the latter; it's empty, in fact. The important file is /setup. + It has just two files: /setup and /nix-support/propagated-user-env-packages. Don't worry about the latter. It's empty, in fact. The important file is /setup. - How can this simple derivation pull in all the toolchain and basic tools needed to compile packages? Let's look at the runtime dependencies: + How can this simple derivation pull in all of the toolchain and basic tools needed to compile packages? Let's look at the runtime dependencies: - How can it be? The package must be referring to those package somehow. In fact, they are hardcoded in the /setup file: + How can it be? The package must be referring to those other packages somehow. In fact, they are hardcoded in the /setup file: @@ -48,7 +48,7 @@ - The stdenv setup file is exactly that. It sets up several environment variables like PATH and creates some helper bash functions to build a package. I invite you to read it, it's only 860 lines at the time of this writing. + The stdenv setup file is exactly that. It sets up several environment variables like PATH and creates some helper bash functions to build a package. I invite you to read it. @@ -60,7 +60,7 @@ - What genericBuild does is just run these phases. Default phases are just bash functions, you can easily read them. + What genericBuild does is just run these phases. Default phases are just bash functions. You can easily read them. @@ -75,19 +75,19 @@ - I unset PATH to further show that the stdenv is enough self-contained to build autotools packages that have no other dependencies. + I unset PATH to further show that the stdenv is sufficiently self-contained to build autotools packages that have no other dependencies. - So we ran the configurePhase function and buildPhase function and they worked. These bash functions should be self-explanatory, you can read the code in the setup file. + So we ran the configurePhase function and buildPhase function and they worked. These bash functions should be self-explanatory. You can read the code in the setup file.
- How is the setup file built + How the setup file is built - Until now we worked with plain bash scripts. What about the Nix side? The nixpkgs repository offers a useful function, like we did with our old builder. It is a wrapper around the raw derivation function which pulls in the stdenv for us, and runs genericBuild. It's stdenv.mkDerivation. + Until now we worked with plain bash scripts. What about the Nix side? The nixpkgs repository offers a useful function, like we did with our old builder. It is a wrapper around the raw derivation function which pulls in the stdenv for us, and runs genericBuild. It's stdenv.mkDerivation. @@ -95,7 +95,7 @@ - Let's write a hello.nix expression using this new discovered stdenv: + Let's write a hello.nix expression using this newly discovered stdenv: @@ -140,11 +140,11 @@ - So short I decided to paste it entirely above. The builder is bash, with -e default-builder.sh arguments. Then you can see the src and stdenv environment variables. + It's so short I decided to paste it entirely above. The builder is bash, with -e default-builder.sh arguments. Then you can see the src and stdenv environment variables. - Last bit, the unpackPhase in the setup is used to unpack the sources and enter the directory, again like we did in our old builder. + The last bit, the unpackPhase in the setup, is used to unpack the sources and enter the directory. Again, like we did in our old builder.
@@ -167,7 +167,7 @@ - That's it, everything you need to know about the stdenv phases is in the setup file. + That's it. Everything you need to know about the stdenv phases is in the setup file.