forked from mirrors/nixpkgs
lib.kernel: scoped whenXXX helpers
whenAtLeast/whenBetween are made available in lib/kernel.nix but are now scoped under whenXXX.
This commit is contained in:
parent
afa0e02d64
commit
a4fe469d39
|
@ -13,4 +13,14 @@ with lib;
|
|||
module = { tristate = "m"; };
|
||||
freeform = x: { freeform = x; };
|
||||
|
||||
/*
|
||||
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);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -17,13 +17,9 @@
|
|||
|
||||
with stdenv.lib;
|
||||
with stdenv.lib.kernel;
|
||||
with (stdenv.lib.kernel.whenHelpers version);
|
||||
|
||||
let
|
||||
# Common patterns/legacy
|
||||
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);
|
||||
|
||||
|
||||
# configuration items have to be part of a subattrs
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
with stdenv.lib;
|
||||
with stdenv.lib.kernel;
|
||||
with (stdenv.lib.kernel.whenHelpers version);
|
||||
|
||||
assert (versionAtLeast version "4.9");
|
||||
|
||||
optionalAttrs (stdenv.hostPlatform.platform.kernelArch == "x86_64") {
|
||||
|
|
Loading…
Reference in a new issue