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

This commit is contained in:
Nick Cao
2025-02-01 09:23:52 -05:00
parent 3a661055bb
commit 45d60dfce5
@@ -38,6 +38,27 @@ in
};
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 = {