# modules/hosts/laptop/nix-settings.nix — nix daemon settings and the nh helper.# Imported by both the `nixos` target and the `bootstrap` stage.{ ... }:
{
flake.nixosModules.laptop-nix-settings= { pkgs, ... }:
{
# The newest *released* Nix, rather than the conservative default nixpkgs# pins (2.34.x at the time of writing). `nixVersions.git` is a prerelease# build of master and is deliberately not used: a regression there would# break the daemon that rebuilds this system. nix.package= pkgs.nixVersions.latest;
nix.settings= {
experimental-features= [ "nix-command""flakes" ];
# Hyprland is built from its own flake pins, which cache.nixos.org does# not have. Without the Hyprland cache every update compiles it locally.substituters= [
"https://cache.nixos.org""https://hyprland.cachix.org" ];
trusted-public-keys= [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=""hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ];
};
# nh, the Nix helper: `nh os switch|boot|test`, `nh clean all`, `nh search`.# Wraps nixos-rebuild with nix-output-monitor progress and an nvd diff of# what a generation changes, and asks for sudo only for the switch itself.# NH_FLAKE points at this repo, so `nh os boot` works from any directory;# the configuration is picked by hostname (`nixos`), or with -H <name>. programs.nh= {
enable=true;
flake="/home/daemonsec/NixDaemon";
clean= {
enable=true; # weekly `nh clean all`: drops old generations and runs the GC,dates="weekly"; # keeping the last 5 and anything newer than 14 daysextraArgs="--keep 5 --keep-since 14d";
};
};
# The two tools nh builds on, also useful by hand:# nvd diff /run/current-system result what a build would change# nom build .#… nix build with a live tree view environment.systemPackages=with pkgs; [
nvd
nix-output-monitor
];
}
;
}