diff options
author | Alan Pearce | 2024-05-17 16:08:52 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-17 16:10:01 +0200 |
commit | da04b1c6dd13af0dbada0d77ff195ab5e99eed5e (patch) | |
tree | a83bcdbf9f58127dfd330a44ac13f9d5d5dd7da9 /system/settings/configuration | |
parent | 249f11ad9819d992a8fed1caa1432e9e8036b7d2 (diff) | |
download | nixfiles-da04b1c6dd13af0dbada0d77ff195ab5e99eed5e.tar.lz nixfiles-da04b1c6dd13af0dbada0d77ff195ab5e99eed5e.tar.zst nixfiles-da04b1c6dd13af0dbada0d77ff195ab5e99eed5e.zip |
system/nix: set OS-agnostic nix options in common module
Diffstat (limited to 'system/settings/configuration')
-rw-r--r-- | system/settings/configuration/nix-linux.nix | 32 | ||||
-rw-r--r-- | system/settings/configuration/nix.nix | 31 |
2 files changed, 38 insertions, 25 deletions
diff --git a/system/settings/configuration/nix-linux.nix b/system/settings/configuration/nix-linux.nix new file mode 100644 index 00000000..3b32ebd5 --- /dev/null +++ b/system/settings/configuration/nix-linux.nix @@ -0,0 +1,32 @@ +{ config +, lib +, pkgs +, ... +}: { + imports = [ + ./nix.nix + ]; + + nix = { + settings = { + auto-optimise-store = true; + + daemonCPUSchedPolicy = "idle"; + daemonIOSchedClass = "idle"; + }; + }; + + nixpkgs.config.allowUnfree = true; + + system.autoUpgrade = { + enable = true; + flags = [ "--max-jobs" "2" ]; + flake = "/home/alan/projects/alanpearce/nixfiles"; + }; + systemd.services.nixos-upgrade = { + script = pkgs.lib.mkForce '' + ${pkgs.nix}/bin/nix-channel --update + ${config.system.build.nixos-rebuild}/bin/nixos-rebuild boot --no-build-output ${toString config.system.autoUpgrade.flags} + ''; + }; +} diff --git a/system/settings/configuration/nix.nix b/system/settings/configuration/nix.nix index 25b9696f..c8db7836 100644 --- a/system/settings/configuration/nix.nix +++ b/system/settings/configuration/nix.nix @@ -8,36 +8,17 @@ ]; nix = { settings = { - cores = 0; - auto-optimise-store = true; + cores = lib.mkDefault 0; use-xdg-base-directories = true; + keep-outputs = true; + keep-derivations = true; + experimental-features = "nix-command flakes"; + warn-dirty = false; }; - daemonCPUSchedPolicy = "idle"; - daemonIOSchedClass = "idle"; - - extraOptions = '' - keep-outputs = true - keep-derivations = true - experimental-features = nix-command flakes - warn-dirty = false - ''; - gc = { automatic = lib.mkDefault true; - options = "--delete-older-than 14d"; + options = lib.mkDefault "--delete-older-than 14d"; }; }; - - system.autoUpgrade = { - enable = true; - flags = [ "--max-jobs" "2" ]; - flake = "/home/alan/projects/alanpearce/nixfiles"; - }; - systemd.services.nixos-upgrade = { - script = pkgs.lib.mkForce '' - ${pkgs.nix}/bin/nix-channel --update - ${config.system.build.nixos-rebuild}/bin/nixos-rebuild boot --no-build-output ${toString config.system.autoUpgrade.flags} - ''; - }; } |