From ccf9b1cf4df79309d44a20f002a055441c4729eb Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 7 Jun 2024 10:40:37 +0200 Subject: [PATCH] Add documentation section about GRUB chain loading --- doc/install.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/doc/install.md b/doc/install.md index d5e279dd..cee67c9c 100644 --- a/doc/install.md +++ b/doc/install.md @@ -150,3 +150,27 @@ And update grub. ``` # nix build .#nixosConfigurations.xeon02.config.system.build.kexecTree -v ``` + +## Chain NixOS in same disk with other systems + +To install NixOS on a partition along another system which controls the GRUB, +first disable the grub device, so the GRUB is not installed in the disk by +NixOS (only the /boot files will be generated): + +``` +boot.loader.grub.device = "nodev"; +``` + +Then add the following entry to the old GRUB configuration: + +``` +menuentry 'NixOS' { + insmod chain + search --no-floppy --label nixos --set root + configfile /boot/grub/grub.cfg +} +``` + +The partition with NixOS must have the label "nixos" for it to be found. New +system configuration entries will be stored in the GRUB configuration managed +by NixOS, so there is no need to change the old GRUB settings.