summary refs log tree commit diff
path: root/pkgs/os-specific/linux/kernel/common-config.nix
diff options
context:
space:
mode:
authorMatthieu Coudron <mattator@gmail.com>2018-10-03 18:53:23 +0900
committerMatthieu Coudron <mattator@gmail.com>2019-01-28 09:07:24 +0900
commit7aacbdb8986f0d75c3770e70a39147c272e1eac8 (patch)
tree4c4e5722f3d16aa0b11644f9da480b0dfccd48e0 /pkgs/os-specific/linux/kernel/common-config.nix
parent3bb7b3f02e884db944a8a20b4f19227482479b94 (diff)
downloadnixpkgs-7aacbdb8986f0d75c3770e70a39147c272e1eac8.tar
nixpkgs-7aacbdb8986f0d75c3770e70a39147c272e1eac8.tar.gz
nixpkgs-7aacbdb8986f0d75c3770e70a39147c272e1eac8.tar.bz2
nixpkgs-7aacbdb8986f0d75c3770e70a39147c272e1eac8.tar.lz
nixpkgs-7aacbdb8986f0d75c3770e70a39147c272e1eac8.tar.xz
nixpkgs-7aacbdb8986f0d75c3770e70a39147c272e1eac8.tar.zst
nixpkgs-7aacbdb8986f0d75c3770e70a39147c272e1eac8.zip
linux: convert hardened-config to a structured one
Diffstat (limited to 'pkgs/os-specific/linux/kernel/common-config.nix')
-rw-r--r--pkgs/os-specific/linux/kernel/common-config.nix9
1 files changed, 2 insertions, 7 deletions
diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix
index bdcad8c2383..1a56e68fa4b 100644
--- a/pkgs/os-specific/linux/kernel/common-config.nix
+++ b/pkgs/os-specific/linux/kernel/common-config.nix
@@ -17,14 +17,9 @@
 
 with stdenv.lib;
 
-  with import ../../../../lib/kernel.nix { inherit (stdenv) lib; };
+  with import ../../../../lib/kernel.nix { inherit (stdenv) lib; inherit version; };
 
 let
-  # Common patterns/legacy
-  when = cond: opt: if cond then opt else null;
-  whenAtLeast = ver: mkIf (versionAtLeast version ver);
-  whenOlder   = ver: mkIf (versionOlder version ver);
-  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));
@@ -420,7 +415,7 @@ let
       KVM_COMPAT = { optional = true; tristate = whenBetween "4.0" "4.12" "y"; };
       KVM_DEVICE_ASSIGNMENT  = { optional = true; tristate = whenBetween "3.10" "4.12" "y"; };
       KVM_GENERIC_DIRTYLOG_READ_PROTECT = whenAtLeast "4.0"  yes;
-      KVM_GUEST                         = when (!features.grsecurity) yes;
+      KVM_GUEST                         = mkIf (!features.grsecurity) yes;
       KVM_MMIO                          = yes;
       KVM_VFIO                          = yes;
       KSM = yes;