Hello!
I use GRUB from arch and to update Grub configuration i should use: grub-mkconfig -o /boot/grub/grub.cfg. (GRUB - ArchWiki)
If i didn’t do this on my Arch setup i can’t see now generations from nixos-rebuild.
So every time when i use nixos-rebuild i shoul load my arch system and regenerate config for Grub. Is there any way to automate it?
Use nixos’ bootloader, not arch’s. Most likely the only reason you’re seeing nixos’ entries at all is because arch is replicating them.
Fundamentally, nixos really needs to be in control of its bootloader. These kinds of problems always exist if it isn’t. You can chainload between multiple bootloaders to manage multiple OSes, or you can let nixos’ bootloader take over for booting the other OSes.
Then I think allowing NixOS to control the bootloader is a good idea, but how can I do this without risk? How can I simply change who controls the bootloader?
Messing with bootloaders is never entirely without risk. And I don’t have enough information about your circumstances to give you specific instructions. However I do have one tip: there’s a good chance both bootloaders are installed and working. If so, you can likely load nixos’ bootloader from your motherboard firmware without actually changing anything, as well as change the preference order for the bootloaders that are tried.
My main OS is arch and nix installed on additional drive, Grub is on drive where arch is installed.
Also, i remember that Grub can launch other boot loader (Read somewhere about it, but can’t find), so probably better idea will be launch NixOS boot loader from my main boot loader.
I see you made no EFI System Partition on the drive you installed nixos on… and nothing is apparently mounted on /boot in your nixos system. So your bootloader configuration in nixos is likely more broken than I thought.
Just to double-check, you are using EFI firmware, right? This isn’t somehow still a BIOS system?
(I’m assuming that 1G partition you’ve said is your arch boot partition is an EFI System Partition, but it could just be a small partition used by a BIOS-style grub installation…)
My BIOS system is from 2012.
Fortunately, I have UEFI support and Grub works on it, as far as I understand.
But when i trying to launch installer for NixOS in UEFI mode it just didn’t work and send me error “Failed to install bootloader”, so i launch in normal mode and it works.
Ok, so your nixos installation, at least, is BIOS mode… I wasn’t expecting that.
In that case, chainloading between an EFI bootloader and a BIOS bootloader is likely impossible. You can probably still use your firmware itself to choose which bootloader you start, however.
Which boot folder? On what OS? Where is it mounted from? I believe arch typically mounts the EFI System Partition on /boot/EFI. (whereas nixos usually mounts it directly on /boot)
So, can i just reinstall NixOS in UEFI mode?
Looks like i just need to do right partition for it.
For now, I am considering the option with Chainloader, and as I understand from your words, both systems must be installed in UEFI mode. How should look partion for NixOS on UEFI mode with it own boot loader?
So, now my NixOS installed on /dev/sdb3 and i can run it through Boot menu. Last i need it’s add NixOS boot loader (Also grub) into my main Grub through chainloader.
I’am trying like this (but it didn’t work, error: can’t found /mnt/nix/.../core.efi):
The chainloader entry needs to reference the file by a reference grub can understand. Remember that when it’s following this directive, arch linux and its mount points do not exist. Grub is all there is. You’ve done the search command, setting what device absolute paths are interpreted from… but it looks like you’re looking for the wrong filesystem. Then the chainloader command isn’t specifying the path relative to the device you’ve chosen, but rather relative to arch’s root when it’s mounted on arch.
P.S. For future reference, please post actual text where possible, not pictures of text. I can’t copy and paste out of a picture, and copying a uuid out of a picture is rather annoying, even if it is a short one. Also, pictures can be hard to work with when viewing from a device with a different screen form factor, too.