summary refs log tree commit diff stats
path: root/modules/nixos
diff options
context:
space:
mode:
authorSilas Schöffel <sils@sils.li>2024-04-05 01:22:47 +0200
committerSilas Schöffel <sils@sils.li>2024-04-05 01:22:47 +0200
commitbafc142db9257a34220da00c543d2b17e948b230 (patch)
tree949e2404e11d745412431ff53faf695faa036b79 /modules/nixos
parenttheming: change theme to tokyo-night-dark (diff)
downloadnix-config-bafc142db9257a34220da00c543d2b17e948b230.tar.gz
nix-config-bafc142db9257a34220da00c543d2b17e948b230.zip
nix: init module
Diffstat (limited to 'modules/nixos')
-rw-r--r--modules/nixos/sils/default.nix1
-rw-r--r--modules/nixos/sils/nix.nix63
2 files changed, 64 insertions, 0 deletions
diff --git a/modules/nixos/sils/default.nix b/modules/nixos/sils/default.nix
index 4db5358..dfa0510 100644
--- a/modules/nixos/sils/default.nix
+++ b/modules/nixos/sils/default.nix
@@ -2,6 +2,7 @@
   imports = [
     ./basesystem.nix
     ./meta.nix
+    ./nix.nix
     ./plymouth.nix
     ./theming.nix
   ];
diff --git a/modules/nixos/sils/nix.nix b/modules/nixos/sils/nix.nix
new file mode 100644
index 0000000..dc50470
--- /dev/null
+++ b/modules/nixos/sils/nix.nix
@@ -0,0 +1,63 @@
+{
+  self,
+  config,
+  nixpkgs,
+  lib,
+  ...
+}: let
+  cfg = config.sils.nix;
+in {
+  options.sils.nix = {
+    remoteBuild = lib.mkEnableOption;
+  };
+  config = {
+    nix = {
+      registry = {
+        nixpkgs.flake = nixpkgs;
+        n.flake = nixpkgs;
+        self.flake = self;
+        s.flake = self;
+      };
+      channel.enable = false;
+      distributedBuilds = cfg.remoteBuild;
+      buildMachines = [
+        {
+          hostName = "server1.vhack.eu";
+          protocol = "ssh-ng";
+          system = "x86_64-linux";
+          supportedFeatures = ["big-parallel"];
+        }
+      ];
+      gc = {
+        automatic = true;
+        dates = "daily";
+        options = "--delete-older-than 3";
+      };
+      settings = {
+        auto-optimise-store = true;
+        experimental-features = ["nix-command" "flakes"];
+        substituters = [
+          "https://cache.garnix.io"
+          "https://hyprland.cachix.org"
+        ];
+        trusted-public-keys = [
+          "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
+          "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
+        ];
+      };
+    };
+    home-manager.users.root.home = lib.mkIf cfg.remoteBuild {
+      username = "root";
+      homeDirectory = "/root";
+      stateVersion = "23.05";
+      file.".ssh/config" = {
+        text = ''
+          Host server1.vhack.eu
+                 IdentitiesOnly yes
+                 IdentityFIle ${config.age.secrets.nixremote.path}
+                 User nixremote
+        '';
+      };
+    };
+  };
+}