NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.38k stars 13.61k forks source link

it is not possible to exclude specific generations from garbage collection #182801

Open devvythelopper opened 2 years ago

devvythelopper commented 2 years ago

Describe the bug

There seems to be no way to add a feature request other than through writing a whole RFC, which is not the type of time I have. Maybe point me to the right place tho... Anyways, ergo this simple issue:

nix.gc.automatic = true; or respectively nix-collect-garbage should allow nixos users to specify specific generations that should not be garbage collected.

E.g. it should be possible to specify some starting points, that one can always return to in case something goes wrong. One could for example have a generation to be considered a "fresh install" to which a new configuration could be deployed, that NEVER gets garbage collected.

Steps To Reproduce

run nix-collect-garbage -d --exclude 1 2 3 4

Expected behavior

every generation other than 1 2 3 and 4 should be garbage collected.

Screenshots

Additional context

Notify maintainers

Metadata

- system: `"x86_64-linux"`
 - host os: `Linux 5.15.53, NixOS, 22.05 (Quokka), 22.05.1604.cf034a867e0`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.8.1`
 - channels(root): `"nixos-22.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
veprbl commented 2 years ago

This request probably belongs to https://github.com/NixOS/nix