From 7d8328b880608caec29997a4fe637b4101e2b403 Mon Sep 17 00:00:00 2001 From: Alejandro Angulo Date: Sat, 8 Apr 2023 19:13:00 -0700 Subject: [PATCH] Configured self hosted cache --- modules/nix/default.nix | 16 ++++++++++++++++ systems/x86_64-linux/node/default.nix | 1 + 2 files changed, 17 insertions(+) diff --git a/modules/nix/default.nix b/modules/nix/default.nix index d09500e..baf71ee 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -7,6 +7,7 @@ }: with lib; let cfg = config.aa.nix; + selfHostedCacheHost = "192.168.113.69"; in { options.aa.nix = with types; { enable = mkEnableOption "manage nix configuration."; @@ -15,6 +16,8 @@ in { default = pkgs.nixVersions.unstable; description = "Which nix package to use."; }; + + useSelfhostedCache = mkEnableOption "use self-hosted nix cache (currently hosted on gospel)"; }; config = mkIf cfg.enable { @@ -32,6 +35,19 @@ in { experimental-features = "nix-command flakes"; trusted-users = users; allowed-users = users; + + builders-use-substitutes = cfg.useSelfhostedCache; + substituters = + if cfg.useSelfhostedCache + then [ + selfHostedCacheHost + "https://cache.nixos.org" + ] + else []; + trusted-public-keys = + if cfg.useSelfhostedCache + then ["gospelCache:9cbn8Wm54BbwpPS0TXw+15wrYZBpfOJt4Fzfbfcq/pc="] + else []; }; gc = { diff --git a/systems/x86_64-linux/node/default.nix b/systems/x86_64-linux/node/default.nix index 6bdded2..682ef7c 100644 --- a/systems/x86_64-linux/node/default.nix +++ b/systems/x86_64-linux/node/default.nix @@ -10,6 +10,7 @@ aa = { nix.enable = true; + nix.useSelfhostedCache = true; services.openssh.enable = true; system.zfs.enable = true;