mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55:41 +03:00

After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
96 lines
2.2 KiB
Nix
96 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);
|
|
};
|
|
}
|