summaryrefslogtreecommitdiffstats
path: root/kartei/tv
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2022-12-29 17:33:07 +0100
committertv <tv@krebsco.de>2022-12-29 17:35:32 +0100
commit9cb022698e629c59e984c10e9cd7e123eab1fbda (patch)
tree908606ba6100f9404efea3eda99a0a51696e6ce1 /kartei/tv
parentcda9bcfaffcb52544851e13eb1efad26d6effddd (diff)
kartei tv: move around hostFiles & co.
Diffstat (limited to 'kartei/tv')
-rw-r--r--kartei/tv/default.nix84
1 files changed, 38 insertions, 46 deletions
diff --git a/kartei/tv/default.nix b/kartei/tv/default.nix
index c43c7cbaa..eacb40af3 100644
--- a/kartei/tv/default.nix
+++ b/kartei/tv/default.nix
@@ -1,47 +1,5 @@
with import ../../lib;
-{ config, ... }: let
-
- evalHost = hostName: hostConfig: evalSubmodule types.host [
- hostConfig
- {
- name = hostName;
- owner = config.krebs.users.tv;
- }
- (optionalAttrs (hasAttrByPath ["nets" "retiolum"] hostConfig) {
- nets.retiolum = {
- ip6.addr =
- (krebs.genipv6 "retiolum" "tv" { inherit hostName; }).address;
- };
- })
- (let
- pubkey-path = ./wiregrill + "/${hostName}.pub";
- in optionalAttrs (pathExists pubkey-path) {
- nets.wiregrill = {
- aliases = [
- "${hostName}.w"
- ];
- ip6.addr =
- (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));
- };
- })
- ];
-
- hostFiles =
- mapAttrs'
- (name: type: {
- name = removeSuffix ".nix" name;
- value = ./hosts + "/${name}";
- })
- (readDir ./hosts);
-
-in {
+{ config, ... }: {
dns.providers = {
"viljetic.de" = "regfish";
};
@@ -53,9 +11,43 @@ in {
lambda = hostSource { inherit config lib; };
set = hostSource;
};
- in
- evalHost hostName hostConfig)
- hostFiles;
+ in evalSubmodule types.host [
+ hostConfig
+ {
+ name = hostName;
+ owner = config.krebs.users.tv;
+ }
+ (optionalAttrs (hasAttrByPath ["nets" "retiolum"] hostConfig) {
+ nets.retiolum = {
+ ip6.addr =
+ (krebs.genipv6 "retiolum" "tv" { inherit hostName; }).address;
+ };
+ })
+ (let
+ pubkey-path = ./wiregrill + "/${hostName}.pub";
+ in optionalAttrs (pathExists pubkey-path) {
+ nets.wiregrill = {
+ aliases = [
+ "${hostName}.w"
+ ];
+ ip6.addr =
+ (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));
+ };
+ })
+ ])
+ (mapAttrs'
+ (name: type: {
+ name = removeSuffix ".nix" name;
+ value = ./hosts + "/${name}";
+ })
+ (readDir ./hosts));
sitemap = {
"http://cgit.krebsco.de" = {
desc = "Git repositories";