Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

97 lines
2.2 KiB
Nix

{
config,
pkgs,
lib,
...
}:
let
cfg = config.services.confd;
confdConfig = ''
backend = "${cfg.backend}"
confdir = "${cfg.confDir}"
interval = ${toString cfg.interval}
nodes = [ ${lib.concatMapStringsSep "," (s: ''"${s}"'') cfg.nodes}, ]
prefix = "${cfg.prefix}"
log-level = "${cfg.logLevel}"
watch = ${lib.boolToString cfg.watch}
'';
in
{
options.services.confd = {
enable = lib.mkEnableOption "confd, a service to manage local application configuration files using templates and data from etcd/consul/redis/zookeeper";
backend = lib.mkOption {
description = "Confd config storage backend to use.";
default = "etcd";
type = lib.types.enum [
"etcd"
"consul"
"redis"
"zookeeper"
];
};
interval = lib.mkOption {
description = "Confd check interval.";
default = 10;
type = lib.types.int;
};
nodes = lib.mkOption {
description = "Confd list of nodes to connect to.";
default = [ "http://127.0.0.1:2379" ];
type = lib.types.listOf lib.types.str;
};
watch = lib.mkOption {
description = "Confd, whether to watch etcd config for changes.";
default = true;
type = lib.types.bool;
};
prefix = lib.mkOption {
description = "The string to prefix to keys.";
default = "/";
type = lib.types.path;
};
logLevel = lib.mkOption {
description = "Confd log level.";
default = "info";
type = lib.types.enum [
"info"
"debug"
];
};
confDir = lib.mkOption {
description = "The path to the confd configs.";
default = "/etc/confd";
type = lib.types.path;
};
package = lib.mkPackageOption pkgs "confd" { };
};
config = lib.mkIf cfg.enable {
systemd.services.confd = {
description = "Confd Service.";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/confd";
};
};
environment.etc = {
"confd/confd.toml".text = confdConfig;
};
environment.systemPackages = [ cfg.package ];
services.etcd.enable = lib.mkIf (cfg.backend == "etcd") (lib.mkDefault true);
};
}