Skip to content

glossary: re-introduce "derivation" #12994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 26, 2025

Conversation

fricklerhandwerk
Copy link
Contributor

Motivation

The "derivation" is one of the key concepts and captures the most distinctive aspect of Nix:
that we work with a certain type data (linked files) in a certain manner (using pure functions).

Context

Here we finally arrange all the important pieces to show how they belong
together, while referring to the respective reference documentation for details.

This change also unbreaks downstream links to //glossary#gloss-derivation,
which had been broken by removing the glossary entry


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do this, we should just replace "store derivation". I left it last time as a compromise, but I don't think there is any definition of "derivation" distinct from "store derivation".

@fricklerhandwerk
Copy link
Contributor Author

@Ericson2314 interesting, I thought store derivations are a certain representation of the abstract notion of a derivation. Nothing says derivations are required to be store objects.

@Ericson2314
Copy link
Member

The store derivation section just sends the reader to @docroot@/store/derivation/index.md, which is definitely about the abstract notion. It just has a little section on how derivations can be serialized into store objects, which in turn refers the reader to various appendices for the gory details.

The "derivation" is one of the key concepts and captures the most distinctive aspect of Nix:
that we work with a certain type data (linked files) in a certain manner (using pure functions).

Here we finally arrange all the important pieces to show how they belong
together, while referring to the respective reference documentation for details.

This change also unbreaks downstream links to `//glossary#gloss-derivation`,
which had been broken by removing the glossary entry
@Mic92 Mic92 merged commit ed3e2a7 into NixOS:master May 26, 2025
12 checks passed
Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not ready to be merged

@@ -31,9 +31,22 @@

The industry term for storage and retrieval systems using [content addressing](#gloss-content-address). A Nix store also has [input addressing](#gloss-input-addressed-store-object), and metadata.

- [derivation]{#gloss-derivation}

A derivation can be thought of as a [pure function](https://en.wikipedia.org/wiki/Pure_function) that produces new [store objects][store object] from existing store objects.
Copy link
Member

@Ericson2314 Ericson2314 May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true because a function maps many possible arguments to results (many possible inputs) but a derivation has a specific set of inputs.

A derivation that depends on the outputs of another derivation is closer to being a function, because we don't know what those outputs are at the time of creating the derivation, but even this needs more explaining.

I think it would be better to say a derivation is a function application than a function. since it is applying a function-in-our-heads to some inputs.

Comment on lines 46 to 50
- [store derivation]{#gloss-store-derivation}

A single build task.
A [derivation] represented as a [store object].

See [Store Derivation](@docroot@/store/derivation/index.md#store-derivation) for details.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not how "store derivation" is defined in that chapter. Rather the thing the glossary now calls "derivation" (the abstract concept) is called "store derivation".

We need to make things consistent. I would rather just always say "derivation" and drop the "store " part everywhere, but I am open to other options.

Comment on lines +38 to +39
Derivations are implemented as [operating system processes that run in a sandbox](@docroot@/store/building.md#builder-execution).
This sandbox by default only allows reading from store objects specified as inputs, and only allows writing to designated [outputs][output] to be [captured as store objects](@docroot@/store/building.md#processing-outputs).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why need this text here. These details can go in the chapter on derivations. The glossary entry is supposed to be an extremely short description that links to the chapter.

Ericson2314 added a commit to Ericson2314/nix that referenced this pull request May 26, 2025
@Ericson2314
Copy link
Member

master...Ericson2314:nix:reword-derivation I tried putting some things here to start fixing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants