From 35d4378e74c0b40d1d399ce9e8e6c5d6a79bdb65 Mon Sep 17 00:00:00 2001 From: Qubasa Date: Sun, 21 Apr 2024 21:25:18 +0200 Subject: [PATCH] Add EF02 priority=1 flag. Systems won't boot otherwise --- docs/disko-install.md | 52 ++++++++++++++++++-------------- example/boot-raid1.nix | 1 + example/gpt-bios-compat.nix | 1 + example/hybrid-tmpfs-on-root.nix | 1 + example/hybrid.nix | 1 + example/luks-on-mdadm.nix | 1 + example/mdadm-raid0.nix | 2 ++ example/mdadm.nix | 1 + example/with-lib.nix | 1 + 9 files changed, 39 insertions(+), 22 deletions(-) diff --git a/docs/disko-install.md b/docs/disko-install.md index da5fb5b..bec4f98 100644 --- a/docs/disko-install.md +++ b/docs/disko-install.md @@ -1,10 +1,12 @@ # disko-install -**disko-install** enhances the normal `nixos-install` with disko's partitioning feature. -It can be started from the NixOS installer but it can also be used to create bootable USB-Sticks from your normal workstation. -Furthermore `disko-install` has a mount mode that will only mount but not destroy existing partitions. -The mount mode can be used to mount and repair existing NixOS installations. -This document provides a comprehensive guide on how to use **disko-install**, including examples for typical usage scenarios. +**disko-install** enhances the normal `nixos-install` with disko's partitioning +feature. It can be started from the NixOS installer but it can also be used to +create bootable USB-Sticks from your normal workstation. Furthermore +`disko-install` has a mount mode that will only mount but not destroy existing +partitions. The mount mode can be used to mount and repair existing NixOS +installations. This document provides a comprehensive guide on how to use +**disko-install**, including examples for typical usage scenarios. ## Requirements @@ -16,7 +18,8 @@ This document provides a comprehensive guide on how to use **disko-install**, in ### Fresh Installation -For a fresh installation, where **disko-install** will handle partitioning and setting up the disk, use the following syntax: +For a fresh installation, where **disko-install** will handle partitioning and +setting up the disk, use the following syntax: ```console sudo nix run 'github:nix-community/disko#disko-install' -- --flake # --disk @@ -24,11 +27,11 @@ sudo nix run 'github:nix-community/disko#disko-install' -- --flake #< Example: -First run `nixos-generate-config --root /tmp/config --no-filesystems` and -edit `configuration.nix` to your liking. +First run `nixos-generate-config --root /tmp/config --no-filesystems` and edit +`configuration.nix` to your liking. -Than add the following `flake.nix` inside `/tmp/config/etc/nixos`. -In this example we assume a system that has been booted with EFI: +Than add the following `flake.nix` inside `/tmp/config/etc/nixos`. In this +example we assume a system that has been booted with EFI: ```nix { @@ -53,6 +56,7 @@ In this example we assume a system that has been booted with EFI: MBR = { type = "EF02"; # for grub MBR size = "1M"; + priority = 1; # Needs to be first partition }; ESP = { type = "EF00"; @@ -105,8 +109,8 @@ In our example, we want to install to a USB-stick (/dev/sda): $ sudo nix run 'github:nix-community/disko#disko-install' -- --flake '/tmp/config/etc/nixos#mymachine' --disk main /dev/sda ``` -Afterwards you can test your USB-stick by either selecting during the boot -or attaching it to a qemu-vm: +Afterwards you can test your USB-stick by either selecting during the boot or +attaching it to a qemu-vm: ``` $ sudo qemu-kvm -enable-kvm -hda /dev/sda @@ -114,23 +118,25 @@ $ sudo qemu-kvm -enable-kvm -hda /dev/sda ### Persisting boot entries to EFI vars flash -**disko-install** is designed for NixOS installations on portable storage or disks that may be transferred between computers. -As such, it does not modify the host's NVRAM by default. -To ensure your NixOS installation boots seamlessly on new hardware or to prioritize it in your current machine's boot order, -use the --write-efi-boot-entries option: +**disko-install** is designed for NixOS installations on portable storage or +disks that may be transferred between computers. As such, it does not modify the +host's NVRAM by default. To ensure your NixOS installation boots seamlessly on +new hardware or to prioritize it in your current machine's boot order, use the +--write-efi-boot-entries option: ```console $ sudo nix run 'github:nix-community/disko#disko-install' -- --write-efi-boot-entries --flake '/tmp/config/etc/nixos#mymachine' --disk main /dev/sda ``` -This command installs NixOS with **disko-install** and sets the newly installed system as the default boot option, -without affecting the flexibility to boot from other devices if needed. +This command installs NixOS with **disko-install** and sets the newly installed +system as the default boot option, without affecting the flexibility to boot +from other devices if needed. ### Using disko-install in an offline installer -If you want to **disko-install** from a customer installer without internet, you need to make sure that -next the toplevel of your NixOS closure that you plan to install, it also needs **diskoScript** and -all the flake inputs for evaluation. +If you want to **disko-install** from a customer installer without internet, you +need to make sure that next the toplevel of your NixOS closure that you plan to +install, it also needs **diskoScript** and all the flake inputs for evaluation. #### Example configuration to install @@ -212,4 +218,6 @@ in } ``` -Also see the [NixOS test of disko-install](https://github.com/nix-community/disko/blob/master/tests/disko-install/default.nix) that also runs without internet. +Also see the +[NixOS test of disko-install](https://github.com/nix-community/disko/blob/master/tests/disko-install/default.nix) +that also runs without internet. diff --git a/example/boot-raid1.nix b/example/boot-raid1.nix index 39569c1..f0e3fc9 100644 --- a/example/boot-raid1.nix +++ b/example/boot-raid1.nix @@ -38,6 +38,7 @@ boot = { size = "1M"; type = "EF02"; # for grub MBR + priority = 1; # Needs to be first partition }; ESP = { size = "500M"; diff --git a/example/gpt-bios-compat.nix b/example/gpt-bios-compat.nix index f0e8f97..cfdee70 100644 --- a/example/gpt-bios-compat.nix +++ b/example/gpt-bios-compat.nix @@ -11,6 +11,7 @@ boot = { size = "1M"; type = "EF02"; # for grub MBR + priority = 1; # Needs to be first partition }; root = { size = "100%"; diff --git a/example/hybrid-tmpfs-on-root.nix b/example/hybrid-tmpfs-on-root.nix index 308f7bf..e3f5686 100644 --- a/example/hybrid-tmpfs-on-root.nix +++ b/example/hybrid-tmpfs-on-root.nix @@ -9,6 +9,7 @@ boot = { size = "1M"; type = "EF02"; # for grub MBR + priority = 1; # Needs to be first partition }; ESP = { name = "ESP"; diff --git a/example/hybrid.nix b/example/hybrid.nix index 50176e0..d03487c 100644 --- a/example/hybrid.nix +++ b/example/hybrid.nix @@ -10,6 +10,7 @@ boot = { size = "1M"; type = "EF02"; # for grub MBR + priority = 1; # Needs to be first partition }; ESP = { size = "512M"; diff --git a/example/luks-on-mdadm.nix b/example/luks-on-mdadm.nix index 6a33208..c1587fc 100644 --- a/example/luks-on-mdadm.nix +++ b/example/luks-on-mdadm.nix @@ -9,6 +9,7 @@ boot = { size = "1M"; type = "EF02"; # for grub MBR + priority = 1; # Needs to be first partition }; ESP = { size = "500M"; diff --git a/example/mdadm-raid0.nix b/example/mdadm-raid0.nix index 519116c..a7c6dc1 100644 --- a/example/mdadm-raid0.nix +++ b/example/mdadm-raid0.nix @@ -10,6 +10,7 @@ boot = { size = "1M"; type = "EF02"; # for grub MBR + priority = 1; # Needs to be first partition }; mdadm = { size = "100%"; @@ -30,6 +31,7 @@ boot = { size = "1M"; type = "EF02"; # for grub MBR + priority = 1; # Needs to be first partition }; mdadm = { size = "100%"; diff --git a/example/mdadm.nix b/example/mdadm.nix index 33faac9..4c170d2 100644 --- a/example/mdadm.nix +++ b/example/mdadm.nix @@ -10,6 +10,7 @@ boot = { size = "1M"; type = "EF02"; # for grub MBR + priority = 1; # Needs to be first partition }; mdadm = { size = "100%"; diff --git a/example/with-lib.nix b/example/with-lib.nix index 5558fac..67714c5 100644 --- a/example/with-lib.nix +++ b/example/with-lib.nix @@ -11,6 +11,7 @@ boot = { size = "1M"; type = "EF02"; + priority = 1; # Needs to be first partition }; root = { size = "100%";