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

Adds Nix CLI Guideline to docs #4302

Merged
merged 7 commits into from Dec 18, 2020
Merged

Adds Nix CLI Guideline to docs #4302

merged 7 commits into from Dec 18, 2020

Conversation

garbas
Copy link
Member

@garbas garbas commented Dec 2, 2020

As we are working towards Nix 3.0 we want to make sure that we make a
huge step forward in Nix's user experience. And once 3.0 is out of the
door we need to make sure that all future commands and features keep up
the standard of user experience.

This PR adds a CLI guideline document to the Nix documentation. Consider
this document a good starting point and a checklist when somebody will
be (re)implementing commands.

Clearly this guideline does nothing to improve user experience on its
own and can only be useful as long as it is going to be read and
cared for. But it is a first step into that direction.

As we are working towards Nix 3.0 we want to make sure that we make a
huge step forward in Nix's user experience. And once 3.0 is out of the
door we need to make sure that all future commands and features keep up
the standard of user experience.

This PR adds a CLI guideline document to the Nix documentation. Consider
this document a good starting point and a checklist when somebody will
be (re)implementing commands.

Clearly this guideline does nothing to improve user experience on its
own and can only be useful as long as it is going to be read and
cared for. But it is a first step into that direction.
@garbas garbas requested a review from edolstra December 2, 2020 16:11
@Ericson2314
Copy link
Member

Hmm this takes a sort of "behind the curtains" tone addressing Nix developers not users, though it's in the manual not some CONTRIBUTING.md. Might it be rephrased in a more "hi user, you should be able to expect these conventions to be respected across all Nix commands" way?

@edolstra
Copy link
Member

edolstra commented Dec 2, 2020

@Ericson2314 Good point. It would be better to put this either in a "developer info" appendix (we do already have "hacking" appendix), or in a separate book (which could also include #4280).

`nix` commands.

```shell
$ nix [<GROUP>] <COMMAND> [<ARGUMENTS>] [<OPTIONS>]
Copy link
Member

Choose a reason for hiding this comment

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

So I tried to apply this today and realized it's confusing. If nix foo is a command, then what is nix?

Maybe the current terminology ("subcommand") is better.

Copy link
Member Author

Choose a reason for hiding this comment

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

nix foo can either be a COMMAND or a GROUP. For example nix store is a GROUP and nix init is a COMMAND and also nix store copy is a COMMAND.

I would call nix top level command, but I don't really care how we call things as long as it is consistent :)

@edolstra edolstra mentioned this pull request Dec 2, 2020
@garbas
Copy link
Member Author

garbas commented Dec 3, 2020

@Ericson2314 Good point. It would be better to put this either in a "developer info" appendix (we do already have "hacking" appendix), or in a separate book (which could also include #4280).

This guideline should only be for the experimental nix command. Maybe it would be worthwhile to create a separate section Experimental (or something similar) and move all nix related documentation there? But, developer info would be definitely be better then current location.

@edolstra
Copy link
Member

edolstra commented Dec 3, 2020

It's not really about whether this is experimental but about whether it's user-facing, which it isn't - it's only for people who want to contribute to Nix. Let's make an appendix named "Contributing" which can include this and the existing "Hacking" section.

@zimbatm
Copy link
Member

zimbatm commented Dec 4, 2020

Would it make sense to also introduce the notion of "plumbing" vs "porcelain"? The old-school nix-* CLI is very much plumbing and can be used in all sorts of conditions, which is great. The Nix 2.0 CLI seems to be doing a bit of both.

@edolstra
Copy link
Member

edolstra commented Dec 4, 2020

Would it make sense to also introduce the notion of "plumbing" vs "porcelain"?

Roughly the "utility/scripting commands" (tier 3 in the current doc) are the plumbing.

@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-5/10560/1

@edolstra edolstra merged commit ec3e202 into NixOS:master Dec 18, 2020
@toonn
Copy link
Contributor

toonn commented Jan 8, 2021

There's a piece of similar documentation which I perceive to be missing which is a transition plan from the old to the new cli. I'm looking forward to a better UX but I hope the plan is not "Nix 2.0 has the old cli and the new experimental stuff is discouraged, Nix 3.0 has the new cli and only the new cli." Will there be an acclimatization period where the new cli is no longer marked as experimental and users are encouraged to attempt transitioning without being forced give up on the familiar cli all of a sudden?

@edolstra
Copy link
Member

edolstra commented Jan 8, 2021

The plan is roughly:

  • Nix 2.4 has the new CLI, but marked as experimental.
  • Nix 3.0 deprecates the old CLI and makes the new one non-experimental.
  • Nix 4.0 removes the old CLI. But this step may never happen :-)

@garbas garbas deleted the cli-guideline branch January 8, 2021 13:21
@toonn
Copy link
Contributor

toonn commented Jan 8, 2021

Thanks for the quick response. One more question. Apparently man looks for command-subcommand when you ask for man nix build for example. How will this interact with having a man page for both nix build and nix-build, will nix help build be the only way to get a man page (or is it only brief help output?) on the build subcommand? (Reference for the behavior)

@edolstra
Copy link
Member

edolstra commented Jan 8, 2021

Currently the new man pages are called nix3-* (e.g. nix3-build) to avoid ambiguity.

@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-6/11195/1

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

Successfully merging this pull request may close these issues.

None yet

9 participants