summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--modules/nix.nix24
-rw-r--r--satoshipad.nix4
2 files changed, 28 insertions, 0 deletions
diff --git a/modules/nix.nix b/modules/nix.nix
new file mode 100644
index 00000000..35b7cea6
--- /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}
+  '';
+}
diff --git a/satoshipad.nix b/satoshipad.nix
index 1f013def..36e0331f 100644
--- a/satoshipad.nix
+++ b/satoshipad.nix
@@ -29,6 +29,7 @@
     ./modules/accounting.nix
     ./modules/passwords.nix
     ./modules/network-manager.nix
+    ./modules/nix.nix
   ];
 
   boot.initrd.luks.devices = [
@@ -41,5 +42,8 @@
 
   networking.hostName = "satoshipad";
 
+  nix.gc.dates = "12:00";
+  system.autoUpgrade.dates = "12:24";
+
   system.stateVersion = "17.03";
 }