[Nix-dev] NixOS installation on multi-boot system with GRUB

宋文武 iyzsong at gmail.com
Sat Aug 29 09:31:31 CEST 2015


Henning Thielemann <lemming at henning-thielemann.de> writes:

> On Thu, 27 Aug 2015, 宋文武 wrote:
>
>> I think you can:
>>  install NixOS's GRUB to its boot partitation, then add a 'chainloader'
>>  menu entry to your main GRUB (installed into MBR by Ubuntu).
>>  I did this with btrfs (ext4 did't work for me):
>>    boot.loader.grub.device = "/dev/sdaX";
>>  (sdaX is the boot or root partition)
>>  # grub.cfg
>>  menuentry 'NixOS' {
>>    set root='(hd0,X)'
>>    chainloader +1
>>  }
>>
>>  install NixOS without GRUB, then add a 'configfile' menu entry to your
>>  GRUB to load NixOS's grub.cfg.
>>  I guess it look like:
>>    boot.loader.grub.device = "nodev";
>>  # grub.cfg
>>  menuentry 'NixOS' {
>>    set root='(hd0,X)'
>>    configfile '/boot/grub/grub.cfg';
>>  }
>
>
> I find no /boot/grub/grub.cfg on the NixOS partition, not even a 'grub' 
> directory. Am I supposed to write a grub.cfg myself or should 
> nixos-install create one for me? If the latter one, how can I make 
> nixos-install create a grub.cfg for me but not install a boot-loader?
Indeed, I think nixos-install should create the grub.cfg without touch the
MBR when you set 'boot.loader.grub.device' to "nodev".

You need modify your main grub.cfg (the Ubuntu one) to add a
NixOS menuentry with 'chainloader' or 'configfile'.


More information about the nix-dev mailing list