Skip to content

Commit

Permalink
linuxPackages_custom: fix missing argument and add test
Browse files Browse the repository at this point in the history
The required argument 'hostPlatform' was missing from linuxPackages_custom's
call to linuxManualConfig.

In order to prevent this in the future, this commit adds
linuxPackages_custom_tinyconfig_kernel so linuxPackages_custom gets tested.

This also adds linuxConfig, to derivate default linux configurations
via make defconfig, make tinyconfig, etc.

Closes #38034.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
  • Loading branch information
roberth authored and thoughtpolice committed Apr 7, 2018
1 parent e1dee4e commit 7f25b26
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pkgs/os-specific/linux/kernel/manual-config.nix
Expand Up @@ -35,6 +35,8 @@ in {
extraMeta ? {},
# Whether to utilize the controversial import-from-derivation feature to parse the config
allowImportFromDerivation ? false,
# ignored
features ? null,

hostPlatform
}:
Expand Down
33 changes: 30 additions & 3 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -13605,12 +13605,25 @@ with pkgs;
# Intentionally lacks recurseIntoAttrs, as -rc kernels will quite likely break out-of-tree modules and cause failed Hydra builds.
linuxPackages_testing = linuxPackagesFor pkgs.linux_testing;

linuxPackages_custom = { version, src, configfile }:
linuxPackages_custom = { version, src, configfile, allowImportFromDerivation ? true }:
recurseIntoAttrs (linuxPackagesFor (pkgs.linuxManualConfig {
inherit version src configfile stdenv;
allowImportFromDerivation = true;
inherit version src configfile stdenv allowImportFromDerivation;
inherit (stdenv) hostPlatform;
}));

# This serves as a test for linuxPackages_custom
linuxPackages_custom_tinyconfig_kernel = let
base = pkgs.linuxPackages.kernel;
tinyLinuxPackages = pkgs.linuxPackages_custom {
inherit (base) version src;
allowImportFromDerivation = false;
configfile = pkgs.linuxConfig {
makeTarget = "tinyconfig";
src = base.src;
};
};
in tinyLinuxPackages.kernel;

# Build a kernel with bcachefs module
linuxPackages_testing_bcachefs = recurseIntoAttrs (linuxPackagesFor pkgs.linux_testing_bcachefs);

Expand Down Expand Up @@ -13648,6 +13661,20 @@ with pkgs;

# A function to build a manually-configured kernel
linuxManualConfig = makeOverridable (callPackage ../os-specific/linux/kernel/manual-config.nix {});

# Derive one of the default .config files
linuxConfig = { src, makeTarget ? "defconfig", name ? "kernel.config" }:
stdenv.mkDerivation {
inherit name src;
buildPhase = ''
set -x
make ${makeTarget}
'';
installPhase = ''
cp .config $out
'';
};

buildLinux = attrs: callPackage ../os-specific/linux/kernel/generic.nix attrs;

keyutils = callPackage ../os-specific/linux/keyutils { };
Expand Down

0 comments on commit 7f25b26

Please sign in to comment.