nixos/sing-box: add assertions for deprecated geoip and geosite options

Nick Cao 45d60dfc 3a661055

Changed files
+21
nixos
modules
services
networking
+21
nixos/modules/services/networking/sing-box.nix
···
};
config = lib.mkIf cfg.enable {
+
assertions =
+
let
+
rules = cfg.settings.route.rules or [ ];
+
in
+
[
+
{
+
assertion = !lib.any (r: r ? source_geoip || r ? geoip) rules;
+
message = ''
+
Deprecated option `services.sing-box.settings.route.rules.*.{source_geoip,geoip}` is set.
+
See https://sing-box.sagernet.org/migration/#migrate-geoip-to-rule-sets for migration instructions.
+
'';
+
}
+
{
+
assertion = !lib.any (r: r ? geosite) rules;
+
message = ''
+
Deprecated option `services.sing-box.settings.route.rules.*.geosite` is set.
+
See https://sing-box.sagernet.org/migration/#migrate-geosite-to-rule-sets for migration instructions.
+
'';
+
}
+
];
+
systemd.packages = [ cfg.package ];
systemd.services.sing-box = {