Add automatic garbage collection for home-manager user profiles
Configure nix.gc to automatically clean up old home-manager generations weekly, which complements the existing system-level gc. Uses --delete-older-than 10d on Linux to maintain a rollback window, but overrides to -d on Darwin to work around a launchd bug where multi-part options aren't properly split into separate arguments.
This commit is contained in:
@@ -4,4 +4,8 @@
|
||||
imports = [
|
||||
../aerospace
|
||||
];
|
||||
|
||||
# Override to use -d instead of --delete-older-than on Darwin due to launchd bug
|
||||
# https://github.com/nix-community/home-manager/issues/7211
|
||||
nix.gc.options = "-d";
|
||||
}
|
||||
|
||||
@@ -24,6 +24,17 @@ in
|
||||
tree
|
||||
];
|
||||
|
||||
# Automatic garbage collection for user profile (home-manager generations).
|
||||
# This complements system-level gc which only cleans system generations.
|
||||
# - Linux: Uses --delete-older-than to keep 10-day rollback window
|
||||
# - Darwin: Overridden to use -d in base-darwin role to avoid launchd bug
|
||||
# (https://github.com/nix-community/home-manager/issues/7211)
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
randomizedDelaySec = mkIf pkgs.stdenv.isLinux "14m";
|
||||
options = "--delete-older-than 10d";
|
||||
};
|
||||
|
||||
# Essential programs everyone needs
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
|
||||
Reference in New Issue
Block a user