diff options
| -rw-r--r-- | kartei/tv/default.nix | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/kartei/tv/default.nix b/kartei/tv/default.nix index 52f66039f..60369d4df 100644 --- a/kartei/tv/default.nix +++ b/kartei/tv/default.nix @@ -1,8 +1,4 @@ { config, lib, ... }: let - inherit (builtins) - getAttr mapAttrs pathExists readDir readFile typeOf; - inherit (lib) - const hasAttrByPath mapAttrs' mkDefault optionalAttrs removeSuffix; slib = import ../../lib/pure.nix { inherit lib; }; extend = x: f: { @@ -14,13 +10,13 @@ in { "viljetic.de" = "regfish"; }; hosts = - mapAttrs + builtins.mapAttrs (hostName: lib.flip (builtins.foldl' extend) [ { name = hostName; owner = config.krebs.users.tv; } - (hostConfig: optionalAttrs (hasAttrByPath ["nets" "retiolum"] hostConfig) { + (hostConfig: lib.optionalAttrs (lib.hasAttrByPath ["nets" "retiolum"] hostConfig) { nets.retiolum = { ip6.addr = (slib.krebs.genipv6 "retiolum" "tv" { inherit hostName; }).address; @@ -28,31 +24,31 @@ in { }) (let pubkey-path = ./wiregrill + "/${hostName}.pub"; - in optionalAttrs (pathExists pubkey-path) { + in lib.optionalAttrs (builtins.pathExists pubkey-path) { nets.wiregrill = { aliases = [ "${hostName}.w" ]; ip6.addr = (slib.krebs.genipv6 "wiregrill" "tv" { inherit hostName; }).address; - wireguard.pubkey = readFile pubkey-path; + wireguard.pubkey = builtins.readFile pubkey-path; }; }) (hostConfig: lib.optionalAttrs (hostConfig.ssh.pubkey or null != null) { - ssh.privkey = builtins.mapAttrs (const mkDefault) rec { + ssh.privkey = builtins.mapAttrs (lib.const lib.mkDefault) rec { path = "${config.krebs.secret.directory}/ssh.id_${type}"; type = builtins.head (lib.toList (builtins.match "ssh-([^ ]+) .*" hostConfig.ssh.pubkey)); }; }) ]) - (mapAttrs' + (lib.mapAttrs' (name: type: { - name = removeSuffix ".nix" name; + name = lib.removeSuffix ".nix" name; value = lib.toFunction (import (./hosts + "/${name}")) { inherit config lib slib; }; }) - (readDir ./hosts)); + (builtins.readDir ./hosts)); sitemap = { "http://cgit.krebsco.de" = { desc = "Git repositories"; @@ -69,21 +65,21 @@ in { }; mv-ni = { mail = "mv@ni.r"; - pubkey = readFile (./ssh + "/mv@vod.id_ed25519.pub"); + pubkey = builtins.readFile (./ssh + "/mv@vod.id_ed25519.pub"); }; tv = { mail = "tv@nomic.r"; - pgp.pubkeys.default = readFile ./pgp/CBF89B0B.asc; - pubkey = readFile (./ssh + "/tv@wu.id_rsa.pub"); + pgp.pubkeys.default = builtins.readFile ./pgp/CBF89B0B.asc; + pubkey = builtins.readFile (./ssh + "/tv@wu.id_rsa.pub"); uid = 1337; # TODO use default and document what has to be done (for vv) }; tv-nomic = { inherit (config.krebs.users.tv) mail; - pubkey = readFile (./ssh + "/tv@nomic.id_rsa.pub"); + pubkey = builtins.readFile (./ssh + "/tv@nomic.id_rsa.pub"); }; tv-xu = { inherit (config.krebs.users.tv) mail; - pubkey = readFile (./ssh + "/tv@xu.id_rsa.pub"); + pubkey = builtins.readFile (./ssh + "/tv@xu.id_rsa.pub"); }; vv = { mail = "vv@mu.r"; |
