This commit is contained in:
mjallen18
2026-03-25 18:23:08 -05:00
parent 78280d5150
commit 7fcbd0bb7c
35 changed files with 976 additions and 567 deletions

View File

@@ -4,57 +4,36 @@
namespace,
...
}:
let
nixSettings = lib.${namespace}.nixSettings;
in
{
nix = {
settings = {
settings = nixSettings.commonSettings // {
# extra-sandbox-paths = [ config.programs.ccache.cacheDir ];
substituters = [
# NixOS-only: lantian attic cache (has some useful packages)
"https://attic.xuyh0120.win/lantian"
"http://jallen-nas.local:9012/nas-cache"
"https://nixos-apple-silicon.cachix.org"
"https://nixos-raspberrypi.cachix.org"
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
];
]
++ nixSettings.commonSubstituters;
trusted-public-keys = [
"lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc="
"nas-cache:eK0eRVAt9QNwbkLIyOo9N5Z5+zi6ukI4mSlL196C7Yg="
"nixos-apple-silicon.cachix.org-1:8psDu5SA5dAD7qA0zMy5UT292TxeEPzIz8VVEr2Js20="
"nixos-raspberrypi.cachix.org-1:4iMO9LXa8BqhU+Rpg6LQKiGa2lsNh/j2oiYLNOQ5sPI="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
warn-dirty = lib.mkForce false;
experimental-features = lib.mkForce [
"nix-command"
"flakes"
];
trusted-users = [
"@wheel"
"@admin"
];
builders-use-substitutes = true;
connect-timeout = lib.mkDefault 5;
fallback = true;
log-lines = lib.mkDefault 25;
max-free = lib.mkDefault (3000 * 1024 * 1024);
min-free = lib.mkDefault (512 * 1024 * 1024);
]
++ nixSettings.commonTrustedPublicKeys;
};
# Linux-specific: run the nix daemon at idle priority to avoid impacting
# interactive work during builds.
daemonCPUSchedPolicy = lib.mkDefault "idle";
daemonIOSchedClass = lib.mkDefault "idle";
daemonIOSchedPriority = lib.mkDefault 7;
# Garbage collect automatically every week
gc = {
automatic = lib.mkDefault true;
options = lib.mkDefault "--delete-older-than 30d";
};
gc = nixSettings.commonGc;
optimise.automatic = lib.mkDefault true;
};
# Give the nix-gc systemd unit the same idle-IO treatment as the daemon.
systemd.services.nix-gc.serviceConfig = {
CPUSchedulingPolicy = "batch";
IOSchedulingClass = "idle";