mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-06 04:53:27 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
65 lines
1.5 KiB
Nix
65 lines
1.5 KiB
Nix
# Vagrant + VirtualBox
|
|
|
|
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
|
|
{
|
|
imports = [
|
|
./vagrant-guest.nix
|
|
./virtualbox-image.nix
|
|
];
|
|
|
|
virtualbox.params = {
|
|
audio = "none";
|
|
audioin = "off";
|
|
audioout = "off";
|
|
usb = "off";
|
|
usbehci = "off";
|
|
};
|
|
documentation.man.enable = false;
|
|
documentation.nixos.enable = false;
|
|
|
|
users.extraUsers.vagrant.extraGroups = [ "vboxsf" ];
|
|
|
|
# generate the box v1 format which is much easier to generate
|
|
# https://www.vagrantup.com/docs/boxes/format.html
|
|
image.extension = lib.mkOverride 999 "${config.image.baseName}.box";
|
|
system.nixos.tags = [ "vagrant" ];
|
|
system.build.image = lib.mkOverride 999 config.system.build.vagrantVirtualbox;
|
|
system.build.vagrantVirtualbox = pkgs.runCommand config.image.fileName { } ''
|
|
mkdir workdir
|
|
cd workdir
|
|
|
|
# 1. create that metadata.json file
|
|
echo '{"provider":"virtualbox"}' > metadata.json
|
|
|
|
# 2. create a default Vagrantfile config
|
|
cat <<VAGRANTFILE > Vagrantfile
|
|
Vagrant.configure("2") do |config|
|
|
config.vm.base_mac = "0800275F0936"
|
|
end
|
|
VAGRANTFILE
|
|
|
|
# 3. add the exported VM files
|
|
tar xvf ${config.system.build.virtualBoxOVA}/*.ova
|
|
|
|
# 4. move the ovf to the fixed location
|
|
mv *.ovf box.ovf
|
|
|
|
# 5. generate OVF manifest file
|
|
rm *.mf
|
|
touch box.mf
|
|
for fname in *; do
|
|
checksum=$(sha256sum $fname | cut -d' ' -f 1)
|
|
echo "SHA256($fname)= $checksum" >> box.mf
|
|
done
|
|
|
|
# 6. compress everything back together
|
|
tar --owner=0 --group=0 --sort=name --numeric-owner -czf $out .
|
|
'';
|
|
}
|