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

Group 'nix' subcommands #3858

Merged
merged 9 commits into from Dec 3, 2020
Merged

Group 'nix' subcommands #3858

merged 9 commits into from Dec 3, 2020

Conversation

edolstra
Copy link
Member

As suggested in https://gist.github.com/gilligan/a0942a490c5ab5b854cc5ad668374529, this PR puts various nix subcommands underneath nix store, nix hash and nix nar. This unclutters the top-level interface.

I didn't move nix path-info since I don't know the best name (e.g. nix store path-info? nix store info?).

@Kloenk
Copy link
Member

Kloenk commented Jul 24, 2020

Sounds grate. But I think this creates more a need for things like alias as supported by git.

@Ericson2314
Copy link
Member

I was thinking hash to-* should be like hash convert --to *. Once we merge the PR with the parsing changes we can have a --from too.

@davidak
Copy link
Member

davidak commented Jul 24, 2020

I didn't move nix path-info since I don't know the best name (e.g. nix store path-info? nix store info?).

Summary: query information about store paths

I guess nix store path-info would be intuitive then. nix store info sounds like general information about the store, like total size, number of packages...

@matthewbauer
Copy link
Member

I think this would be confusing since we already have nix-store and nix-hash. If you wanted to add man pages for any of those commands it would run into collisions since man nix store and man nix-store are equivalent (see --no-subpages in https://man7.org/linux/man-pages/man1/man.1.html).

Also, nix doctor, nix upgrade-nix, and nix show-config seem pretty fundamental commands, hiding them behind "system" seems bad.

@Ma27
Copy link
Member

Ma27 commented Jul 25, 2020

Apart from @matthewbauer's comment I think that while this might look pretty, it may be fairly hard to remember which command is under which two(!) parents which is something at least I'd be rather unhappy with during daily use.

Also I'd like to mention that git - which was IIRC one of the idols for the introduction of the three-letter nix-command - has most of the comments directly at "top-level".

@edolstra
Copy link
Member Author

Also, nix doctor, nix upgrade-nix, and nix show-config seem pretty fundamental commands, hiding them behind "system" seems bad.

I agree, which is why I didn't add a nix system command.

Also I'd like to mention that git - which was IIRC one of the idols for the introduction of the three-letter nix-command - has most of the comments directly at "top-level".

Sure, but the git CLI is also widely considered to be a bit of a mess. And it does have second-level commands like git remote and git submodules. But it's pretty inconsistent about it, e.g. git branch has various suboperations, only they're identified using flags (e.g. git branch -d) rather than subcommands.

If you wanted to add man pages for any of those commands it would run into collisions since man nix store and man nix-store are equivalent

Hm yeah, that's pretty annoying...

@Ma27
Copy link
Member

Ma27 commented Jul 27, 2020

And it does have second-level commands like git remote and git submodules

Yes that's the case for special features of git (like it's the case for nix flake in Nix for instance). To me it seems like this change would hide several features under one "category".

The great thing about tools like git is that I can press git <TAB> and I get a completeable list of available subcommands. With this change, I have to found out again under which "category" those are (similar to the nix-* cmds at the moment).

@FRidh
Copy link
Member

FRidh commented Aug 4, 2020

I didn't move nix path-info since I don't know the best name (e.g. nix store path-info? nix store info?).

Maybe nix store query-path? It says query in the --help.

Ma27 added a commit to Ma27/nix-zsh-completions that referenced this pull request Aug 5, 2020
Needed for commands like `nix flake check` where the behavior for `nix
flake <tab>` must be the same as for `nix <tab>`.

This will become relevant in the future as it's planned to namespace
even more-commands[1].

For simplicity I didn't test full recursion, we probably have to fix
this to support e.g. `nix foo bar baz` in the future.

[1] NixOS/nix#3858
@edolstra
Copy link
Member Author

edolstra commented Dec 2, 2020

Need to update this to be in line with #4302.

@edolstra edolstra merged commit 8df58ea into NixOS:master Dec 3, 2020
@edolstra edolstra deleted the group-commands branch December 3, 2020 22:55
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

7 participants