extendedLib: attrsets.concatAttrs -> lib.mergeAttrsList

This commit is contained in:
Oystein Kristoffer Tveit 2024-09-26 10:14:36 +02:00
parent 0ea394dbf9
commit 7500197568
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
2 changed files with 12 additions and 14 deletions

View File

@ -1,4 +1,4 @@
{ pkgs, lib, extendedLib, ... }:
{ pkgs, lib, ... }:
let
adminUser = "root";
normalUser = "oysteikt";
@ -88,16 +88,17 @@ let
machines: pipe machines pipeline;
in
{
programs.ssh.matchBlocks = (extendedLib.attrsets.concatAttrs [
programs.ssh.matchBlocks = lib.mergeAttrsList [
(convertMachinesWith convertNormalMachine normalMachines)
(convertMachinesWith convertAdminMachine rootMachines)
]) // {
"pvv-git git.pvv.ntnu.no" = {
hostname = "git.pvv.ntnu.no";
user = "gitea";
addressFamily = "inet";
port = 2222;
proxyJump = "pvv";
};
};
{
"pvv-git git.pvv.ntnu.no" = {
hostname = "git.pvv.ntnu.no";
user = "gitea";
addressFamily = "inet";
port = 2222;
proxyJump = "pvv";
};
}
];
}

View File

@ -7,9 +7,6 @@ in rec {
mapToAttrsWithConst = constant: items:
listToAttrs (map (name: nameValuePair name constant) items);
# [AttrSet] -> AttrSet
concatAttrs = foldr (a: b: a // b) {};
# (Int -> String -> a -> a) -> AttrSet -> AttrSet
imap0Attrs = f: set:
listToAttrs (imap0 (i: attr: nameValuePair attr (f i attr set.${attr})) (attrNames set));