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