Update:
Now that cot has been merged, we can replace the command that modifies the VirtualSystemType
with a much more succinct cot
invocation:
Before:
pkgs.runCommand "fix-esxi-image" {}
''
mkdir $out
tar -xvf ${vboxImage}/*.ova
ovf=$(ls -1 *.ovf)
mf=$(ls -1 *.mf)
vmdk=$(ls -1 *.vmdk)
sed 's;\(.*<vssd:VirtualSystemType>\).*\(</vssd:VirtualSystemType>\);\1${vmx-14}\2;;' -i nixos-20.09pre-git-x86_64-linux.ovf
sum=$(sha1sum $ovf | cut -d ' ' -f-1)
substituteInPlace $mf --replace "SHA1 ($ovf) = .*" "SHA1 ($ovf) = $sum"
tar -cvf nixos.ova $ovf $mf $vmdk
cp nixos.ova $out
'';
After:
pkgs.runCommand "fix-esxi-image" { }
''
ova=${vboxImage}/*.ova
mkdir $out
${pkgs.cot}/bin/cot edit-hardware $ova -v ${vmx} -o $out/nixos.ova
'';