Skip to content
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

WIP: Document the design of Nix #4280

Closed
wants to merge 12 commits into from

Conversation

Ericson2314
Copy link
Member

The current docs are all "how to do things" and no "what is Nix" or "why
are things the way they are".

I see lots of misconception on the wider internet, and I also think we
would benefit from a "living document" to answer some questions people
currently turn to the thesis for.

I think a new section of the manual can address all these issues.

The current docs are all "how to do things" and no "what is Nix" or "why
are things the way they are".

I see lots of misconception on the wider internet, and I also think we
would benefit from a "living document" to answer some questions people
currently turn to the thesis for.

I think a new section of the manual can address all these issues.
@Ericson2314
Copy link
Member Author

[For the record, let no one construe this as people writing more docs because markdown 😀. I go with the flow and prefer to write docs after the dust settles, but I do not like markdown.]

@edolstra
Copy link
Member

Note that there is a lot of material in https://edolstra.github.io/pubs/phd-thesis.pdf (especially chapters 5 and 6) that we could reuse here, rather than start from scratch.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/documenting-the-design-of-nix/10177/1

Copy link
Member

@knedlsepp knedlsepp left a comment

Choose a reason for hiding this comment

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

Thanks for providing some insights. I have long wished to get some insights into the inner workings of nix.


## File system data

Nix supports the a similar model of the file system as Git.
Copy link
Member

Choose a reason for hiding this comment

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

-the

doc/manual/src/design/store/entries.md Outdated Show resolved Hide resolved
doc/manual/src/design/store/entries.md Outdated Show resolved Hide resolved
doc/manual/src/design/store/entries.md Outdated Show resolved Hide resolved
doc/manual/src/design/store/entries.md Outdated Show resolved Hide resolved
Lastly, this illustrates the purpose of tracking self references.
Store entries without self-references or other references are relocatable, while store paths with self-references aren't.
This is used to tell apart e.g. source code which can be stored anywhere, and pesky non-reloctable executables which assume they are installed to a certain path.
\[The default method of calculating references by scanning for store paths handles these two example cases surprisingly well.\]
Copy link
Member

Choose a reason for hiding this comment

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

There are quite a few occurrences of the word "store" in these sentences to the point where it gets confusing. Not sure how to resolve that though.

Copy link
Member Author

Choose a reason for hiding this comment

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

This whole section is too advanced, so I moved it to a bonus topic at the end.

doc/manual/src/design/overview.md Outdated Show resolved Hide resolved
doc/manual/src/design/store/entries.md Outdated Show resolved Hide resolved

Store entries can refer to both other store entries and themselves.

Store references are normally calculated by scanning the file system data for store paths when a new store entry is created, but this isn't mandatory, as store entries are allowed to have references that don't correspond to contained store paths, and contained store paths that don't correspond to references.

Choose a reason for hiding this comment

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

The use of "normally" makes me question if store references may be computed in other ways. I don't think that's the case, so perhaps removing "normally" would help.

Alternatively, "contained" might refer to "contained in the closure of a store path". The way it's used here sort of implies that's how closures are tracked.

Copy link
Member Author

Choose a reason for hiding this comment

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

DRV files have references which are declared by fiat. Since then, addToStoreFromDump not just addTextToStore also allows this.

doc/manual/src/design/store/entries.md Outdated Show resolved Hide resolved
@stale
Copy link

stale bot commented Jun 2, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Jun 2, 2021
@stale stale bot removed the stale label Mar 21, 2022
Copy link
Contributor

@fricklerhandwerk fricklerhandwerk left a comment

Choose a reason for hiding this comment

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

Ah, now I had a bunch of incomplete comments. @Ericson2314 hopefully most of this still applies. Now that the PR has become so big, can we maybe split his up somehow? For example, start with a PR just for the overview, and then add chapters one by one?

I'd prefer to have as little as possible but fairly polished text. Many people may end up reading this, and we want to be careful with their attentive resources.

doc/manual/src/design/overview.md Show resolved Hide resolved
doc/manual/src/design/overview.md Outdated Show resolved Hide resolved
doc/manual/src/design/overview.md Outdated Show resolved Hide resolved
doc/manual/src/design/overview.md Outdated Show resolved Hide resolved
doc/manual/src/design/store/entries.md Outdated Show resolved Hide resolved
doc/manual/src/design/store/paths.md Show resolved Hide resolved
doc/manual/src/design/store/paths.md Show resolved Hide resolved
doc/manual/src/design/store/paths.md Show resolved Hide resolved
doc/manual/src/design/store/paths.md Show resolved Hide resolved
doc/manual/src/design/store/paths.md Show resolved Hide resolved
Copy link
Contributor

@fricklerhandwerk fricklerhandwerk left a comment

Choose a reason for hiding this comment

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

Migrated from before today's changes.

doc/manual/src/design/store/entries.md Show resolved Hide resolved
doc/manual/src/design/store/entries.md Show resolved Hide resolved
doc/manual/src/design/store/entries.md Show resolved Hide resolved
doc/manual/src/design/store/relocatability.md Show resolved Hide resolved
doc/manual/src/design/store/relocatability.md Show resolved Hide resolved
Ericson2314 and others added 3 commits March 22, 2022 10:55
Co-authored-by: Valentin Gagarin <valentin@fricklerhandwerk.de>
Co-authored-by: Valentin Gagarin <valentin@fricklerhandwerk.de>
Co-authored-by: Valentin Gagarin <valentin@fricklerhandwerk.de>
@Ericson2314 Ericson2314 marked this pull request as draft March 24, 2022 20:57
@Ericson2314
Copy link
Member Author

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tweag-nix-dev-update-27/18433/1

Co-authored-by: Matthieu Coudron <teto@users.noreply.github.com>
@Ericson2314
Copy link
Member Author

Ericson2314 commented Apr 8, 2022

Per https://discourse.nixos.org/t/documenting-what-is-nix/10177/2 @fricklerhandwerk and I (and hopefully you too!) will iterate on a separate branch, try to get the large scale structure / outline down, and then send PRs upstream as specific sections are ready.

There is no way to modify the source branch of a PR, so closing this instead.

@Ericson2314 Ericson2314 closed this Apr 8, 2022
@Ericson2314 Ericson2314 deleted the doc-what-is-nix branch April 8, 2022 00:30
@tomberek
Copy link
Contributor

https://github.com/nix-community/nix/tree/doc-what-is-nix

@Ericson2314
Copy link
Member Author

#6420 too

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

Successfully merging this pull request may close these issues.

None yet

9 participants