nixos/kernel: replace boot.isContainer with boot.kernel.enable
This commit is contained in:
committed by
Sandro Jäckel
parent
8191089900
commit
182575a60d
@@ -27,7 +27,7 @@ let
|
|||||||
|
|
||||||
# Containers don't have their own kernel or initrd. They boot
|
# Containers don't have their own kernel or initrd. They boot
|
||||||
# directly into stage 2.
|
# directly into stage 2.
|
||||||
${optionalString (!config.boot.isContainer) ''
|
${optionalString config.boot.kernel.enable ''
|
||||||
if [ ! -f ${kernelPath} ]; then
|
if [ ! -f ${kernelPath} ]; then
|
||||||
echo "The bootloader cannot find the proper kernel image."
|
echo "The bootloader cannot find the proper kernel image."
|
||||||
echo "(Expecting ${kernelPath})"
|
echo "(Expecting ${kernelPath})"
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ in
|
|||||||
###### interface
|
###### interface
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
boot.kernel.enable = mkEnableOption (lib.mdDoc "the Linux kernel. This is useful for systemd-like containers which do not require a kernel.") // {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
boot.kernel.features = mkOption {
|
boot.kernel.features = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
@@ -258,7 +261,7 @@ in
|
|||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf (!config.boot.isContainer) {
|
(mkIf config.boot.kernel.enable {
|
||||||
system.build = { inherit kernel; };
|
system.build = { inherit kernel; };
|
||||||
|
|
||||||
system.modulesTree = [ kernel ] ++ config.boot.extraModulePackages;
|
system.modulesTree = [ kernel ] ++ config.boot.extraModulePackages;
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ with lib;
|
|||||||
config = mkIf config.boot.isContainer {
|
config = mkIf config.boot.isContainer {
|
||||||
|
|
||||||
# Disable some features that are not useful in a container.
|
# Disable some features that are not useful in a container.
|
||||||
|
boot.kernel.enable = false;
|
||||||
|
|
||||||
nix.optimise.automatic = mkDefault false; # the store is host managed
|
nix.optimise.automatic = mkDefault false; # the store is host managed
|
||||||
powerManagement.enable = mkDefault false;
|
powerManagement.enable = mkDefault false;
|
||||||
documentation.nixos.enable = mkDefault false;
|
documentation.nixos.enable = mkDefault false;
|
||||||
|
|||||||
Reference in New Issue
Block a user