From 1ca4daab9c644ab0a032ef7a2b75930423258d10 Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Sun, 28 Apr 2024 10:39:07 +0100 Subject: [PATCH] locations: move attrset into config block --- modules/locations.nix | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/modules/locations.nix b/modules/locations.nix index 46f02fc..50bbdcc 100644 --- a/modules/locations.nix +++ b/modules/locations.nix @@ -12,7 +12,12 @@ in locations = lib.mkOption { readOnly = true; - default = { + }; + }; + + config = lib.mkMerge [ + { + custom.locations.locations = { services = { authoritative_dns = [ "jorah.cx.ts.hillion.co.uk" @@ -29,17 +34,18 @@ in unifi = "jorah.cx.ts.hillion.co.uk"; }; }; - }; - }; + } - config = lib.mkIf cfg.autoServe { - custom.services = lib.mapAttrsRecursive - (path: value: { - enable = - if builtins.isList value - then builtins.elem config.networking.fqdn value - else config.networking.fqdn == value; + (lib.mkIf cfg.autoServe + { + custom.services = lib.mapAttrsRecursive + (path: value: { + enable = + if builtins.isList value + then builtins.elem config.networking.fqdn value + else config.networking.fqdn == value; + }) + cfg.locations.services; }) - cfg.locations.services; - }; + ]; }