We’ve been experimenting with the ‘nixos-generate’ command with hopes of generating iso and virtualbox/ova images but ran into some issues that we’d appreciate getting help with.
Our first attempt was to create an ‘iso’ from an existing nixos install that has been customized with various packages and configuration items.
We used the following ‘nixos-generate’ command thinking it would generate an iso that would boot up our customized nixos image, however, we find that it boots to the installer instead.
nixos-generate -f iso -c /etc/nixos/configuration.nix
Why? How does this differ from the ‘nixos-generate’ command that utilizes the format ‘install-iso’, which also generates an iso image that when booted also starts the installer?
nixos-generate -f install-iso -c /etc/nixos/configuration.nix
Next, we attempted to generate a virtualbox or ova image using:
nixos-generate -f virtualbox -c /etc/nixos/configuration.nix
However, this resulted in the following errors:
error: The option `fileSystems./.device' has conflicting definition values: - In `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/virtualisation/virtualbox-image.nix': "/dev/disk/by-label/nixos" - In `/etc/nixos/hardware-configuration.nix': "/dev/disk/by-uuid/1e0b6e4c-b463-45db-9168-8ad69eff0c76" (use '--show-trace' to show detailed location information)
If we examine our ‘/etc/fstab’, we can see that the root partition does indeed use ‘by-uuid’ vs ‘by-label’ mounting, which appears to be the issue – but why? Is there any way to fix this outside of reinstalling our nixos and purposefully using ‘by-label’ partitioning?
# This is a generated file. Do not edit! # # To make changes, edit the fileSystems and swapDevices NixOS options # in your /etc/nixos/configuration.nix file. # # <file system> <mount point> <type> <options> <dump> <pass> # Filesystems. /dev/disk/by-uuid/1e0b6e4c-b463-45db-9168-8ad69eff0c76 / ext4 defaults 0 1 /dev/disk/by-uuid/4842-0D4C /boot/efi vfat defaults 0 2 # Swap devices. /dev/disk/by-uuid/0c402608-bf44-4efc-9a44-81208e37cc3b none swap defaults
Thanks in advance for your thoughts and inputs.