dotfiles/nixos/cache-server.nix

35 lines
714 B
Nix

{ config, lib, ... }:
with lib;
let cfg = config.myModules.cache-server;
in
{
options = {
myModules.cache-server = {
enable = mkEnableOption "nix cache server";
port = mkOption {
type = types.int;
default = 5050;
};
host-string = mkOption {
type = types.string;
default = "0.0.0.0";
};
path = mkOption {
type = types.string;
default = "/";
};
};
};
config = mkIf cfg.enable {
age.secrets."cache-priv-key.pem".file = ./secrets/cache-priv-key.pem.age;
services.nix-serve = {
enable = true;
secretKeyFile = config.age.secrets."cache-priv-key.pem".path;
port = cfg.port;
};
};
}