nix-serve

This commit is contained in:
2024-11-12 14:08:55 -06:00
parent f67726b3ad
commit 63fa3236b1
2 changed files with 35 additions and 3 deletions

View File

@@ -0,0 +1,28 @@
{
lib,
config,
pkgs,
...
}:
let
cfg = config.my.servers.nix-serve;
setup = import ./setup.nix { inherit lib config; };
in
{
options.my.servers.nix-serve = setup.mkOptions "nix-serve" "cache" 5000;
config = lib.mkIf cfg.enable {
sops.secrets."private_cache_keys/miniserver".sopsFile = ../../secrets/keys.yaml;
services = {
nix-serve = {
enable = true;
openFirewall = true;
package = pkgs.nix-serve-ng;
port = cfg.port;
secretKeyFile = config.sops.secrets."private_cache_keys/miniserver".path;
};
nginx.virtualHosts."${cfg.host}" = lib.mkIf cfg.enableProxy (
setup.proxyReverse cfg.hostName cfg.port // { }
);
};
};
}