diff options
author | lassulus <git@lassul.us> | 2023-06-10 12:50:53 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2023-06-21 14:47:04 +0200 |
commit | e174ef53caafbcee1e8a2ee83d6195f97afb9388 (patch) | |
tree | 630c6d61843c4a6df904327316f8c3a02a68dd3d /kartei/tv | |
parent | d59586939d9530ee55a4c5a3310ae13042127e09 (diff) |
flake: init
Diffstat (limited to 'kartei/tv')
-rw-r--r-- | kartei/tv/default.nix | 20 | ||||
-rw-r--r-- | kartei/tv/hosts/ni.nix | 6 |
2 files changed, 17 insertions, 9 deletions
diff --git a/kartei/tv/default.nix b/kartei/tv/default.nix index eacb40af3..2f23324cc 100644 --- a/kartei/tv/default.nix +++ b/kartei/tv/default.nix @@ -1,5 +1,11 @@ -with import ../../lib; -{ config, ... }: { +{ config, lib, ... }@attrs: let + inherit (builtins) + getAttr head mapAttrs match pathExists readDir readFile typeOf; + inherit (lib) + const hasAttrByPath mapAttrs' mkDefault mkIf optionalAttrs removeSuffix + toList; + slib = import ../../lib/pure.nix { inherit lib; }; +in { dns.providers = { "viljetic.de" = "regfish"; }; @@ -8,10 +14,10 @@ with import ../../lib; (hostName: hostFile: let hostSource = import hostFile; hostConfig = getAttr (typeOf hostSource) { - lambda = hostSource { inherit config lib; }; + lambda = hostSource attrs; set = hostSource; }; - in evalSubmodule types.host [ + in slib.evalSubmodule slib.types.host [ hostConfig { name = hostName; @@ -20,7 +26,7 @@ with import ../../lib; (optionalAttrs (hasAttrByPath ["nets" "retiolum"] hostConfig) { nets.retiolum = { ip6.addr = - (krebs.genipv6 "retiolum" "tv" { inherit hostName; }).address; + (slib.krebs.genipv6 "retiolum" "tv" { inherit hostName; }).address; }; }) (let @@ -31,14 +37,14 @@ with import ../../lib; "${hostName}.w" ]; ip6.addr = - (krebs.genipv6 "wiregrill" "tv" { inherit hostName; }).address; + (slib.krebs.genipv6 "wiregrill" "tv" { inherit hostName; }).address; wireguard.pubkey = readFile pubkey-path; }; }) (host: mkIf (host.config.ssh.pubkey != null) { ssh.privkey = mapAttrs (const mkDefault) { path = config.krebs.secret.file "ssh.id_${host.config.ssh.privkey.type}"; - type = head (toList (match "ssh-([^ ]+) .*" host.config.ssh.pubkey)); + type = head (toList (builtins.match "ssh-([^ ]+) .*" host.config.ssh.pubkey)); }; }) ]) diff --git a/kartei/tv/hosts/ni.nix b/kartei/tv/hosts/ni.nix index aae5c5cd4..d64874d9c 100644 --- a/kartei/tv/hosts/ni.nix +++ b/kartei/tv/hosts/ni.nix @@ -1,4 +1,6 @@ -{ config, lib, ... }: { +{ config, lib, ... }: let + slib = import ../../../lib/pure.nix { inherit lib; }; +in { extraZones = { "krebsco.de" = '' ni 60 IN A ${config.krebs.hosts.ni.nets.internet.ip4.addr} @@ -60,7 +62,7 @@ via = config.krebs.hosts.ni.nets.internet; ip4.addr = "10.244.3.1"; wireguard.subnets = [ - (lib.krebs.genipv6 "wiregrill" "tv" 0).subnetCIDR + (slib.krebs.genipv6 "wiregrill" "tv" 0).subnetCIDR ]; }; }; |