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

Auto-generate store documentation #8084

Merged
merged 18 commits into from
Mar 27, 2023
Merged

Auto-generate store documentation #8084

merged 18 commits into from
Mar 27, 2023

Conversation

edolstra
Copy link
Member

@edolstra edolstra commented Mar 21, 2023

Motivation

This makes information about the supported store types and their settings in nix help-stores. Store types can now also have some "global" Markdown documentation.

This PR also removes nix describe-stores since we don't actually need it for docs generation and it doesn't really have any other use cases. (If really needed the JSON is still available in the internal nix __dump-cli command.)

Closes #5467. Fixes #6279.

Context

Checklist for maintainers

Maintainers: tick if completed or explain if not relevant

  • agreed on idea
  • agreed on implementation strategy
  • tests, as appropriate
    • functional tests - tests/**.sh
    • unit tests - src/*/tests
    • integration tests - tests/nixos/*
  • documentation in the manual
  • code and comments are self-explanatory
  • commit message explains why the change was made
  • new feature or incompatible change: updated release notes

Priorities

Add 👍 to pull requests you find important.

This command was intended for docs generation, but it was never used
for that and we don't need it.
@github-actions github-actions bot added documentation with-tests Issues related to testing. PRs with tests have some priority labels Mar 21, 2023
Why not 'nix help stores'? Well, 'nix help <arg>' already means 'show
help on the "arg" subcommand'.
This makes the help commands show up prominently at the top of the
'nix' manpage.
Since setting names are not unique we don't have an easy way to
produce unique anchors.
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.

I can't follow why this is a separate command, while all it does is render documentation. I saw somewhere nix store --help being mentioned in reference to that, but can't find the source. I think that information should simply be on the front page of nix store --help instead.

doc/manual/src/release-notes/rl-next.md Outdated Show resolved Hide resolved
src/libstore/local-store.md Outdated Show resolved Hide resolved
src/libstore/local-store.md Outdated Show resolved Hide resolved
src/libstore/local-store.md Outdated Show resolved Hide resolved
Comment on lines +19 to +25
For example, the following uses `/tmp/root` as the chroot environment
to build or download `nixpkgs#hello` and then execute it:

```console
# nix run --store /tmp/root nixpkgs#hello
Hello, world!
```
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should make a definitive decision on whether and how to document experimental features in the stable parts of the manual. Similar situation in the hacking guide.

While this, for now, will only show in nix command docs, there is no reason not to have it everywhere it matters, since that stuff is already stable.

src/libstore/s3-binary-cache-store.cc Show resolved Hide resolved
src/libstore/s3-binary-cache-store.cc Show resolved Hide resolved
src/libstore/legacy-ssh-store.md Show resolved Hide resolved
@@ -0,0 +1,40 @@
R"(

**Store URL format**: `local`, *root*
Copy link
Contributor

Choose a reason for hiding this comment

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

I had to read multiple examples to understand that this notation means an enumeration of store formats. There probably is a better way to express this in a way that is immediately clear, but I don't see one yet.

doc/manual/utils.nix Outdated Show resolved Hide resolved
doc/manual/utils.nix Outdated Show resolved Hide resolved
edolstra and others added 6 commits March 23, 2023 09:11
@edolstra
Copy link
Member Author

I can't follow why this is a separate command, while all it does is render documentation. I saw somewhere nix store --help being mentioned in reference to that, but can't find the source. I think that information should simply be on the front page of nix store --help instead.

That's what this PR originally did, but I think having a nix help-stores is much more discoverable. We could also have nix help-builtins, nix help-settings, etc.

@thufschmitt thufschmitt added the idea approved The given proposal has been discussed and approved by the Nix team. An implementation is welcome. label Mar 24, 2023
@fricklerhandwerk
Copy link
Contributor

Discussed in the Nix team meeting 2023-03-23:

  • @Ericson2314: very glad we are getting this

  • @eriscon2314, thufschmitt: it is a bit weird to render the store information under the nix help-stores

    • The per-command info should always basically be the man page for that command. In this case, for nix help-stores that would be how to use it, not what it outputs.
    • The store info can simply be its own section of the manual, just as other information auto-generated information has its own sections
    • Rather than nix help-stores being part of the manual, it should be thought of as a way to view (part of) the manual content from the terminal.
    • We should distinguish content vs presentation:
      • the manual is the content
      • the website and nix help-* commands are two alternative presentations of that content.
  • @edolstra: Sort of makes sense to me; will rework PR.

@fricklerhandwerk
Copy link
Contributor

  • Rather than nix help-stores being part of the manual, it should be thought of as a way to view (part of) the manual content from the terminal.

I'd like to re-iterate that currently our paradigm to view parts of the manual on the command line is nix <subcommand> --help and man <command>. Therefore I don't think having a separate command here is meaningful, as it introduces yet another (inconsistent) way of viewing.

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/2023-03-23-nix-team-meeting-minutes-43/26758/1

@edolstra
Copy link
Member Author

@edolstra: Sort of makes sense to me; will rework PR.

Just to be clear: the conclusion was that it makes sense to make the store documentation available in the manual in some other location than under nix help-stores, but right now we don't have that. So that could be done in a future PR.

@edolstra edolstra dismissed fricklerhandwerk’s stale review March 27, 2023 13:46

Addressed most comments.

@edolstra edolstra merged commit 237587b into NixOS:master Mar 27, 2023
@edolstra edolstra deleted the store-docs branch March 27, 2023 13:46
@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/this-month-in-nix-docs-1-march-2023/26913/1

@gador gador mentioned this pull request Jun 9, 2023
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation idea approved The given proposal has been discussed and approved by the Nix team. An implementation is welcome. with-tests Issues related to testing. PRs with tests have some priority
Projects
Archived in project
5 participants