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

nix profile remove: interactive / check-removing-what-was-intended mode? #5743

Open
dtzWill opened this issue Dec 7, 2021 · 4 comments
Open

Comments

@dtzWill
Copy link
Member

dtzWill commented Dec 7, 2021

Is your feature request related to a problem? Please describe.

I'm not confident when removing desired items via nix profile remove. And unsure after if I removed what I meant, so feel compelled to double-check which is tedious and not ideal :).

This isn't a deal-breaker but might be a pain point we can provide a better experience for...

Describe the solution you'd like

Just an idea but, maybe a -i or --interactive flag that after resolving your indicated list of items to remove, prints them (TODO: format), and prompts if that's okay?

I'd probably leave this enabled 100% of the time as a precaution. Maybe I'm just bad at scanning the lines to ensure I use the right numbers, but this is especially potentially useful when using a pattern to match the items. Maybe the packages.x86_64-linux.hello syntax would work if it tab-completed (maybe it does when setup right, new machine, might not be configured here yet).

I guess this would probably either need to hold a lock or otherwise check nothing's changed before applying the requested changes (generation number maybe enough)?

Describe alternatives you've considered

  • Being less casual when invoking nix commands 😇
  • Just moving my packages installed for > 1 week (or whatever) into configuration.nix where they're neat and easier to manage, especially unfree items (as they're a pain to upgrade, need --impure which breaks caching the flake I think?).
  • Script to parse the list of packages (or just awk) and feeding to something for selection like one of those fancy terminal selectors that escape me presently. Or rofi. But these are really workarounds although maybe useful regardless :).
  • A simpler listing that uses friendlier names (".name" where present?) and reduces distance from numbers to friendly name because flake:nixpkgs#legacyPackages.x86_64-linux.cachix is a long walk (especially when basically all my installed packages have that suffix, but attribute name isn't always ideal).
  • Increasing line spacing/font/size in my terminal, new glasses, etc.
  • Teaching nix profile remove to print what it removes (perhaps under -v) so that if a mistake is made, at least it can be noticed and restored easily enough. (this might be useful regardless).
    • update: -v currently prints removed 1 packages, kept 56 packages which is better but is only a weak sanity check that intended items were removed (mostly ensures didn't accidentally match all the things or something, I think).

I seem to recall there's a bunch of discussion about the experimental Nix commands, and their design/goals, but can't seem to turn it up (pointers welcome, thanks!). Is that still around/active/relevant? Apologies if these are old ideas or dismissed and documented as such elsewhere, or if they're still too experimental to warrant such tweaks/suggestions. LMK 👍 .

@dtzWill
Copy link
Member Author

dtzWill commented Dec 7, 2021

@edolstra
Copy link
Member

I think it's more consistent with other commands to add a --dry-run flag which tells you what would be removed.

@tomberek
Copy link
Contributor

Also useful to have --dry-run for nix profile upgrade.

@stale
Copy link

stale bot commented Jul 10, 2022

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

@stale stale bot added the stale label Jul 10, 2022
@stale stale bot removed the stale label Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

4 participants