diff --git a/nixos/modules/services/networking/anubis.nix b/nixos/modules/services/networking/anubis.nix index d44619446b7c..968595d303d1 100644 --- a/nixos/modules/services/networking/anubis.nix +++ b/nixos/modules/services/networking/anubis.nix @@ -55,7 +55,7 @@ let type = types.str; }; - botPolicy = lib.mkOption { + botPolicy = mkDefaultOption "botPolicy" { default = null; description = '' Anubis policy configuration in Nix syntax. Set to `null` to use the baked-in policy which should be @@ -265,7 +265,18 @@ in wants = [ "network-online.target" ]; environment = lib.mapAttrs (lib.const (lib.generators.mkValueStringDefault { })) ( - lib.filterAttrs (_: v: v != null) instance.settings + lib.filterAttrs (_: v: v != null) ( + instance.settings + // { + POLICY_FNAME = + if instance.settings.POLICY_FNAME != null then + instance.settings.POLICY_FNAME + else if instance.botPolicy != null then + jsonFormat.generate "${instanceName name}-botPolicy.json" instance.botPolicy + else + null; + } + ) ); serviceConfig = {