diff --git a/modules/system/boot/kernel.nix b/modules/system/boot/kernel.nix index 5bb479698352..326cf64d6b85 100644 --- a/modules/system/boot/kernel.nix +++ b/modules/system/boot/kernel.nix @@ -195,16 +195,19 @@ let kernel = config.boot.kernelPackages.kernel; in isYes = option: { assertion = config: config.isYes option; message = "CONFIG_${option} is not yes!"; + configLine = "CONFIG_${option}=y"; }; isNo = option: { assertion = config: config.isNo option; message = "CONFIG_${option} is not no!"; + configLine = "CONFIG_${option}=n"; }; isModule = option: { assertion = config: config.isModule option; message = "CONFIG_${option} is not built as a module!"; + configLine = "CONFIG_${option}=m"; }; ### Usually you will just want to use these two @@ -212,12 +215,14 @@ let kernel = config.boot.kernelPackages.kernel; in isEnabled = option: { assertion = config: config.isEnabled option; message = "CONFIG_${option} is not enabled!"; + configLine = "CONFIG_${option}=y"; }; # True if no or omitted isDisabled = option: { assertion = config: config.isDisabled option; message = "CONFIG_${option} is not disabled!"; + configLine = "CONFIG_${option}=n"; }; }; diff --git a/release.nix b/release.nix index 4ccbd2ef754f..9f76ee4a254c 100644 --- a/release.nix +++ b/release.nix @@ -212,6 +212,7 @@ let kde4 = t.kde4.test; login = t.login.test; misc = t.misc.test; + minimal_kernel = t.minimal_kernel.test; mpich = t.mpich.test; mysql = t.mysql.test; mysql_replication = t.mysql_replication.test; diff --git a/tests/default.nix b/tests/default.nix index 4edcbd2f325b..2433826a9d17 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -11,6 +11,7 @@ with import ../lib/testing.nix { inherit system; }; ipv6 = makeTest (import ./ipv6.nix); kde4 = makeTest (import ./kde4.nix); login = makeTest (import ./login.nix); + minimal_kernel = makeTest (import ./minimal-kernel.nix); misc = makeTest (import ./misc.nix); mpich = makeTest (import ./mpich.nix); mysql = makeTest (import ./mysql.nix); diff --git a/tests/minimal-kernel.nix b/tests/minimal-kernel.nix new file mode 100644 index 000000000000..04fe17c261b7 --- /dev/null +++ b/tests/minimal-kernel.nix @@ -0,0 +1,34 @@ +{ pkgs, ... }: + + +{ + machine = { config, pkgs, ... }: + let + configfile = builtins.storePath (builtins.toFile "config" (pkgs.lib.concatStringsSep "\n" + (map (builtins.getAttr "configLine") config.system.requiredKernelConfig))); + + kernel = pkgs.lib.overrideDerivation (pkgs.linuxManualConfig { + inherit (pkgs.linux) src version; + inherit configfile; + allowImportFromDerivation = true; + }) (attrs: { + configurePhase = '' + runHook preConfigure + mkdir ../build + make $makeFlags "''${makeFlagsArray[@]}" mrproper + make $makeFlags "''${makeFlagsArray[@]}" KCONFIG_ALLCONFIG=${configfile} allnoconfig + runHook postConfigure + ''; + }); + + kernelPackages = pkgs.linuxPackagesFor kernel kernelPackages; + in { + boot.kernelPackages = kernelPackages; + }; + + testScript = + '' + startAll; + $machine->shutdown; + ''; +}