I’d like to launch a NixOS VM on https://www.brightbox.com
Their distro image catalog has very old NixOS versions (from 2015), so I thought I’ll build a fresh image using the instructions from Brightbox blog: NixOS on Brightbox - Blog - Brightbox
I adjusted the paths and ended up with the following updated command which seems to at least start building the image:
export NIXOS_CONFIG=~/.nix-defexpr/channels/nixos/nixos/modules/virtualisation/brightbox-config.nix
nix-build ~/.nix-defexpr/channels/nixos/nixos -A config.system.build.brightboxImage --argstr system x86_64-linux
I ran it as root. It failed with the following output:
[root@stacja:~]# nix-build ~/.nix-defexpr/channels/nixos/nixos -A config.system.build.brightboxImage --argstr system x86_64-linux
trace: warning: system.stateVersion is not set, defaulting to 23.11. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion.
this derivation will be built:
/nix/store/kaxifd4hnvb209xf4bljdnp0qga3kazb-brightbox-image.drv
building '/nix/store/kaxifd4hnvb209xf4bljdnp0qga3kazb-brightbox-image.drv'...
WARNING: Image format was not specified for '/nix/store/0jawic42xixa700x6ch7zmg7wzh094mw-brightbox-image/nixos-image-23.11.1494.b4372c4924d9-x86_64-linux.raw' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
cSeaBIOS (version rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org)
iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+1EFD0ED0+1EF30ED0 CA00
Booting from ROM...
Probing EDD (edd=off to disable)... ocloading kernel modules...
[ 0.170373] Invalid ELF header magic: != ELF
[ 0.171955] Invalid ELF header magic: != ELF
[ 0.174173] Invalid ELF header magic: != ELF
[ 0.175556] Invalid ELF header magic: != ELF
[ 0.176753] Invalid ELF header magic: != ELF
[ 0.219397] Invalid ELF header magic: != ELF
[ 0.221046] Invalid ELF header magic: != ELF
[ 0.226257] Invalid ELF header magic: != ELF
[ 0.228170] Invalid ELF header magic: != ELF
[ 0.229631] Invalid ELF header magic: != ELF
[ 0.231161] Invalid ELF header magic: != ELF
[ 0.241428] Invalid ELF header magic: != ELF
[ 0.243606] Invalid ELF header magic: != ELF
[ 0.244817] Invalid ELF header magic: != ELF
[ 0.246444] Invalid ELF header magic: != ELF
[ 0.248146] Invalid ELF header magic: != ELF
[ 0.293669] Invalid ELF header magic: != ELF
[ 0.297319] Invalid ELF header magic: != ELF
[ 0.302866] Invalid ELF header magic: != ELF
[ 0.307957] Invalid ELF header magic: != ELF
[ 0.311677] Invalid ELF header magic: != ELF
[ 0.313966] Invalid ELF header magic: != ELF
mounting Nix store...
mounting host's temporary directory...
starting stage 2 (/nix/store/9jg09h9186mf9487yys0dzgyqwci52fp-vm-run-stage2)
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 20.0GB 20.0GB primary
mknod: /dev/vda1: File exists
[ 1.010172] reboot: Power down
error: builder for '/nix/store/kaxifd4hnvb209xf4bljdnp0qga3kazb-brightbox-image.drv' failed with exit code 1
I try this on NixOS 23.11, upgraded to the latest packages on December 10th 2023.
I’m not sure if the brightboxImage
derivation is broken for the current state of NixOS or there’s a better of way running this build command. The blog post is from 2016 so it’s likely that this needs some tweaks.
Any ideas on how to troubleshoot this? Has anyone successfully built this image recently?
I’ve looked at https://github.com/nix-community/nixos-generators but they don’t include Brightbox one.
I’m aware of nixos-infect and nixos-anywhere but if possible I’d prefer to build a NixOS image instead of infecting Ubuntu or something similar.