From 7f25b26511aef36fdad4fb3999af8ce7c2dfea72 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 23 Mar 2018 10:08:06 +0100 Subject: [PATCH] linuxPackages_custom: fix missing argument and add test 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 --- .../linux/kernel/manual-config.nix | 2 ++ pkgs/top-level/all-packages.nix | 33 +++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index 60fb0064513..9833bb57baf 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -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 }: diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1480b906403..3debf1a9489 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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); @@ -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 { };