Skip to content

Commit

Permalink
linuxPackages: properly propagate features and extraConfig
Browse files Browse the repository at this point in the history
`kernel.override { features = ... }` didn't work before, now it works as
expected.
  • Loading branch information
oxij authored and joachifm committed Sep 17, 2017
1 parent 64bf283 commit 8525b78
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 64 deletions.
32 changes: 21 additions & 11 deletions pkgs/os-specific/linux/kernel/generic.nix
Expand Up @@ -36,6 +36,22 @@ let

lib = stdenv.lib;

# Combine the `features' attribute sets of all the kernel patches.
kernelFeatures = lib.fold (x: y: (x.features or {}) // y) ({
iwlwifi = true;
efiBootStub = true;
needsCifsUtils = true;
netfilterRPFilter = true;
} // features) kernelPatches;

configWithPlatform = kernelPlatform: import ./common-config.nix {
inherit stdenv version kernelPlatform extraConfig;
features = kernelFeatures; # Ensure we know of all extra patches, etc.
};

config = configWithPlatform stdenv.platform;
configCross = configWithPlatform hostPlatform.platform;

kernelConfigFun = baseConfig:
let
configFromPatches =
Expand Down Expand Up @@ -115,23 +131,17 @@ let
};

passthru = {
# Combine the `features' attribute sets of all the kernel patches.
features = lib.fold (x: y: (x.features or {}) // y) features kernelPatches;
features = kernelFeatures;

meta = kernel.meta // extraMeta;

passthru = kernel.passthru // (removeAttrs passthru [ "passthru" "meta" ]);
};

configWithPlatform = kernelPlatform: import ./common-config.nix
{ inherit stdenv version kernelPlatform extraConfig;
features = passthru.features; # Ensure we know of all extra patches, etc.
};

config = configWithPlatform stdenv.platform;
configCross = configWithPlatform hostPlatform.platform;

nativeDrv = lib.addPassthru kernel.nativeDrv passthru;

crossDrv = lib.addPassthru kernel.crossDrv passthru;
in if kernel ? crossDrv then nativeDrv // { inherit nativeDrv crossDrv; } else lib.addPassthru kernel passthru

in if kernel ? crossDrv
then nativeDrv // { inherit nativeDrv crossDrv; }
else lib.addPassthru kernel passthru
7 changes: 0 additions & 7 deletions pkgs/os-specific/linux/kernel/linux-4.12.nix
Expand Up @@ -8,11 +8,4 @@ import ./generic.nix (args // rec {
url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
sha256 = "18sxw7mw4fya7381mkah70s3di6b8xxfigjhrhb7zcczrffb4vl9";
};

kernelPatches = args.kernelPatches;

features.iwlwifi = true;
features.efiBootStub = true;
features.needsCifsUtils = true;
features.netfilterRPFilter = true;
} // (args.argsOverride or {}))
7 changes: 0 additions & 7 deletions pkgs/os-specific/linux/kernel/linux-4.13.nix
Expand Up @@ -8,11 +8,4 @@ import ./generic.nix (args // rec {
url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
sha256 = "1lgwgw9yp5ywbylnmahsmqzs98yfq53mvvqqdgp7ljiqg8bxqjh6";
};

kernelPatches = args.kernelPatches;

features.iwlwifi = true;
features.efiBootStub = true;
features.needsCifsUtils = true;
features.netfilterRPFilter = true;
} // (args.argsOverride or {}))
7 changes: 0 additions & 7 deletions pkgs/os-specific/linux/kernel/linux-4.9.nix
Expand Up @@ -8,11 +8,4 @@ import ./generic.nix (args // rec {
url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
sha256 = "0dhm5w7qa1hyqp254r41b4nhf10a8w7sv1mhd16f61inpb41829c";
};

kernelPatches = args.kernelPatches;

features.iwlwifi = true;
features.efiBootStub = true;
features.needsCifsUtils = true;
features.netfilterRPFilter = true;
} // (args.argsOverride or {}))
7 changes: 0 additions & 7 deletions pkgs/os-specific/linux/kernel/linux-hardened-copperhead.nix
Expand Up @@ -27,11 +27,4 @@ import ./generic.nix (args // {
repo = "linux-hardened";
rev = "${version}.${revision}";
};

kernelPatches = args.kernelPatches;

features.iwlwifi = true;
features.efiBootStub = true;
features.needsCifsUtils = true;
features.netfilterRPFilter = true;
} // (args.argsOverride or {}))
8 changes: 1 addition & 7 deletions pkgs/os-specific/linux/kernel/linux-mptcp.nix
Expand Up @@ -15,8 +15,6 @@ import ./generic.nix (args // rec {
sha256 = "0vqjnkzcbbvyq24w3cryfmw7hhws1xqkkxqcv71szkbqqs6mcr14";
};

kernelPatches = args.kernelPatches;

extraConfig = ''
IPV6 y
MPTCP y
Expand All @@ -41,10 +39,6 @@ import ./generic.nix (args // rec {
TCP_CONG_OLIA m
TCP_CONG_WVEGAS m
TCP_CONG_BALIA m
'';
features.iwlwifi = true;
features.efiBootStub = true;
features.needsCifsUtils = true;
features.netfilterRPFilter = true;
'' + (args.extraConfig or "");
} // (args.argsOverride or {}))
6 changes: 3 additions & 3 deletions pkgs/os-specific/linux/kernel/linux-rpi.nix
Expand Up @@ -15,9 +15,9 @@ stdenv.lib.overrideDerivation (import ./generic.nix (args // rec {
sha256 = "1ly0x7a43zvig0fv7lc6rpq49pcdb7i9sdb78p4gi5485zap40kb";
};

features.iwlwifi = true;
features.needsCifsUtils = true;
features.netfilterRPFilter = true;
features = {
efiBootStub = false;
} // (args.features or {});

extraMeta.hydraPlatforms = [];
})) (oldAttrs: {
Expand Down
5 changes: 0 additions & 5 deletions pkgs/os-specific/linux/kernel/linux-samus-4.12.nix
Expand Up @@ -14,10 +14,5 @@ import ./generic.nix (args // rec {
sha256 = "1dr74i79p8r13522w2ppi8gnjd9bhngc9d2hsn91ji6f5a8fbxx9";
}; in "${upstream}/build/linux";

features.iwlwifi = true;
features.efiBootStub = true;
features.needsCifsUtils = true;
features.netfilterRPFilter = true;

extraMeta.hydraPlatforms = [];
} // (args.argsOverride or {}))
5 changes: 0 additions & 5 deletions pkgs/os-specific/linux/kernel/linux-testing-bcachefs.nix
Expand Up @@ -16,11 +16,6 @@ import ./generic.nix (args // rec {
BCACHEFS_FS m
'';

features.iwlwifi = true;
features.efiBootStub = true;
features.needsCifsUtils = true;
features.netfilterRPFilter = true;

# Should the testing kernels ever be built on Hydra?
extraMeta.hydraPlatforms = [];

Expand Down
5 changes: 0 additions & 5 deletions pkgs/os-specific/linux/kernel/linux-testing.nix
Expand Up @@ -10,11 +10,6 @@ import ./generic.nix (args // rec {
sha256 = "0dhcsjgcy28pyyzwf2s0862p92bwb324kapli2y9n90bw0kl53gi";
};

features.iwlwifi = true;
features.efiBootStub = true;
features.needsCifsUtils = true;
features.netfilterRPFilter = true;

# Should the testing kernels ever be built on Hydra?
extraMeta.hydraPlatforms = [];

Expand Down

0 comments on commit 8525b78

Please sign in to comment.