2020-04-24 23:36:52 +00:00
|
|
|
{ lib }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
# Keeping these around in case we decide to change this horrible implementation :)
|
|
|
|
option = x:
|
|
|
|
x // { optional = true; };
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
yes = { tristate = "y"; optional = false; };
|
|
|
|
no = { tristate = "n"; optional = false; };
|
|
|
|
module = { tristate = "m"; optional = false; };
|
|
|
|
freeform = x: { freeform = x; optional = false; };
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
/*
|
2020-05-15 21:57:56 +00:00
|
|
|
Common patterns/legacy used in common-config/hardened/config.nix
|
2020-04-24 23:36:52 +00:00
|
|
|
*/
|
|
|
|
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);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|