mirror of
https://github.com/nix-community/disko.git
synced 2026-12-01 21:43:29 +01:00
fix(make-disk-image): support vmTools kernelModules with backward compatibility
This commit is contained in:
1 parent
725ea35e41
commit
61c844e2c0
2 files changed
+33
-9
No files matched your search
@@ -646,6 +646,19 @@ let
|
|||||||
*/
|
*/
|
||||||
vmToolsSupportsCustomQemu = final_lib: lib.versionAtLeast final_lib.version "24.11.20240709";
|
vmToolsSupportsCustomQemu = final_lib: lib.versionAtLeast final_lib.version "24.11.20240709";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Checks whether vmTools supports the kernelModules argument.
|
||||||
|
Older nixpkgs versions only supported overriding `kernel` with an aggregated modules tree.
|
||||||
|
|
||||||
|
vmToolsSupportsKernelModules :: pkgs -> bool
|
||||||
|
*/
|
||||||
|
vmToolsSupportsKernelModules =
|
||||||
|
pkgs:
|
||||||
|
(pkgs.vmTools.override.__functionArgs or (
|
||||||
|
if lib.isFunction pkgs.vmTools.override then builtins.functionArgs pkgs.vmTools.override else { }
|
||||||
|
)
|
||||||
|
) ? kernelModules;
|
||||||
|
|
||||||
optionTypes = rec {
|
optionTypes = rec {
|
||||||
filename = lib.mkOptionType {
|
filename = lib.mkOptionType {
|
||||||
name = "filename";
|
name = "filename";
|
||||||
|
|||||||
+20
-9
@@ -27,6 +27,15 @@ let
|
|||||||
${pkgs.systemdMinimal}/lib/systemd/systemd-binfmt <(echo ${lib.strings.escapeShellArg binfmt.binfmtRegistration})
|
${pkgs.systemdMinimal}/lib/systemd/systemd-binfmt <(echo ${lib.strings.escapeShellArg binfmt.binfmtRegistration})
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
modulesTree = pkgs.aggregateModules (
|
||||||
|
[
|
||||||
|
cfg.kernelPackages.kernel
|
||||||
|
]
|
||||||
|
++ lib.optional (cfg.kernelPackages.kernel ? modules) cfg.kernelPackages.kernel.modules
|
||||||
|
++ lib.optional (
|
||||||
|
lib.elem "zfs" cfg.extraRootModules || configSupportsZfs
|
||||||
|
) cfg.kernelPackages.${config.boot.zfs.package.kernelModuleAttribute}
|
||||||
|
);
|
||||||
vmTools = pkgs.vmTools.override (
|
vmTools = pkgs.vmTools.override (
|
||||||
{
|
{
|
||||||
rootModules = [
|
rootModules = [
|
||||||
@@ -41,16 +50,18 @@ let
|
|||||||
]
|
]
|
||||||
++ (lib.optional configSupportsZfs "zfs")
|
++ (lib.optional configSupportsZfs "zfs")
|
||||||
++ cfg.extraRootModules;
|
++ cfg.extraRootModules;
|
||||||
kernel = pkgs.aggregateModules (
|
|
||||||
[
|
|
||||||
cfg.kernelPackages.kernel
|
|
||||||
]
|
|
||||||
++ lib.optional (cfg.kernelPackages.kernel ? modules) cfg.kernelPackages.kernel.modules
|
|
||||||
++ lib.optional (
|
|
||||||
lib.elem "zfs" cfg.extraRootModules || configSupportsZfs
|
|
||||||
) cfg.kernelPackages.${config.boot.zfs.package.kernelModuleAttribute}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
// (
|
||||||
|
if diskoLib.vmToolsSupportsKernelModules pkgs then
|
||||||
|
{
|
||||||
|
kernel = cfg.kernelPackages.kernel;
|
||||||
|
kernelModules = modulesTree;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kernel = modulesTree;
|
||||||
|
}
|
||||||
|
)
|
||||||
// lib.optionalAttrs (diskoLib.vmToolsSupportsCustomQemu lib) {
|
// lib.optionalAttrs (diskoLib.vmToolsSupportsCustomQemu lib) {
|
||||||
customQemu = cfg.qemu;
|
customQemu = cfg.qemu;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user