nixos/anubis: add missing botPolicy option implementation
This commit is contained in:
@@ -55,7 +55,7 @@ let
|
|||||||
type = types.str;
|
type = types.str;
|
||||||
};
|
};
|
||||||
|
|
||||||
botPolicy = lib.mkOption {
|
botPolicy = mkDefaultOption "botPolicy" {
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Anubis policy configuration in Nix syntax. Set to `null` to use the baked-in policy which should be
|
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" ];
|
wants = [ "network-online.target" ];
|
||||||
|
|
||||||
environment = lib.mapAttrs (lib.const (lib.generators.mkValueStringDefault { })) (
|
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 = {
|
serviceConfig = {
|
||||||
|
|||||||
Reference in New Issue
Block a user