4 inherit (lib) mkIf versionAtLeast versionOlder;
9 # Keeping these around in case we decide to change this horrible implementation :)
11 x // { optional = true; };
13 yes = { tristate = "y"; optional = false; };
14 no = { tristate = "n"; optional = false; };
15 module = { tristate = "m"; optional = false; };
16 unset = { tristate = null; optional = false; };
17 freeform = x: { freeform = x; optional = false; };
20 # Common patterns/legacy used in common-config/hardened/config.nix
21 whenHelpers = version: {
22 whenAtLeast = ver: mkIf (versionAtLeast version ver);
23 whenOlder = ver: mkIf (versionOlder version ver);
24 # range is (inclusive, exclusive)
25 whenBetween = verLow: verHigh: mkIf (versionAtLeast version verLow && versionOlder version verHigh);