home/ssh/pvv: rename some badly named functions

This commit is contained in:
Oystein Kristoffer Tveit 2022-11-19 16:35:36 +01:00
parent af345b38fc
commit c2fca88a28
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
1 changed files with 6 additions and 10 deletions

View File

@ -33,17 +33,13 @@ let
]; ];
# Either( String [String] AttrSet{String} ) -> AttrSet{String} # Either( String [String] AttrSet{String} ) -> AttrSet{String}
normalizeValueType = let coerceToSSHMatchBlock =
inherit (lib.strings) isString;
inherit (lib.lists) isList;
inherit (lib.attrsets) filterAttrs;
in
machine: machine:
if (isString machine) then { names = [machine]; } if builtins.isString machine then { names = [machine]; }
else if (isList machine) then { names = machine; } else if builtins.isList machine then { names = machine; }
else machine; else machine;
# [String] -> AttrSet # ListOf(String) -> AttrSet
machineWithNames = let machineWithNames = let
inherit (lib.lists) head; inherit (lib.lists) head;
inherit (lib.strings) split; inherit (lib.strings) split;
@ -70,12 +66,12 @@ let
convertAdminMachine = convertAdminMachine =
convertMachineWithDefaults { user = adminUser; proxyJump = "hildring"; }; 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 convertMachinesWith = convertMachineFunction: let
inherit (lib.attrsets) listToAttrs; inherit (lib.attrsets) listToAttrs;
inherit (lib.trivial) pipe; inherit (lib.trivial) pipe;
pipeline = [ pipeline = [
(map normalizeValueType) (map coerceToSSHMatchBlock)
(map convertMachineFunction) (map convertMachineFunction)
listToAttrs listToAttrs
]; ];