Loading nixos/lib/systemd-lib.nix +15 −0 Original line number Diff line number Diff line Loading @@ -278,6 +278,21 @@ rec { attr ? ${name} && !(hasPrefix "@" attr.${name}) ) "Systemd ${group} field `${name}' is not a systemd credential"; assertRouteMetricOrTriple = name: group: attr: let isMetric = n: 0 <= n && 4294967295 >= n; parts = splitString ":" attr.${name}; partsValid = length parts == 3 && all (p: (match "[0-9]+" p) != null && isMetric (toIntBase10 p)) parts; valid = (isInt attr.${name} && isMetric attr.${name}) || partsValid; in optional (attr ? ${name} && !valid) ( "Systemd ${group} field `${name}' must either be an integer in the range [0,4294967295]" + " or a string containing three integers separated with `:`" ); checkUnitConfig = group: checks: attrs: let Loading nixos/modules/system/boot/networkd.nix +1 −2 Original line number Diff line number Diff line Loading @@ -1744,8 +1744,7 @@ let (assertValueOneOf "UseDNR" boolValues) (assertValueOneOf "UseDomains" (boolValues ++ [ "route" ])) (assertRange "RouteTable" 0 4294967295) (assertInt "RouteMetric") (assertRange "RouteMetric" 0 4294967295) (assertRouteMetricOrTriple "RouteMetric") (assertValueOneOf "QuickAck" boolValues) (assertValueOneOf "UseMTU" boolValues) (assertValueOneOf "UseHopLimit" boolValues) Loading Loading
nixos/lib/systemd-lib.nix +15 −0 Original line number Diff line number Diff line Loading @@ -278,6 +278,21 @@ rec { attr ? ${name} && !(hasPrefix "@" attr.${name}) ) "Systemd ${group} field `${name}' is not a systemd credential"; assertRouteMetricOrTriple = name: group: attr: let isMetric = n: 0 <= n && 4294967295 >= n; parts = splitString ":" attr.${name}; partsValid = length parts == 3 && all (p: (match "[0-9]+" p) != null && isMetric (toIntBase10 p)) parts; valid = (isInt attr.${name} && isMetric attr.${name}) || partsValid; in optional (attr ? ${name} && !valid) ( "Systemd ${group} field `${name}' must either be an integer in the range [0,4294967295]" + " or a string containing three integers separated with `:`" ); checkUnitConfig = group: checks: attrs: let Loading
nixos/modules/system/boot/networkd.nix +1 −2 Original line number Diff line number Diff line Loading @@ -1744,8 +1744,7 @@ let (assertValueOneOf "UseDNR" boolValues) (assertValueOneOf "UseDomains" (boolValues ++ [ "route" ])) (assertRange "RouteTable" 0 4294967295) (assertInt "RouteMetric") (assertRange "RouteMetric" 0 4294967295) (assertRouteMetricOrTriple "RouteMetric") (assertValueOneOf "QuickAck" boolValues) (assertValueOneOf "UseMTU" boolValues) (assertValueOneOf "UseHopLimit" boolValues) Loading