Skip to content

Commit

Permalink
added details on what derivations are, added/removed periods (#1074)
Browse files Browse the repository at this point in the history
* added details on what derivations are, added/removed periods

when i was reading the tutorial and came across impurities, it mentioned derivations and i had totally forgotten what they were. looking back, they were mentioned once in the very beginning and lightly discusses after. i'd expect others to be like me and would appreciate a reminder.
  • Loading branch information
ellyxir authored Nov 7, 2024
1 parent 92b5c97 commit 666b942
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions source/tutorials/nix-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -1740,18 +1740,19 @@ For historical reasons, some of the functions in `pkgs.lib` are equivalent to [`
So far we have only covered what we call *pure expressions*:
declaring data and transforming it with functions.

In practice, describing derivations requires observing the outside world.
In practice, describing derivations – the Nix language's defining feature, which enables functional programming with the file system – requires observing the outside world.
We will discuss [derivations](derivations) later in the tutorial.

There is only one impurity in the Nix language that is relevant here:
reading files from the file system as *build inputs*
reading files from the file system as *build inputs*.

Build inputs are files that derivations refer to in order to describe how to derive new files.
When run, a derivation will only have access to explicitly declared build inputs.

The only way to specify build inputs in the Nix language is explicitly with:

- File system paths
- Dedicated functions.
- Dedicated functions

Nix and the Nix language refer to files by their content hash. If file contents are not known in advance, it's unavoidable to read files during expression evaluation.

Expand Down

0 comments on commit 666b942

Please sign in to comment.