blob: 7634306269fa2ebd4448069adb98193de58e200c (
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 = "110bc76729d448fdbcb5cdb63b83d9fd65ce5e26";
sha256 = "1x22gf70bd64a5fsnykd547gxrsaf5mdf7ww9b55kpfar851wqld";
};
};
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);
};
};
}
|