summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorMatthieu Coudron <mattator@gmail.com>2019-09-18 17:34:02 +0900
committerMatthieu Coudron <mattator@gmail.com>2019-10-01 15:57:14 +0900
commitafa0e02d64b15707262f13a348b33dad735bd80f (patch)
tree55d7b968cd62ee20069cb935f7fc9f3567629a77 /pkgs/os-specific
parent2436c27541b2f52deea3a4c1691216a02152e729 (diff)
downloadnixpkgs-afa0e02d64b15707262f13a348b33dad735bd80f.tar
nixpkgs-afa0e02d64b15707262f13a348b33dad735bd80f.tar.gz
nixpkgs-afa0e02d64b15707262f13a348b33dad735bd80f.tar.bz2
nixpkgs-afa0e02d64b15707262f13a348b33dad735bd80f.tar.lz
nixpkgs-afa0e02d64b15707262f13a348b33dad735bd80f.tar.xz
nixpkgs-afa0e02d64b15707262f13a348b33dad735bd80f.tar.zst
nixpkgs-afa0e02d64b15707262f13a348b33dad735bd80f.zip
lib.kernel: make public
Remove the "version" parameter in order to make it more widely
available.
Starts making some kernel configuration helpers available.
The intent is to be able to better build and check the linux kernel
configuration.
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/linux/kernel/common-config.nix9
-rw-r--r--pkgs/os-specific/linux/kernel/hardened-config.nix3
-rw-r--r--pkgs/os-specific/linux/kernel/mptcp-config.nix2
3 files changed, 9 insertions, 5 deletions
diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix
index 3b409f15aba..d414a084262 100644
--- a/pkgs/os-specific/linux/kernel/common-config.nix
+++ b/pkgs/os-specific/linux/kernel/common-config.nix
@@ -16,10 +16,15 @@
 }:
 
 with stdenv.lib;
-
-  with import ../../../../lib/kernel.nix { inherit (stdenv) lib; inherit version; };
+with stdenv.lib.kernel;
 
 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
   flattenKConf =  nested: mapAttrs (_: head) (zipAttrs (attrValues nested));
diff --git a/pkgs/os-specific/linux/kernel/hardened-config.nix b/pkgs/os-specific/linux/kernel/hardened-config.nix
index 156a4cf4423..b72994d6dd6 100644
--- a/pkgs/os-specific/linux/kernel/hardened-config.nix
+++ b/pkgs/os-specific/linux/kernel/hardened-config.nix
@@ -11,8 +11,7 @@
 { stdenv, version }:
 
 with stdenv.lib;
-with import ../../../../lib/kernel.nix { inherit (stdenv) lib; inherit version; };
-
+with stdenv.lib.kernel;
 assert (versionAtLeast version "4.9");
 
 optionalAttrs (stdenv.hostPlatform.platform.kernelArch == "x86_64") {
diff --git a/pkgs/os-specific/linux/kernel/mptcp-config.nix b/pkgs/os-specific/linux/kernel/mptcp-config.nix
index e5e3ee283ff..9752e63d9f9 100644
--- a/pkgs/os-specific/linux/kernel/mptcp-config.nix
+++ b/pkgs/os-specific/linux/kernel/mptcp-config.nix
@@ -1,5 +1,5 @@
 { stdenv }:
-with import ../../../../lib/kernel.nix { inherit (stdenv) lib; version = null; };
+with stdenv.lib.kernel;
 {
     # DRM_AMDGPU = yes;