summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2025-11-27 13:46:36 +0100
committertv <tv@krebsco.de>2025-11-27 13:46:36 +0100
commit3c1e960b371215ed7653e9f7e0b9aca2a3b7058d (patch)
treec591a2c79b44c4d84788d8f0181eef3a48497760
parent6dcc80fc091904d7efc0f1085441a0d8975f6f5a (diff)
kartei tv: foldl' recursiveUpdate {} -> foldl' extend
-rw-r--r--kartei/tv/default.nix12
1 files changed, 8 insertions, 4 deletions
diff --git a/kartei/tv/default.nix b/kartei/tv/default.nix
index 3dbaf3389..52f66039f 100644
--- a/kartei/tv/default.nix
+++ b/kartei/tv/default.nix
@@ -4,19 +4,23 @@
inherit (lib)
const hasAttrByPath mapAttrs' mkDefault optionalAttrs removeSuffix;
slib = import ../../lib/pure.nix { inherit lib; };
+
+ extend = x: f: {
+ lambda = lib.recursiveUpdate x (f x);
+ set = lib.recursiveUpdate x f;
+ }.${builtins.typeOf f};
in {
dns.providers = {
"viljetic.de" = "regfish";
};
hosts =
mapAttrs
- (hostName: hostConfig: builtins.foldl' lib.recursiveUpdate {} [
- hostConfig
+ (hostName: lib.flip (builtins.foldl' extend) [
{
name = hostName;
owner = config.krebs.users.tv;
}
- (optionalAttrs (hasAttrByPath ["nets" "retiolum"] hostConfig) {
+ (hostConfig: optionalAttrs (hasAttrByPath ["nets" "retiolum"] hostConfig) {
nets.retiolum = {
ip6.addr =
(slib.krebs.genipv6 "retiolum" "tv" { inherit hostName; }).address;
@@ -34,7 +38,7 @@ in {
wireguard.pubkey = readFile pubkey-path;
};
})
- (lib.optionalAttrs (hostConfig.ssh.pubkey or null != null) {
+ (hostConfig: lib.optionalAttrs (hostConfig.ssh.pubkey or null != null) {
ssh.privkey = builtins.mapAttrs (const mkDefault) rec {
path = "${config.krebs.secret.directory}/ssh.id_${type}";
type = builtins.head (lib.toList (builtins.match "ssh-([^ ]+) .*" hostConfig.ssh.pubkey));