summary refs log tree commit diff stats
path: root/modules/configuration/nix.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/configuration/nix.nix')
-rw-r--r--modules/configuration/nix.nix25
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/configuration/nix.nix b/modules/configuration/nix.nix
new file mode 100644
index 0000000..504942e
--- /dev/null
+++ b/modules/configuration/nix.nix
@@ -0,0 +1,25 @@
+{ config, pkgs, ... }:
+
+{ nix = {
+    buildCores = 0;
+
+    daemonNiceLevel = 10;
+    daemonIONiceLevel = 4;
+
+    autoOptimiseStore = true;
+    gc = {
+      automatic = true;
+      options = "--delete-older-than 30d";
+    };
+  };
+
+  system.autoUpgrade = {
+    enable = true;
+  };
+  systemd.services.nixos-upgrade = {
+    environment.NIXPKGS_ALLOW_UNFREE = "1";
+    script = ''
+      ${config.system.build.nixos-rebuild}/bin/nixos-rebuild boot ${toString config.system.autoUpgrade.flags}
+    '';
+  };
+}