blob: 19708ef5625a711f6f1e559f46361d13b808743b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
{ 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.1.0-rc3";
src = pkgs.fetchgit {
url = git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git;
rev = "4cfceaf0c087f47033f5e61a801f4136d6fb68c6";
sha256 = "0vp3984f3d8awwankngmj91r55klyhijk25y124jn2z24yv5mi7a";
};
};
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.
'';
};
};
config = mkIf cfg.enable {
boot = let
linuxVuizvui = pkgs.buildLinux {
inherit (mainlineKernel) version src;
kernelPatches = singleton pkgs.vuizvui.kernelPatches.bfqsched;
configfile = generateKConf cfg.config;
allowImportFromDerivation = true;
};
in rec {
kernelPackages = pkgs.recurseIntoAttrs
(pkgs.linuxPackagesFor linuxVuizvui kernelPackages);
};
};
}
|