From f57be92dcbf0c5c5ffe9a905e0c978b659feda51 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Sat, 24 Aug 2024 22:05:40 +0200 Subject: [PATCH] nixos/services.confd: remove `with lib;` --- nixos/modules/services/misc/confd.nix | 43 +++++++++++++-------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/nixos/modules/services/misc/confd.nix b/nixos/modules/services/misc/confd.nix index 836a1119a577..7744cee32049 100644 --- a/nixos/modules/services/misc/confd.nix +++ b/nixos/modules/services/misc/confd.nix @@ -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); }; }