nixos/services.confd: remove with lib;
This commit is contained in:
parent
4948e0be37
commit
f57be92dcb
@ -1,7 +1,4 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.confd;
|
||||
|
||||
@ -9,62 +6,62 @@ let
|
||||
backend = "${cfg.backend}"
|
||||
confdir = "${cfg.confDir}"
|
||||
interval = ${toString cfg.interval}
|
||||
nodes = [ ${concatMapStringsSep "," (s: ''"${s}"'') cfg.nodes}, ]
|
||||
nodes = [ ${lib.concatMapStringsSep "," (s: ''"${s}"'') cfg.nodes}, ]
|
||||
prefix = "${cfg.prefix}"
|
||||
log-level = "${cfg.logLevel}"
|
||||
watch = ${boolToString cfg.watch}
|
||||
watch = ${lib.boolToString cfg.watch}
|
||||
'';
|
||||
|
||||
in {
|
||||
options.services.confd = {
|
||||
enable = mkEnableOption "confd, a service to manage local application configuration files using templates and data from etcd/consul/redis/zookeeper";
|
||||
enable = lib.mkEnableOption "confd, a service to manage local application configuration files using templates and data from etcd/consul/redis/zookeeper";
|
||||
|
||||
backend = mkOption {
|
||||
backend = lib.mkOption {
|
||||
description = "Confd config storage backend to use.";
|
||||
default = "etcd";
|
||||
type = types.enum ["etcd" "consul" "redis" "zookeeper"];
|
||||
type = lib.types.enum ["etcd" "consul" "redis" "zookeeper"];
|
||||
};
|
||||
|
||||
interval = mkOption {
|
||||
interval = lib.mkOption {
|
||||
description = "Confd check interval.";
|
||||
default = 10;
|
||||
type = types.int;
|
||||
type = lib.types.int;
|
||||
};
|
||||
|
||||
nodes = mkOption {
|
||||
nodes = lib.mkOption {
|
||||
description = "Confd list of nodes to connect to.";
|
||||
default = [ "http://127.0.0.1:2379" ];
|
||||
type = types.listOf types.str;
|
||||
type = lib.types.listOf lib.types.str;
|
||||
};
|
||||
|
||||
watch = mkOption {
|
||||
watch = lib.mkOption {
|
||||
description = "Confd, whether to watch etcd config for changes.";
|
||||
default = true;
|
||||
type = types.bool;
|
||||
type = lib.types.bool;
|
||||
};
|
||||
|
||||
prefix = mkOption {
|
||||
prefix = lib.mkOption {
|
||||
description = "The string to prefix to keys.";
|
||||
default = "/";
|
||||
type = types.path;
|
||||
type = lib.types.path;
|
||||
};
|
||||
|
||||
logLevel = mkOption {
|
||||
logLevel = lib.mkOption {
|
||||
description = "Confd log level.";
|
||||
default = "info";
|
||||
type = types.enum ["info" "debug"];
|
||||
type = lib.types.enum ["info" "debug"];
|
||||
};
|
||||
|
||||
confDir = mkOption {
|
||||
confDir = lib.mkOption {
|
||||
description = "The path to the confd configs.";
|
||||
default = "/etc/confd";
|
||||
type = types.path;
|
||||
type = lib.types.path;
|
||||
};
|
||||
|
||||
package = mkPackageOption pkgs "confd" { };
|
||||
package = lib.mkPackageOption pkgs "confd" { };
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.confd = {
|
||||
description = "Confd Service.";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
@ -80,6 +77,6 @@ in {
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
services.etcd.enable = mkIf (cfg.backend == "etcd") (mkDefault true);
|
||||
services.etcd.enable = lib.mkIf (cfg.backend == "etcd") (lib.mkDefault true);
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user