diff options
author | Matthieu Coudron <mattator@gmail.com> | 2019-09-19 20:12:35 +0900 |
---|---|---|
committer | Matthieu Coudron <mattator@gmail.com> | 2019-10-01 16:09:07 +0900 |
commit | a4fe469d39bdb9a91f9f6c8bbbac15fd836b66ce (patch) | |
tree | bc2ce5e42b3d5267d53f9cfa3da365bf2612e00a /lib | |
parent | afa0e02d64b15707262f13a348b33dad735bd80f (diff) |
lib.kernel: scoped whenXXX helpers
whenAtLeast/whenBetween are made available in lib/kernel.nix but are now scoped under whenXXX.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kernel.nix | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/kernel.nix b/lib/kernel.nix index bfadf148be256..2ce19f8cb68c0 100644 --- a/lib/kernel.nix +++ b/lib/kernel.nix @@ -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); + }; + } |