From efee6588cd4bdb379e547e71c822215584ee226e Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Thu, 9 May 2024 22:32:39 +0200 Subject: [PATCH] binary cache --- fake_flake.nix | 2 ++ modules/default.nix | 5 +++++ modules/nix_cache.nix | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 modules/nix_cache.nix diff --git a/fake_flake.nix b/fake_flake.nix index 7bc0f8a..c88243d 100644 --- a/fake_flake.nix +++ b/fake_flake.nix @@ -119,11 +119,13 @@ in nix.settings.extra-substituters = [ "https://cache.lix.systems" "https://nyx.chaotic.cx/" + "https://nixcache.grimmauld.de" ]; nix.settings.trusted-public-keys = [ "cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o=" "nyx.chaotic.cx-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8=" "chaotic-nyx.cachix.org-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8=" + "nixcache.grimmauld.de:LFBlakr8RYIuVb9I1S0+L9JGyB2THcfbPa0W6srghqo=" ]; } diff --git a/modules/default.nix b/modules/default.nix index 0037635..a3b0762 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -22,6 +22,7 @@ in ./email.nix ./discord-matrix-bridge.nix ./mastodon.nix + ./nix_cache.nix ]; options.serverConfig = with lib; { @@ -179,6 +180,10 @@ in host = "mastodon.${domain}"; accessType = "none"; }; + nix_cache_host = { + host = "nixcache.${domain}"; + port = 5000; + }; }; }; diff --git a/modules/nix_cache.nix b/modules/nix_cache.nix new file mode 100644 index 0000000..e85ea75 --- /dev/null +++ b/modules/nix_cache.nix @@ -0,0 +1,17 @@ +{ + lib, + config, + inputs, + pkgs, + ... +}: +let + inherit (config.serverConfig) ports vhosts; +in +{ + services.nix-serve = { + enable = true; + secretKeyFile = "/var/cache-priv-key.pem"; + port = vhosts.nix_cache_host.port; + }; +}