about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2016-11-28 10:41:28 +0100
committeraszlig <aszlig@redmoonstudios.org>2016-11-28 10:41:28 +0100
commit55f9c333077c4caa7e2d6aa3a4f8b59a8a71c78e (patch)
treedefa701689ff150c97be3d89e5e84481abe5890f /modules
parent05bd996d0938acc99ae5a2f58308d2bc140a0790 (diff)
dnyarri/mmrnmhrm: Switch to generic kernel
I've been patching these machines up since ages and I'm tired now to do
both kernel configs *again* for the recent kernel versions.

Of course, in the long run I still want them to have their customized
kernel, but right now it's better to have a recent generic kernel rather
than have a fucked up custom kernel.

Also, this removes all that cruft for the Intel HDA pinning on dnyarri,
because the machine now has two X-Fi sound cards.

Both machines probably won't boot now, so we'll have to adjust a few
things very soon.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'modules')
-rw-r--r--modules/user/aszlig/system/kernel.nix63
1 files changed, 20 insertions, 43 deletions
diff --git a/modules/user/aszlig/system/kernel.nix b/modules/user/aszlig/system/kernel.nix
index 860dcc57..b3d0d0ea 100644
--- a/modules/user/aszlig/system/kernel.nix
+++ b/modules/user/aszlig/system/kernel.nix
@@ -1,52 +1,29 @@
 { config, pkgs, lib, ... }:
 
-with lib;
-
-let
-  cfg = config.vuizvui.user.aszlig.system.kernel;
-
-  generateKConf = exprs: let
-    isNumber = c: elem c ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9"];
-    mkValue = val:
-      if val == "" then "\"\""
-      else if val == "y" || val == "m" || val == "n" then val
-      else if all isNumber (stringToCharacters val) then val
-      else if substring 0 2 val == "0x" then val
-      else "\"${val}\"";
-    mkConfigLine = key: val: "${key}=${mkValue val}";
-    mkConf = cfg: concatStringsSep "\n" (mapAttrsToList mkConfigLine cfg);
-  in pkgs.writeText "generated.kconf" (mkConf exprs + "\n");
-
-  mainlineKernel = {
-    version = "4.7.0-rc7";
-    src = pkgs.fetchgit {
-      url = git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git;
-      rev = "47ef4ad2684d380dd6d596140fb79395115c3950";
-      sha256 = "15b6fqfwyi3lh13qa7hz7x9za6r32cdaiww6labqn229vp8362ys";
-    };
-  };
-
-in {
+{
   options.vuizvui.user.aszlig.system.kernel = {
-    enable = mkEnableOption "aszlig's custom kernel";
-
-    config = mkOption {
-      type = types.attrsOf types.unspecified;
-      default = {};
-      description = ''
-        An attribute set of configuration options to use
-        for building a custom kernel.
-      '';
-    };
+    enable = lib.mkEnableOption "aszlig's custom kernel";
   };
 
-  config = mkIf cfg.enable {
+  config = lib.mkIf config.vuizvui.user.aszlig.system.kernel.enable {
     boot = {
-      kernelPatches = singleton pkgs.vuizvui.kernel.bfqsched;
-      kernelPackages = pkgs.linuxPackages_custom {
-        inherit (mainlineKernel) version src;
-        configfile = generateKConf cfg.config;
-      };
+      kernelPatches = lib.singleton (pkgs.vuizvui.kernel.bfqsched // {
+        extraConfig = (pkgs.vuizvui.kernel.bfqsched.extraConfig or "") + ''
+          IOSCHED_BFQ y
+          DEFAULT_BFQ y
+          DEFAULT_CFQ n
+          DEFAULT_IOSCHED bfq
+        '';
+      });
+
+      kernelPackages = let
+        inherit (lib) take splitString replaceStrings;
+        inherit (pkgs) linux_latest linux_testing;
+        dotizeVer = replaceStrings ["-"] ["."];
+        trimVer = ver: take 2 (splitString "." (dotizeVer ver));
+        tooOld = trimVer linux_latest.version == trimVer linux_testing.version;
+        kernel = if tooOld then linux_latest else linux_testing;
+      in pkgs.linuxPackagesFor kernel;
     };
   };
 }