nixos-conf/modules/services/utils/cert-store-client.nix

45 lines
1.1 KiB
Nix
Raw Normal View History

{ config, lib, ... }:
let
2025-07-06 03:22:09 +03:00
cfg = config.custom.services.certStoreClient;
in
{
options = {
2025-07-06 03:22:09 +03:00
custom.services.certStoreClient.enable = lib.mkOption {
type = lib.types.bool;
default = false;
};
services.nginx.virtualHosts = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule {
config = lib.mkIf cfg.enable (
lib.mkDefault {
sslCertificate = config.sops.secrets.cert-fullchain.path;
sslCertificateKey = config.sops.secrets.cert-key.path;
}
);
}
);
};
};
config = lib.mkIf cfg.enable {
sops = {
secrets = {
cert-fullchain = {
sopsFile = ../../../secrets/cert.yaml;
restartUnits = [ "nginx.service" ];
owner = config.services.nginx.user;
group = config.services.nginx.user;
};
cert-key = {
sopsFile = ../../../secrets/cert.yaml;
restartUnits = [ "nginx.service" ];
owner = config.services.nginx.user;
group = config.services.nginx.user;
};
};
};
};
}