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

Add 'store add-gc-root' command to manually add indirect roots #11505

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

layus
Copy link
Member

@layus layus commented Sep 15, 2024

Motivation

This is a PoC fix for #7138. Now that I implemented it, I do not think it is the most elegant way to do it, as there is no way to ensure that the paths are not deleted during this operation. The command could fail however if not all the paths were successfully rooted.

Context

#7138

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@github-actions github-actions bot added documentation new-cli Relating to the "nix" command labels Sep 15, 2024
```console
$ readlink foo
/nix/store/xxx
$ nix add-root foo
Copy link
Member

@Mic92 Mic92 Sep 16, 2024

Choose a reason for hiding this comment

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

Intuitively I would have expected such as subcommand here:

Suggested change
$ nix add-root foo
$ nix store add-gc-root foo

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to add it in nix gc add-root, but nix gc seems mostly unused and intended to start a gc.

Copy link
Member

Choose a reason for hiding this comment

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

We currently don't have a top-level nix gc subcommand group, but a nix store gc command.

To help keep some consistency between commands, the subcommands are ideally nix <noun> <verb> with the exception of a small number of frequently used commands.
gc is a verb, since the "garbage" part is subordinate to the "collect" part (as a noun adjunct to be technical).
Since our commands end in verbs, this would create the expectation that nix gc is not a subcommand group, but a single action.

I think nix store add-root would be ok, but perhaps nix store add-gc-root would be better, as I think the hint about gc would be welcomed when reading scripts that call this command.
Interactive use should not be common, because that would usually come after nix build, which already produces a root.

Copy link
Member Author

Choose a reason for hiding this comment

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

Who makes final decisions about that ?

Copy link
Member

Choose a reason for hiding this comment

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

Nix team members, I would say. Often happens in those regular meetings.

@layus layus changed the title Add an 'add-root' comamnd to manually add indirect roots Add an 'add-root' command to manually add indirect roots Sep 16, 2024
@github-actions github-actions bot added the with-tests Issues related to testing. PRs with tests have some priority label Sep 17, 2024
@layus layus changed the title Add an 'add-root' command to manually add indirect roots Add 'store add-gc-root' command to manually add indirect roots Sep 17, 2024
@layus
Copy link
Member Author

layus commented Sep 17, 2024

Changed name, added tests.

@fricklerhandwerk fricklerhandwerk added the feature Feature request or proposal label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation feature Feature request or proposal new-cli Relating to the "nix" command with-tests Issues related to testing. PRs with tests have some priority
Projects
Status: To triage
Development

Successfully merging this pull request may close these issues.

4 participants