Files
nixos-configs/hosts/backwards/modules/boot/default.nix
T
Alexander Heldt 657be047ec backwards: Replace nix-gc-env with nh clean
`nix.gc` run as root cannot prune generations under
`~/.local/state/nix/profiles` (NixOS/nix#8508), and `nix-gc-env` only
looks in `/nix/var/nix/profiles`. Home-manager generations therefore
accumulated since August 2024 and filled the disk.

`nh clean all` enumerates users and walks their per-user profiles too.
It replaces `nix.gc.automatic`, which cannot be enabled alongside it.
2026-10-20 21:20:31 +02:00

53 lines
1.1 KiB
Nix

{
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;
};
extraModprobeConfig = ''
options snd-intel-dspcfg dsp_driver=1
options snd_hda_intel power_save=0 power_save_controller=N
'';
};
};
}