diff options
author | Yarny0 <41838844+Yarny0@users.noreply.github.com> | 2023-11-18 12:22:46 +0100 |
---|---|---|
committer | Yarny0 <41838844+Yarny0@users.noreply.github.com> | 2023-12-02 09:09:27 +0100 |
commit | fe96d79adf3ff2ca15d21163972639fd4964f589 (patch) | |
tree | 277ecd124f013200ed998c5880e7965dba03bcbf /nixos/modules/programs | |
parent | 363cf1e363cdf948f11bdc46596df5b2a4bec30b (diff) | |
download | nixlib-fe96d79adf3ff2ca15d21163972639fd4964f589.tar nixlib-fe96d79adf3ff2ca15d21163972639fd4964f589.tar.gz nixlib-fe96d79adf3ff2ca15d21163972639fd4964f589.tar.bz2 nixlib-fe96d79adf3ff2ca15d21163972639fd4964f589.tar.lz nixlib-fe96d79adf3ff2ca15d21163972639fd4964f589.tar.xz nixlib-fe96d79adf3ff2ca15d21163972639fd4964f589.tar.zst nixlib-fe96d79adf3ff2ca15d21163972639fd4964f589.zip |
nixos/tsm-client: drop own `checkIUnique` for `allUnique`
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r-- | nixos/modules/programs/tsm-client.nix | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/nixos/modules/programs/tsm-client.nix b/nixos/modules/programs/tsm-client.nix index e9e8d14c0e4c..bf240ea64cb3 100644 --- a/nixos/modules/programs/tsm-client.nix +++ b/nixos/modules/programs/tsm-client.nix @@ -2,23 +2,13 @@ let - inherit (builtins) length map; inherit (lib.attrsets) attrNames filterAttrs hasAttr mapAttrs mapAttrsToList optionalAttrs; + inherit (lib.lists) allUnique map; inherit (lib.modules) mkDefault mkIf; inherit (lib.options) literalExpression mkEnableOption mkOption mkPackageOption; inherit (lib.strings) concatLines optionalString toLower; inherit (lib.types) addCheck attrsOf lines nonEmptyStr nullOr path port str strMatching submodule; - # Checks if given list of strings contains unique - # elements when compared without considering case. - # Type: checkIUnique :: [string] -> bool - # Example: checkIUnique ["foo" "Foo"] => false - checkIUnique = lst: - let - lenUniq = l: length (lib.lists.unique l); - in - lenUniq lst == lenUniq (map toLower lst); - # TSM rejects servername strings longer than 64 chars. servernameType = strMatching ".{1,64}"; @@ -110,7 +100,7 @@ let # differ only by upper and lower case. type = addCheck (attrsOf (nullOr str)) - (attrs: checkIUnique (attrNames attrs)); + (attrs: allUnique (map toLower (attrNames attrs))); default = {}; example.compression = "yes"; example.passwordaccess = null; @@ -238,7 +228,7 @@ let assertions = [ { - assertion = checkIUnique (mapAttrsToList (k: v: v.name) cfg.servers); + assertion = allUnique (mapAttrsToList (k: v: toLower v.name) cfg.servers); message = '' TSM servernames contain duplicate name (note that case doesn't matter!) |