I installed NixOS 18.03 from Ubuntu on another partition following the NixOS manual's "2.4. Installing from another Linux distribution" section. Everything went fine, but I did a couple idiotic things [?], namely:
Forgot to add the extra GRUB boot loader entry for the Ubuntu installation before
nixos-install
. Added it as an afterthought after install, and did a reboot (of course, no Ubuntu entry)Did not enable any networking in
configuration.nix
, and ended up with no network configuration commands after reboot to connect to wifi. The catch 22 is thatnixos-rebuild switch
requires a network connection, so I couldn't finalize any changes.
So my thinking was that I can boot from a NixOS Live CD (17.03),connect to our wifi and somehow rebuild the config of the installation.
It is more than possible that I am missing something essential, have incorrect assumptions above etc; fairly new at nix and NixOS.
EDIT: I forgot to include how my partitions are set up and what I tried before successfully installing NixOS.
Partitions (mountpoints from Ubuntu):
sda
├─sda1 ntfs Recovery # some Win7 artifact
├─sda2 vfat /boot/efi
├─sda3 vfat NIXBOOT # boot partition (esp, boot)
├─sda4 ext4 onyx # NixOS data
├─sda5 swap # Ubuntu swap
│ └─cryptswap1 swap [SWAP]
├─sda6 ext4 # (Arch install)
├─sda7 ext4 / # Ubuntu install
├─sda8 swap nixswap
└─sda9 ext4 home
I didn't want to mess up the Ubuntu boot partition, so I created another one (/dev/sda3
). My plan was to later include a menu entry in Ubuntu's GRUB for NixOS, but for now, install, reboot and test booting NixOS from GRUB console (set root=...
, linux ...
, initrd ...
, boot
)
sudo PATH="$PATH" NIX_PATH="$NIX_PATH" `which nixos-install` --root /mnt --no-bootloader
After reboot, I couldn't see anything on the NixOS boot partition. Went back to Ubunut, installed without --no-bootloader
, remembered to add an entry for Ubuntu and reboot. (It was only after this that I realized that systemd-boot
and GRUB are two completely different things...)
UPDATE: I was able to get back to Ubuntu by selecting the Ubuntu boot partition as an alternative boot device in BIOS, and the usual GRUB menu came up. I may just redo the install with the right config.
chroot
to edit the configuration and rebuild. wiki.archlinux.org/index.php/Change_root#Using_chrootchroot
articles seemed intimidating, but I just realized thatnixos-enter
does just that. (It is also invoked bynixos-install
when installing the boot loader.)