From 4f799dbf20f793e438f8800b2e9d86db64824a5b Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Wed, 1 May 2024 23:13:50 +0200 Subject: [PATCH] sysd boot --- configuration.nix | 2 +- system-modules/boot.nix | 65 +++++++++++++++++++++++++++++++++++++++++ system-modules/grub.nix | 44 ---------------------------- 3 files changed, 66 insertions(+), 45 deletions(-) create mode 100644 system-modules/boot.nix delete mode 100644 system-modules/grub.nix diff --git a/configuration.nix b/configuration.nix index 67c6c32..0cfe8a2 100644 --- a/configuration.nix +++ b/configuration.nix @@ -8,7 +8,7 @@ in ./system-modules/nvidia.nix # only does stuff if nvidia.enabled ./system-modules/users.nix ./system-modules/sound.nix - ./system-modules/grub.nix + ./system-modules/boot.nix ./system-modules/dm.nix ./system-modules/networking.nix ./system-modules/virtualisation.nix diff --git a/system-modules/boot.nix b/system-modules/boot.nix new file mode 100644 index 0000000..8397542 --- /dev/null +++ b/system-modules/boot.nix @@ -0,0 +1,65 @@ +{ config, pkgs, host, inputs, ... }: + let + grub-theme-ascii-diana = (pkgs.fetchFromGitea { + domain = "git.nx2.site"; + owner = "nx2"; + repo = "grub-theme-ascii-diana"; + rev = "0.5.0"; + hash = "sha256-e+55NYsSsWY6GPbYUtdVEB9krueuCAWT3Ce/Ghops1g="; + }); + in +{ + config = if host == "NxXPS" then { + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.grub = { + enable = true; + configurationLimit = 30; + # device = "/dev/nvme0n1p1"; + device = "nodev"; + # useOSProber = true; + efiSupport = true; + # theme = pkgs.sleek-grub-theme; + theme = grub-theme-ascii-diana; + font = "${grub-theme-ascii-diana}/unicode.pf2"; + fontSize = 50; + splashImage = null; + + extraEntries = '' + menuentry 'Windows 11' --class windows --class os $menuentry_id_option 'osprober-efi-0A97-7A2D' { + insmod part_gpt + insmod fat + search --no-floppy --fs-uuid --set=root 0A97-7A2D + chainloader /EFI/Microsoft/Boot/bootmgfw.efi + } + ''; + }; + } else { + boot.loader = { + systemd-boot = { + enable = true; + configurationLimit = 10; + }; + timeout = 30; + }; + + + + # I have to boot with secureboot becasue of the chineese spyware called Vanguard + # imports = [ + # inputs.lanzaboote.nixosModules.lanzaboote + # ]; + + # environment.systemPackages = with pkgs; [ + # sbctl + # ]; + # boot = { + # lanzaboote = { + # enable = true; + # pkiBundle = "/etc/secureboot"; + # }; + + # # we let lanzaboote install systemd-boot + # loader.systemd-boot.enable = false; + # }; + }; +} \ No newline at end of file diff --git a/system-modules/grub.nix b/system-modules/grub.nix deleted file mode 100644 index 5c30456..0000000 --- a/system-modules/grub.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ config, pkgs, host, ... }: - let - grub-theme-ascii-diana = (pkgs.fetchFromGitea { - domain = "git.nx2.site"; - owner = "nx2"; - repo = "grub-theme-ascii-diana"; - rev = "0.5.0"; - hash = "sha256-e+55NYsSsWY6GPbYUtdVEB9krueuCAWT3Ce/Ghops1g="; - }); - in -{ - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.grub = { - enable = true; - configurationLimit = 30; -# device = "/dev/nvme0n1p1"; - device = "nodev"; - # useOSProber = true; - efiSupport = true; - # theme = pkgs.sleek-grub-theme; - theme = grub-theme-ascii-diana; - font = "${grub-theme-ascii-diana}/unicode.pf2"; - fontSize = 50; - splashImage = null; - - extraEntries = if host == "NxXPS" then '' - menuentry 'Windows 11' --class windows --class os $menuentry_id_option 'osprober-efi-0A97-7A2D' { - insmod part_gpt - insmod fat - search --no-floppy --fs-uuid --set=root 0A97-7A2D - chainloader /EFI/Microsoft/Boot/bootmgfw.efi - } - '' else '' - menuentry 'Windows 11' --class windows --class os $menuentry_id_option 'osprober-efi-8932-4A3D' { - insmod part_gpt - insmod fat - search --no-floppy --label --set=root EFI - chainloader /EFI/Microsoft/Boot/bootmgfw.efi - } - ''; - }; -} - -