{ lib, config, ... }: let configurationLimit = config.mod.gc.configurationLimit; in { options = { mod.gc = { configurationLimit = lib.mkOption { type = lib.types.int; default = 10; description = "number of configuration generations to keep"; }; }; }; config = { # `nix.gc` cannot prune generations under `~/.local/state/nix/profiles` # when run as root (NixOS/nix#8508), so home-manager generations piled up. # `nh clean` walks those per-user profiles too. programs.nh = { enable = true; clean = { enable = true; dates = "weekly"; extraArgs = "--keep ${builtins.toString configurationLimit}"; }; }; boot = { tmp.cleanOnBoot = true; loader = { systemd-boot = { enable = true; inherit configurationLimit; }; efi.canTouchEfiVariables = true; }; blacklistedKernelModules = [ "hid_nintendo" ]; kernelParams = [ "i915.enable_dc=0" "i915.disable_power_well=0" ]; extraModprobeConfig = '' options snd-intel-dspcfg dsp_driver=1 options snd_hda_intel power_save=0 power_save_controller=N ''; }; }; }