-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
module request: virtualisation -- ESXi image, guest support #94104
Comments
I marked this as stale due to inactivity. → More info |
I am interested in this feature. I recently had to generate an Image for ESXi image from a flake and went with specifying
in my system configuration and then generating it with
without using Generating an OVA image would have been a better option for me, because that would have additionally included the hardware configuration, while I only got the disk image. Right now I would have to import
and not
and it would still require the changes you mentioned on top of that to be useful in ESXi, and I would imagine it would be useful to have more conformant images for VMware Workstation as well. I think ideally |
Just chiming in to also express interest in this feature! |
I marked this as stale due to inactivity. → More info |
I've had success in modifying the virtualbox-image.nix by replacing SATA with SCSI -- I plan on making it more generic and opening a PR in a bit. For now I just copied the virtualbox-image.nix (and added it to my flake, the --- /nix/pkgs/nixos/modules/virtualisation/virtualbox-image.nix 2022-02-16 10:39:53.091710499 +0000
+++ vmware-ova.nix 2022-06-28 17:30:02.213422098 +0100
@@ -1,3 +1,10 @@
+# This is a copy of
+# ${nixpkgs}/nixos/modules/virtualisation/virtualbox-image.nix
+# The important change from there is
+# - Using SCSI not SATA for the disk controller
+# - Putting in the VirtualBox compatibility field into the OVA
+
+{ nixpkgs, ... } @ flake-args:
{ config, lib, pkgs, ... }:
with lib;
@@ -53,6 +61,14 @@
The file name of the VirtualBox appliance.
'';
};
+ vmx = mkOption {
+ type = types.str;
+ default = "vmx-14";
+ example = "vmx-9";
+ description = ''
+ The VMware hardware version, see https://kb.vmware.com/s/article/1003746.
+ '';
+ };
params = mkOption {
type = with types; attrsOf (oneOf [ str int bool (listOf str) ]);
example = {
@@ -130,7 +149,7 @@
(mkIf (pkgs.stdenv.hostPlatform.system == "i686-linux") { pae = "on"; })
];
- system.build.virtualBoxOVA = import ../../lib/make-disk-image.nix {
+ system.build.virtualBoxOVA = import "${nixpkgs}/nixos/lib/make-disk-image.nix" {
name = cfg.vmDerivationName;
inherit pkgs lib config;
@@ -167,11 +186,11 @@
VBoxManage modifyvm "$vmName" \
--memory ${toString cfg.memorySize} \
${lib.cli.toGNUCommandLineShell { } cfg.params}
- VBoxManage storagectl "$vmName" --name SATA --add sata --portcount 4 --bootable on --hostiocache on
- VBoxManage storageattach "$vmName" --storagectl SATA --port 0 --device 0 --type hdd \
+ VBoxManage storagectl "$vmName" --name SCSI --add scsi --portcount 16 --bootable on --hostiocache on
+ VBoxManage storageattach "$vmName" --storagectl SCSI --port 0 --device 0 --type hdd \
--medium disk.vmdk
${optionalString (cfg.extraDisk != null) ''
- VBoxManage storageattach "$vmName" --storagectl SATA --port 1 --device 0 --type hdd \
+ VBoxManage storageattach "$vmName" --storagectl SCSI --port 1 --device 0 --type hdd \
--medium data-disk.vmdk
''}
@@ -179,6 +198,7 @@
mkdir -p $out
fn="$out/${cfg.vmFileName}"
VBoxManage export "$vmName" --output "$fn" --options manifest ${escapeShellArgs cfg.exportParams}
+ ${pkgs.cot}/bin/cot edit-hardware $fn -v ${cfg.vmx}
rm -v $diskImage
@@ -209,7 +229,7 @@
size = 2048;
}];
- virtualisation.virtualbox.guest.enable = true;
+ virtualisation.vmware.guest.enable = true;
};
}
|
Working on an initial ESXi format module for nix, based on a github comment: NixOS/nixpkgs#94104 (comment)
Hey, I would love to have this as well. |
ESXi Virtualisation Support
There are currently plenty of virtualisation modules for both images and guests.
ESXi is not among those provided.
While VMWare images ought to work, from what I've found, ESXi is known to be notoriously picky when it comes to OVA/OVF imports.
I posted a bit more on the issue on Discourse.
My current workflow is a complicated mess that involves importing
nixos-generators
, generating a VirtualBox image, extracting the generated OVA, modifying the OVF definition, re-calculating the hashes in themf
file, and re-packaging the OVA.While the edits that I am doing to the OVA could potentially be improved by applications like cot (see also: glennmatthews/cot#80), it would be nice to eventually see some of these changes make it upstream.
My current approach is so hacky that I'm not sure it would be a welcome addition in its current state.
I'm open to ideas, but I'm hoping to eventually be able to run e.g.
nixos-generate -f esxi
without all hacks I currently have to maintain.The text was updated successfully, but these errors were encountered: