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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

Comment on lines 36 to 38
A derivation can be thought of as a [pure function](https://en.wikipedia.org/wiki/Pure_function) that produces new files from existing files, taking into account how these files refer to each other.

In Nix, linked files are represented as [store objects][store object].
Derivations are implemented as [operating system processes that run in a sandbox](@docroot@/store/building.md#builder-execution).
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this can be phrased more concisely as something like

Suggested change
A derivation can be thought of as a [pure function](https://en.wikipedia.org/wiki/Pure_function) that produces new files from existing files, taking into account how these files refer to each other.
In Nix, linked files are represented as [store objects][store object].
Derivations are implemented as [operating system processes that run in a sandbox](@docroot@/store/building.md#builder-execution).
A derivation is an operating system process that produces store objects from other store objects.

Copy link
Contributor Author

@fricklerhandwerk fricklerhandwerk Apr 10, 2025

Choose a reason for hiding this comment

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

That's essentially what I started with, but it lacks the distinctive characteristics of derivations (approximate pure functions by memoizing sandboxed execve calls). Otherwise readers will rightfully wonder why one would bother, since makefiles and build scripts also describe how to invoke processes that produce files (and may as well produce store objects if instructed).

Also, before jumping right into store objects we need a bit of context to pick up readers from what they already know: files. But again, the distinctive property of store objects is that they introduce references between these files. I'm trying to avoid the glossary term "reference" though, because that would be skipping ahead.

Most importantly, we're not saying anywhere what exactly it is that makes Nix (the store model) purely functional, but where else would one put it if not here?

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
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.

3 participants