From c2fca88a28fc7b16cd13812a31b506965c36a230 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 19 Nov 2022 16:35:36 +0100 Subject: [PATCH] home/ssh/pvv: rename some badly named functions --- home/config/ssh/hosts/pvv.nix | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/home/config/ssh/hosts/pvv.nix b/home/config/ssh/hosts/pvv.nix index d1bc15d..b4f215a 100644 --- a/home/config/ssh/hosts/pvv.nix +++ b/home/config/ssh/hosts/pvv.nix @@ -33,17 +33,13 @@ let ]; # Either( String [String] AttrSet{String} ) -> AttrSet{String} - normalizeValueType = let - inherit (lib.strings) isString; - inherit (lib.lists) isList; - inherit (lib.attrsets) filterAttrs; - in + coerceToSSHMatchBlock = machine: - if (isString machine) then { names = [machine]; } - else if (isList machine) then { names = machine; } + if builtins.isString machine then { names = [machine]; } + else if builtins.isList machine then { names = machine; } else machine; - # [String] -> AttrSet + # ListOf(String) -> AttrSet machineWithNames = let inherit (lib.lists) head; inherit (lib.strings) split; @@ -70,12 +66,12 @@ let convertAdminMachine = convertMachineWithDefaults { user = adminUser; proxyJump = "hildring"; }; - # [ Either(String [String] AttrSet{String}) ] -> (AttrSet -> AttrSet) -> AttrSet + # ListOf (Either(String ListOf(String) AttrsOf(String))) -> (AttrSet -> AttrSet) -> AttrSet convertMachinesWith = convertMachineFunction: let inherit (lib.attrsets) listToAttrs; inherit (lib.trivial) pipe; pipeline = [ - (map normalizeValueType) + (map coerceToSSHMatchBlock) (map convertMachineFunction) listToAttrs ];