summary refs log tree commit diff stats
path: root/modules/nix.nix
diff options
context:
space:
mode:
authorAlan Pearce2017-09-09 16:40:31 +0200
committerAlan Pearce2017-09-09 16:49:30 +0200
commit3e054571d73ccacfec7b1d4714bfa74818b7affe (patch)
tree2b71925823fb288fc2031fdeabb178b6f0ca62c7 /modules/nix.nix
parent5a4ead8db870f7c9950d092d5dd3ec1c570024f2 (diff)
downloadnixos-configuration-3e054571d73ccacfec7b1d4714bfa74818b7affe.tar.lz
nixos-configuration-3e054571d73ccacfec7b1d4714bfa74818b7affe.tar.zst
nixos-configuration-3e054571d73ccacfec7b1d4714bfa74818b7affe.zip
Add nix configuration
Diffstat (limited to 'modules/nix.nix')
-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}
+  '';
+}