{ config, pkgs, ... }: { # Garbage collection: Delete generations older than 5 days and then delete unreachable store objects. # https://nixos.wiki/wiki/Storage_optimization#Automation # https://nixos.wiki/wiki/Storage_optimization#Removing_old_generations nix.gc = { automatic = true; dates = "weekly"; options = "--delete-older-than 5d"; }; # We need to explicitly run garbage collection for user profiles, # this is not done by the global `nix.gc` option. home-manager.users."yoda" = { osConfig, config, pkgs, ... }: { nix.gc = { automatic = true; frequency = "weekly"; options = "--delete-older-than 5d"; }; }; home-manager.users."root" = { osConfig, config, pkgs, ... }: { nix.gc = { automatic = true; frequency = "weekly"; options = "--delete-older-than 5d"; }; }; }