lib.darwin: simplify assertInterval

This commit is contained in:
Benedikt Rips
2026-01-05 23:03:28 +01:00
committed by Robert Helgesson
parent af7f14ddf7
commit d1da1de5c2
4 changed files with 6 additions and 6 deletions

View File

@@ -63,12 +63,12 @@ let
intervalsString = lib.concatStringsSep ", " intervals; intervalsString = lib.concatStringsSep ", " intervals;
assertInterval = option: interval: pkgs: { assertInterval = option: interval: pkgs: {
assertion = (!pkgs.stdenv.isDarwin) || (lib.elem interval intervals); assertion = pkgs.stdenv.isDarwin -> lib.elem interval intervals;
message = "On Darwin ${option} must be one of: ${intervalsString}."; message = "On Darwin, ${option} must be one of: ${intervalsString}.";
}; };
intervalDocumentation = '' intervalDocumentation = ''
On Darwin it must be one of: ${intervalsString}, which are implemented as defined in {manpage}`systemd.time(7)`. On Darwin, it must be one of: ${intervalsString}, which are implemented as defined in {manpage}`systemd.time(7)`.
''; '';
in in
{ {

View File

@@ -5,6 +5,6 @@
}; };
test.asserts.assertions.expected = [ test.asserts.assertions.expected = [
"On Darwin services.borgmatic.frequency must be one of: hourly, daily, weekly, monthly, semiannually, annually." "On Darwin, services.borgmatic.frequency must be one of: hourly, daily, weekly, monthly, semiannually, annually."
]; ];
} }

View File

@@ -5,6 +5,6 @@
}; };
test.asserts.assertions.expected = [ test.asserts.assertions.expected = [
"On Darwin services.home-manager.autoExpire.frequency must be one of: hourly, daily, weekly, monthly, semiannually, annually." "On Darwin, services.home-manager.autoExpire.frequency must be one of: hourly, daily, weekly, monthly, semiannually, annually."
]; ];
} }

View File

@@ -5,6 +5,6 @@
}; };
test.asserts.assertions.expected = [ test.asserts.assertions.expected = [
"On Darwin nix.gc.dates.* must be one of: hourly, daily, weekly, monthly, semiannually, annually." "On Darwin, nix.gc.dates.* must be one of: hourly, daily, weekly, monthly, semiannually, annually."
]; ];
} }