1

Nixos has a configuration option in the manual for specifying extra entries in the grub menu boot.loader.grub. extraEntries but I can't get it to work with the examples in the manual. The idea is to let the version of grub installed by nixos have extra entries for other bootable partitions. For example, if Ubuntu (or Debian or BSD, etc) were installed and booting from /dev/sda2, one should be able to install nixos to /dev/sda1, use /dev/sda for grub, and boot either nixos or Ubuntu.

I can get the boot.loader.grub.extraEntries to appear in the menu, but not to get a successful boot of the Ubuntu installation. Nixos boots fine, and I can boot the Ubuntu partition from a rescue CD. Does someone have something like this working, or can they direct me to additional sources - especially sources that might be good for other nixos newbie-type questions?

1

Add a menu entry to Ubuntu grub with configfile (hd,....)/boot/grub/grub.cfg of nixos. Reference: http://www.gnu.org/software/grub/manual/grub.html#configfile

Then in the nixos grub device use device = "nodev". That will still be generating the grub config, but it will not install grub. This way you have both ubuntu and nixos grub updatable.

0

This is not "the" answer to my question, but it is a work around, and too long to be a comment.

I used the Ubuntu Live CD to download Boot-Repair and fixed the grub.cfg so that I could boot into Ubuntu. I then booted to Ubuntu, mounted the Nixos partition and looked at the entry for the Nixos Default. I copied that to /etc/grub.d/40_custom on the Ubuntu side. I had to add a first line of set root=(hd0,1). This is because my Nixos was installed on /dev/sda1. Your entry will need to be tailored to the location of the Nixos partition.

After saving and closing files I ran grub-mkconfig -o /boot/grub/grub.cfg to recreate the grub configuration with the Nixos entry. Now when I reboot the Nixos Default option shows in the menu and I can boot to either Ubuntu or Nixos. The inconvenience of this solution is that it will be necessary to manually change the custom entry everytime Nixos is upgraded, and then to regenerate the grub.cfg, but at least it does give access to both from a single grub menu.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.