From c084136980f9a29f5b42b32731b6dbe22b3366dc Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 23 Nov 2022 16:37:32 +0100 Subject: krebs: extract users into separate module --- krebs/3modules/default.nix | 17 +---------------- krebs/3modules/users.nix | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 krebs/3modules/users.nix (limited to 'krebs') diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index 70fc05813..6c76b48e3 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -56,6 +56,7 @@ let ./tinc_graphs.nix ./upstream ./urlwatch.nix + ./users.nix ./xresources.nix ./zones.nix ]; @@ -66,10 +67,6 @@ let api = { enable = mkEnableOption "krebs"; - users = mkOption { - type = with types; attrsOf user; - }; - sitemap = mkOption { default = {}; type = types.attrsOf types.sitemap.entry; @@ -112,18 +109,6 @@ let krebs.dns.search-domain = mkDefault "r"; - krebs.users = { - krebs = { - home = "/krebs"; - mail = "spam@krebsco.de"; - }; - root = { - home = "/root"; - pubkey = config.krebs.build.host.ssh.pubkey; - uid = 0; - }; - }; - services.openssh.hostKeys = let inherit (config.krebs.build.host.ssh) privkey; in mkIf (privkey != null) [privkey]; diff --git a/krebs/3modules/users.nix b/krebs/3modules/users.nix new file mode 100644 index 000000000..c1ad4b44b --- /dev/null +++ b/krebs/3modules/users.nix @@ -0,0 +1,20 @@ +{ config, ... }: let + lib = import ../../lib; +in { + options.krebs.users = lib.mkOption { + type = with lib.types; attrsOf user; + }; + config = lib.mkIf config.krebs.enable { + krebs.users = { + krebs = { + home = "/krebs"; + mail = "spam@krebsco.de"; + }; + root = { + home = "/root"; + pubkey = config.krebs.build.host.ssh.pubkey; + uid = 0; + }; + }; + }; +} -- cgit v1.2.3 From 7b4ea4750ea11e2c4d9f95cc09fbcffe32e66064 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 23 Nov 2022 16:40:21 +0100 Subject: krebs hosts: config only if config.krebs.enable --- krebs/3modules/hosts.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs') diff --git a/krebs/3modules/hosts.nix b/krebs/3modules/hosts.nix index ae0136303..bd1bb1652 100644 --- a/krebs/3modules/hosts.nix +++ b/krebs/3modules/hosts.nix @@ -11,7 +11,7 @@ in { }; }; - config = { + config = mkIf config.krebs.enable { networking.hosts = filterAttrs (_name: value: value != []) -- cgit v1.2.3 From 6af959ad44a85b1f89ce347480bf18a46a039571 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 23 Nov 2022 16:43:02 +0100 Subject: krebs: extract sitemap into separate module --- krebs/3modules/default.nix | 6 +----- krebs/3modules/sitemap.nix | 8 ++++++++ 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 krebs/3modules/sitemap.nix (limited to 'krebs') diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index 6c76b48e3..a8cf6c767 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -49,6 +49,7 @@ let ./secret.nix ./setuid.nix ./shadow.nix + ./sitemap.nix ./ssl.nix ./sync-containers.nix ./systemd.nix @@ -67,11 +68,6 @@ let api = { enable = mkEnableOption "krebs"; - sitemap = mkOption { - default = {}; - type = types.attrsOf types.sitemap.entry; - }; - zone-head-config = mkOption { type = with types; attrsOf str; description = '' diff --git a/krebs/3modules/sitemap.nix b/krebs/3modules/sitemap.nix new file mode 100644 index 000000000..ec2179db1 --- /dev/null +++ b/krebs/3modules/sitemap.nix @@ -0,0 +1,8 @@ +let + lib = import ../../lib; +in { + options.krebs.sitemap = lib.mkOption { + type = with lib.types; attrsOf sitemap.entry; + default = {}; + }; +} -- cgit v1.2.3 From a278a6503bf1c8de8e233f72faa442baaab29ab0 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 23 Nov 2022 16:49:41 +0100 Subject: krebs dns: move config to dns module --- krebs/3modules/default.nix | 10 ---------- krebs/3modules/dns.nix | 13 +++++++++++-- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'krebs') diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index a8cf6c767..e8f5d1611 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -95,16 +95,6 @@ let imp = lib.mkMerge [ { - krebs.dns.providers = { - "krebsco.de" = "zones"; - shack = "hosts"; - i = "hosts"; - r = "hosts"; - w = "hosts"; - }; - - krebs.dns.search-domain = mkDefault "r"; - services.openssh.hostKeys = let inherit (config.krebs.build.host.ssh) privkey; in mkIf (privkey != null) [privkey]; diff --git a/krebs/3modules/dns.nix b/krebs/3modules/dns.nix index 8acc4ccd8..8a74d3067 100644 --- a/krebs/3modules/dns.nix +++ b/krebs/3modules/dns.nix @@ -1,12 +1,21 @@ with import ; -{ +{ config, ... }: { options = { krebs.dns.providers = mkOption { type = types.attrsOf types.str; }; - krebs.dns.search-domain = mkOption { type = types.nullOr types.hostname; }; }; + config = mkIf config.krebs.enable { + krebs.dns.providers = { + "krebsco.de" = "zones"; + shack = "hosts"; + i = "hosts"; + r = "hosts"; + w = "hosts"; + }; + krebs.dns.search-domain = mkDefault "r"; + }; } -- cgit v1.2.3