Skip to content

Instantly share code, notes, and snippets.

@evanjs
Last active June 4, 2020 17:40
Show Gist options
  • Save evanjs/1fa1e1d3379750143347762164ed18e4 to your computer and use it in GitHub Desktop.
Save evanjs/1fa1e1d3379750143347762164ed18e4 to your computer and use it in GitHub Desktop.
Generate ESXi-compatible virtual appliance
pkgs.runCommand "fix-appliance-esxi" {}
''
mkdir $out
mkdir ova
pushd ova
echo "Tar command: tar -xvf ${vboxImage}/*.ova"
tar -xvf ${vboxImage}/*.ova
ovf=$(ls -1 *.ovf)
mf=$(ls -1 *.mf)
vmdk=$(ls -1 *.vmdk)
sed 's;\(.*<vssd:VirtualSystemType>\).*\(</vssd:VirtualSystemType>\);\1vmx-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
'';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment