diff --git a/pills/01-why-you-should-give-it-try.xml b/pills/01-why-you-should-give-it-try.xml index c2b7c37..84bbff8 100644 --- a/pills/01-why-you-should-give-it-try.xml +++ b/pills/01-why-you-should-give-it-try.xml @@ -30,9 +30,9 @@
Rationale for this series - The Nix, - Nixpkgs, and - NixOS manuals + The Nix, + Nixpkgs, and + NixOS manuals along with the wiki are excellent resources for explaining how Nix/NixOS works, how you can use it, and how cool things are being done with it. diff --git a/pills/02-install-on-your-running.xml b/pills/02-install-on-your-running.xml index 9f992cd..f5c3e31 100644 --- a/pills/02-install-on-your-running.xml +++ b/pills/02-install-on-your-running.xml @@ -21,7 +21,7 @@ - Installing + Installing Nix is as easy as installing any other package. It will not drastically change our system, it will stay out of our way. @@ -54,7 +54,7 @@ the store is owned by root and multiple users can install and build software through a Nix daemon. You can read more about multi-user installations here: https://nixos.org/nix/manual/#ssec-multi-user. + xlink:href="https://nixos.org/manual/nix/stable/installation/installing-binary.html#multi-user-installation">https://nixos.org/manual/nix/stable/installation/installing-binary.html#multi-user-installation.
@@ -129,7 +129,7 @@ Next in the installation, we encounter the concept of the profile: + xlink:href="https://nixos.org/manual/nix/stable/package-management/profiles.html">profile: @@ -201,7 +201,7 @@ Nix + xlink:href="https://nixos.org/manual/nix/stable/expressions/writing-nix-expressions.html">Nix expressions are used to describe packages and how to build them. Nixpkgs is the diff --git a/pills/03-enter-environment.xml b/pills/03-enter-environment.xml index f20c5b6..adf9074 100644 --- a/pills/03-enter-environment.xml +++ b/pills/03-enter-environment.xml @@ -75,7 +75,7 @@ The nix-env + xlink:href="https://nixos.org/manual/nix/stable/command-ref/nix-env.html">nix-env tool manages environments, profiles and their generations. @@ -124,7 +124,7 @@ Lets inspect the profile + xlink:href="https://nixos.org/manual/nix/stable/package-management/profiles.html">profile a bit: @@ -176,9 +176,9 @@ You can of course also + xlink:href="https://nixos.org/manual/nix/stable/command-ref/nix-env.html#operation---uninstall"> uninstall and upgrade packages. + xlink:href="https://nixos.org/manual/nix/stable/command-ref/nix-env.html#operation---upgrade">upgrade packages. @@ -325,7 +325,7 @@ second article. There's a list of channels from which we get packages, although usually we use a single channel. The tool to manage channels is - nix-channel. + nix-channel. @@ -366,7 +366,7 @@ We learned how to query the user environment and to manipulate it by installing and uninstalling software. Upgrading software is also straightforward, as you can read in - the manual + the manual (nix-env -u will upgrade all packages in the environment). diff --git a/pills/04-basics-of-language.xml b/pills/04-basics-of-language.xml index 32755bd..09d9edc 100644 --- a/pills/04-basics-of-language.xml +++ b/pills/04-basics-of-language.xml @@ -16,9 +16,9 @@ The - Nix language + Nix language is used to write expressions that produce derivations. The - nix-build + nix-build tool is used to build derivations from an expression. Even as a system administrator that wants to customize the installation, it's necessary to master Nix. Using Nix for your jobs means you get the features we saw in the previous articles @@ -51,7 +51,7 @@ Nix 2.0 contains a command named nix repl which is a simple command line tool for playing with the Nix language. In fact, Nix is a - pure, lazy, functional language, + pure, lazy, functional language, not only a set of tools to manage derivations. The nix repl syntax is slightly different to Nix syntax when it comes to assigning variables, but it shouldn't be confusing so long as you bear it in mind. I prefer to start with nix repl @@ -96,7 +96,7 @@ Nix has integer, floating point, string, path, boolean and null - simple + simple types. Then there are also lists, sets and functions. These types are enough to build an operating system. @@ -154,7 +154,7 @@ It's possible to - interpolate + interpolate whole Nix expressions inside strings with the ${...} syntax and only that syntax, not $foo or {$foo} or anything else. @@ -235,7 +235,7 @@ To do so, use - recursive attribute sets: + recursive attribute sets: diff --git a/pills/05-functions-and-imports.xml b/pills/05-functions-and-imports.xml index ad40c1c..85281de 100644 --- a/pills/05-functions-and-imports.xml +++ b/pills/05-functions-and-imports.xml @@ -19,7 +19,7 @@ xml:id="functions-and-imports"> Functions help to build reusable components in a big repository like nixpkgs. The Nix manual has a great explanation of + xlink:href="https://nixos.org/manual/nix/stable/expressions/language-constructs.html#functions">great explanation of functions. Let's go: pill on one hand, Nix manual on the other hand. @@ -309,7 +309,7 @@ xml:id="functions-and-imports"> builtins.trace is a built-in + xlink:href="https://nixos.org/manual/nix/stable/expressions/builtins.html">built-in function that takes two arguments. The first is the message to display, the second is the value to return. It's usually used for debugging purposes. diff --git a/pills/06-our-first-derivation.xml b/pills/06-our-first-derivation.xml index b988b9b..68bf4ba 100644 --- a/pills/06-our-first-derivation.xml +++ b/pills/06-our-first-derivation.xml @@ -30,7 +30,7 @@ The derivation + xlink:href="https://nixos.org/manual/nix/stable/expressions/derivations.html">derivation built-in function is used to create derivations. I invite you to read the link in the Nix manual about the derivation built-in. A derivation from a Nix language view point is simply a set, with some attributes. Therefore @@ -426,7 +426,7 @@ During evaluation, you can refer to other derivations because Nix will create .drv files and we will know out paths beforehand. This is achieved with nix-instantiate. + xlink:href="https://nixos.org/manual/nix/stable/command-ref/nix-instantiate.html">nix-instantiate. @@ -434,7 +434,7 @@ Realise/Build time: the .drv from the derivation set is built, first building .drv inputs (build dependencies). This is achieved with nix-store + xlink:href="https://nixos.org/manual/nix/stable/command-ref/nix-store.html#operation---realise">nix-store -r. diff --git a/pills/07-working-derivation.xml b/pills/07-working-derivation.xml index ad7726d..2b3f00d 100644 --- a/pills/07-working-derivation.xml +++ b/pills/07-working-derivation.xml @@ -128,7 +128,7 @@ $NIX_BUILD_CORES and $NIX_STORE are - nix + nix configuration options @@ -266,13 +266,13 @@ nix-build does two jobs: - + nix-instantiate : parse and evaluate simple.nix and return the .drv file corresponding to the parsed derivation set - + nix-store -r : realise the .drv file, which actually builds it. @@ -303,7 +303,7 @@ Then we meet the - inherit keyword. + inherit keyword. inherit foo; is equivalent to foo = foo;. Similarly, inherit foo bar; is equivalent to foo = foo; bar = bar;. diff --git a/pills/09-automatic-runtime.xml b/pills/09-automatic-runtime.xml index f46c89e..7dbb931 100644 --- a/pills/09-automatic-runtime.xml +++ b/pills/09-automatic-runtime.xml @@ -260,9 +260,9 @@ This makes packages self-contained, ensuring (apart data and configuration) that copying the runtime closure on another machine is sufficient to run the program. That's why Nix has - one-click install, + one-click install, or - reliable deployment in the cloud. + reliable deployment in the cloud. All with one tool. diff --git a/pills/10-developing-with-nix-shell.xml b/pills/10-developing-with-nix-shell.xml index fa35593..19c119d 100644 --- a/pills/10-developing-with-nix-shell.xml +++ b/pills/10-developing-with-nix-shell.xml @@ -25,7 +25,7 @@ The nix-shell + xlink:href="https://nixos.org/manual/nix/stable/command-ref/nix-shell.html">nix-shell tool drops us in a shell by setting up the necessary environment variables to hack on a derivation. It does not build the derivation, it only serves as a preparation so that we can run the build steps manually. diff --git a/pills/11-garbage-collector.xml b/pills/11-garbage-collector.xml index a7bb1e1..4b10f5c 100644 --- a/pills/11-garbage-collector.xml +++ b/pills/11-garbage-collector.xml @@ -61,7 +61,7 @@ In Nix there's this same concept. Instead of being objects, of course, - GC roots are store paths. + GC roots are store paths. The implementation is very simple and transparent to the user. GC roots are stored under /nix/var/nix/gcroots. If there's a symlink to a store path, then that store path is a GC root. @@ -90,7 +90,7 @@ Before playing with the GC, first run the - nix garbage collector + nix garbage collector once, so that we have a clean playground for our experiments: diff --git a/pills/12-inputs-design-pattern.xml b/pills/12-inputs-design-pattern.xml index eca999e..5195ba3 100644 --- a/pills/12-inputs-design-pattern.xml +++ b/pills/12-inputs-design-pattern.xml @@ -134,7 +134,7 @@ The -A argument is used to access an attribute of the set from the given .nix expression. - Important: why did we choose the default.nix? Because when a directory (by default the current directory) has a default.nix, that default.nix will be used (see import here). In fact you can run nix-build -A hello without specifying default.nix. + Important: why did we choose the default.nix? Because when a directory (by default the current directory) has a default.nix, that default.nix will be used (see import here). In fact you can run nix-build -A hello without specifying default.nix. For pythoners, it is similar to __init__.py. diff --git a/pills/13-callpackage-design-pattern.xml b/pills/13-callpackage-design-pattern.xml index 1a040ff..19f573f 100644 --- a/pills/13-callpackage-design-pattern.xml +++ b/pills/13-callpackage-design-pattern.xml @@ -124,7 +124,7 @@ The "callPackage" pattern has simplified our repository a lot. We're able to import packages that require some named arguments and call them automatically, given the set of all packages. - We've also introduced some useful builtin functions that allows us to introspect Nix functions and manipulate attributes. These builtin functions are not usually used when packaging software, rather to provide tools for packaging. That's why they are not documented in the nix manual. + We've also introduced some useful builtin functions that allows us to introspect Nix functions and manipulate attributes. These builtin functions are not usually used when packaging software, rather to provide tools for packaging. That's why they are not documented in the nix manual. Writing a repository in nix is an evolution of writing convenient functions for combining the packages. This demonstrates even more how nix is a generic tool to build and deploy something, and how suitable it is to create software repositories with your own conventions. diff --git a/pills/15-nix-search-paths.xml b/pills/15-nix-search-paths.xml index fcad821..f534006 100644 --- a/pills/15-nix-search-paths.xml +++ b/pills/15-nix-search-paths.xml @@ -14,7 +14,7 @@
The NIX_PATH - The NIX_PATH environment variable is very important. It's very similar to the PATH environment variable. The syntax is similar, several paths are separated by a colon :. Nix will then search for something in those paths from left to right. + The NIX_PATH environment variable is very important. It's very similar to the PATH environment variable. The syntax is similar, several paths are separated by a colon :. Nix will then search for something in those paths from left to right. Who uses NIX_PATH? The nix expressions! Yes, NIX_PATH is not of much use by the nix tools themselves, rather it's used when writing nix expressions. @@ -29,7 +29,7 @@ What's NIX_PATH good for? Nix expressions may refer to an "abstract" path such as <nixpkgs>, and it's possible to override it from the command line. - For ease we will use nix-instantiate --eval to do our tests. I remind you, nix-instantiate is used to evaluate nix expressions and generate the .drv files. Here we are not interested in building derivations, so evaluation is enough. It can be used for one-shot expressions. + For ease we will use nix-instantiate --eval to do our tests. I remind you, nix-instantiate is used to evaluate nix expressions and generate the .drv files. Here we are not interested in building derivations, so evaluation is enough. It can be used for one-shot expressions.
@@ -62,7 +62,7 @@ You can list that directory and realize it's simply a checkout of the nixpkgs repository at a specific commit (hint: .version-suffix). - The NIX_PATH variable is exported by nix.sh, and that's the reason why I always asked you to source nix.sh at the beginning of my posts. + The NIX_PATH variable is exported by nix.sh, and that's the reason why I always asked you to source nix.sh at the beginning of my posts. You may wonder: then I can also specify a different nixpkgs path to, e.g., a git checkout of nixpkgs? Yes, you can and I encourage doing that. We'll talk about this in the next pill. @@ -78,7 +78,7 @@
A big word about nix-env - The nix-env command is a little different than nix-instantiate and nix-build. Whereas nix-instantiate and nix-build require a starting nix expression, nix-env does not. + The nix-env command is a little different than nix-instantiate and nix-build. Whereas nix-instantiate and nix-build require a starting nix expression, nix-env does not. You may be crippled by this concept at the beginning, you may think nix-env uses NIX_PATH to find the nixpkgs repository. But that's not it. diff --git a/pills/18-nix-store-paths.xml b/pills/18-nix-store-paths.xml index 1466add..ee61666 100644 --- a/pills/18-nix-store-paths.xml +++ b/pills/18-nix-store-paths.xml @@ -96,7 +96,7 @@ Finally, the other most used kind of path is when we know beforehand an integrity hash of a file. This is usual for tarballs. - A derivation can take three special attributes: outputHashMode, outputHash and outputHashAlgo which are well documented in the nix manual. + A derivation can take three special attributes: outputHashMode, outputHash and outputHashAlgo which are well documented in the nix manual. The builder must create the out path and make sure its hash is the same as the one declared with outputHash.