mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-14 05:37:40 +03:00
12e08bd339
Previously, there was no way to unset an option when overriding a kernel, apart from writing out the attrset yourself. Now it's possible with lib.mkForce lib.kernel.unset. It's important to be able to do this, because setting an option in the override may cause other options to become unused, which would fail the config build unless they were overridden too.
28 lines
807 B
Nix
28 lines
807 B
Nix
{ lib }:
|
|
|
|
with lib;
|
|
{
|
|
|
|
|
|
# Keeping these around in case we decide to change this horrible implementation :)
|
|
option = x:
|
|
x // { optional = true; };
|
|
|
|
yes = { tristate = "y"; optional = false; };
|
|
no = { tristate = "n"; optional = false; };
|
|
module = { tristate = "m"; optional = false; };
|
|
unset = { tristate = null; optional = false; };
|
|
freeform = x: { freeform = x; optional = false; };
|
|
|
|
/*
|
|
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);
|
|
};
|
|
|
|
}
|