aux-config/modules/nixos/services/binary-cache/default.nix
kB01 8a73af6a7c
All checks were successful
/ Check Nix Flake (push) Successful in 2m4s
Added NAS Suite
2025-02-22 02:45:49 +01:00

35 lines
995 B
Nix

{ inputs, config, lib, pkgs, ... }:
let
cfg = config.services.binary-cache;
in
{
imports = [
];
options.services.binary-cache = {
enable = lib.mkOption {
type = with lib.types; uniq bool;
default = false;
description = "Enable Preconfigured Binary-Cache";
};
};
config = lib.mkIf cfg.enable {
services.nix-serve = {
enable = true;
secretKeyFile = "/var/secrets/cache-game01-private-key.pem";
};
# Configure Reverse-Proxy
services.traefik.dynamicConfigOptions = {
http.services.nix-cache.loadBalancer.servers = [ { url = "http://${config.services.nix-serve.bindAddress}:${toString config.services.nix-serve.port}/"; } ];
http.routers.nix-cache.entrypoints = "websecure";
# http.routers.nix-cache.tls = true;
http.routers.nix-cache.tls.certresolver = "letsencrypt";
http.routers.nix-cache.rule = "Host(`cache.game01.kb-one.de`)";
http.routers.nix-cache.service = "nix-cache";
};
};
}