Experimental legacy boot autoinstall

This commit is contained in:
Emmet 2024-02-29 20:48:15 -06:00
parent 4f676b1057
commit e858bfefa2
4 changed files with 13 additions and 4 deletions

View file

@ -14,6 +14,8 @@
timezone = "America/Chicago"; # select timezone
locale = "en_US.UTF-8"; # select locale
bootMode = "uefi"; # uefi or bios
bootMountPath = "/boot"; # mount path for efi boot partition; only used for uefi boot mode
grubDevice = ""; # device identifier for grub; only used for legacy (bios) boot mode
};
# ----- USER SETTINGS ----- #

View file

@ -13,6 +13,8 @@ if [ -d /sys/firmware/efi/efivars ]; then
sed -i "0,/bootMode.*=.*\".*\";/s//bootMode = \"uefi\";/" ~/.dotfiles/flake.nix
else
sed -i "0,/bootMode.*=.*\".*\";/s//bootMode = \"bios\";/" ~/.dotfiles/flake.nix
grubDevice=$(findmnt / | awk -F' ' '{ print $2 }' | sed 's/\[.*\]//g' | tail -n 1 | lsblk -no pkname | tail -n 1 )
sed -i "0,/grubDevice.*=.*\".*\";/s//grubDevice = \"\/dev\/$grubDevice\";/" ~/.dotfiles/flake.nix
fi
# Patch flake.nix with different username/name and remove email by default

View file

@ -28,9 +28,12 @@
boot.kernelModules = [ "i2c-dev" "i2c-piix4" ];
# Bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot";
# Use systemd-boot if uefi, default to grub otherwise
boot.loader.systemd-boot.enable = if (systemSettings.bootMode == "uefi") then true else false;
boot.loader.efi.canTouchEfiVariables = if (systemSettings.bootMode == "uefi") then true else false;
boot.loader.efi.efiSysMountPoint = systemSettings.bootMountPath; # does nothing if running bios rather than uefi
boot.loader.grub.enable = if (systemSettings.bootMode == "uefi") then false else true;
boot.loader.grub.device = systemSettings.grubDevice; # does nothing if running uefi rather than bios
# Networking
networking.hostName = systemSettings.hostname; # Define your hostname.

View file

@ -49,7 +49,9 @@
# Use systemd-boot if uefi, default to grub otherwise
boot.loader.systemd-boot.enable = if (systemSettings.bootMode == "uefi") then true else false;
boot.loader.efi.canTouchEfiVariables = if (systemSettings.bootMode == "uefi") then true else false;
boot.loader.efi.efiSysMountPoint = "/boot"; # does nothing if running bios rather than uefi
boot.loader.efi.efiSysMountPoint = systemSettings.bootMountPath; # does nothing if running bios rather than uefi
boot.loader.grub.enable = if (systemSettings.bootMode == "uefi") then false else true;
boot.loader.grub.device = systemSettings.grubDevice; # does nothing if running uefi rather than bios
# Networking
networking.hostName = systemSettings.hostname; # Define your hostname.