2019-09-18 09:34:02 +01:00
|
|
|
{ lib }:
|
2016-01-05 14:22:43 +00:00
|
|
|
|
|
|
|
with lib;
|
2019-08-13 22:52:01 +01:00
|
|
|
{
|
2016-01-05 14:22:43 +00:00
|
|
|
|
|
|
|
|
2018-10-03 10:49:50 +01:00
|
|
|
# Keeping these around in case we decide to change this horrible implementation :)
|
|
|
|
option = x:
|
|
|
|
x // { optional = true; };
|
2016-01-05 14:22:43 +00:00
|
|
|
|
2018-10-03 10:49:50 +01:00
|
|
|
yes = { tristate = "y"; };
|
|
|
|
no = { tristate = "n"; };
|
|
|
|
module = { tristate = "m"; };
|
|
|
|
freeform = x: { freeform = x; };
|
2016-01-05 14:22:43 +00:00
|
|
|
|
2019-09-19 12:12:35 +01:00
|
|
|
/*
|
|
|
|
Common patterns/legacy used in common-config/hardened-config.nix
|
|
|
|
*/
|
|
|
|
whenHelpers = version: {
|
|
|
|
whenAtLeast = ver: mkIf (versionAtLeast version ver);
|
|
|
|
whenOlder = ver: mkIf (versionOlder version ver);
|
|
|
|
# range is (inclusive, exclusive)
|
|
|
|
whenBetween = verLow: verHigh: mkIf (versionAtLeast version verLow && versionOlder version verHigh);
|
|
|
|
};
|
|
|
|
|
2016-01-05 14:22:43 +00:00
|
|
|
}
|