From 55f9c333077c4caa7e2d6aa3a4f8b59a8a71c78e Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 28 Nov 2016 10:41:28 +0100 Subject: 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 --- modules/user/aszlig/system/kernel.nix | 63 +++++++++++------------------------ 1 file changed, 20 insertions(+), 43 deletions(-) (limited to 'modules') 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; }; }; } -- cgit 1.4.1