diff options
author | Silvan Mosberger <contact@infinisil.com> | 2020-03-12 23:53:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-12 23:53:42 +0100 |
commit | eff447b32175669bb574fcfe4b9505b3f098f563 (patch) | |
tree | ce0094116b9a4486e58400671a92f3b4214dbee2 /lib | |
parent | ce78f3ac701017008aa7f1db387b871b7ae65e01 (diff) | |
parent | a4fe469d39bdb9a91f9f6c8bbbac15fd836b66ce (diff) |
Merge pull request #70157 from teto/lib_kernel
Add lib.kernel
Diffstat (limited to 'lib')
-rw-r--r-- | lib/default.nix | 3 | ||||
-rw-r--r-- | lib/kernel.nix | 17 |
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/default.nix b/lib/default.nix index 4971e68ebd3a..a909cefd60f1 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -56,6 +56,9 @@ let # back-compat aliases platforms = systems.doubles; + # linux kernel configuration + kernel = callLibs ./kernel.nix; + inherit (builtins) add addErrorContext attrNames concatLists deepSeq elem elemAt filter genericClosure genList getAttr hasAttr head isAttrs isBool isInt isList isString length diff --git a/lib/kernel.nix b/lib/kernel.nix index 36ea30838289..2ce19f8cb68c 100644 --- a/lib/kernel.nix +++ b/lib/kernel.nix @@ -1,12 +1,7 @@ -{ lib, version }: +{ lib }: with lib; { - # 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); # Keeping these around in case we decide to change this horrible implementation :) @@ -18,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); + }; + } |