Allow enabling Secure Boot

This commit is contained in:
Manuel Thalmann 2024-09-20 00:56:56 +02:00
parent 3e759da1cd
commit 6d7ab10559
5 changed files with 56 additions and 2 deletions

View file

@ -25,7 +25,20 @@
];
};
linuxVariant = osVariant.extendModules { };
linuxVariant = osVariant.extendModules {
modules = [
({ ... }: {
options = {
secureBoot = mkOption {
type = types.bool;
description = "A value indicating whether the system supports Secure Boot.";
default = false;
};
};
})
];
};
windowsVariant = osVariant.extendModules { };
in {
options = {

View file

@ -6,6 +6,7 @@
config = {
valhalla = {
hostname = lib.mkDefault "der-geret";
linux.secureBoot = true;
windows = {
dualboot = {

View file

@ -6,6 +6,7 @@
config = {
valhalla = {
hostname = "manu-surface";
linux.secureBoot = true;
partition.os.deviceName = "nvme0n1";
};
};

View file

@ -0,0 +1,35 @@
#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../Scripts/software.fish"
function installSW -V dir
yayinst secureboot-grub
end
function configureSW -V dir
source "$dir/../../../Common/Scripts/config.fish"
set -l label (getConfig valhalla.boot.label)
set -l efiDir (getConfig valhalla.boot.efiMountPoint)
set -l bootNums (efibootmgr | sed "/$label/{ s/^.*Boot\([[:digit:]]\+\)\*.*\$/\1/; p; }; d")
for bootNum in $bootNums
sudo efibootmgr --delete-bootnum --bootnum $bootNum
end
sudo sed -i \
-e "/esp=/{" \
-e "a esp=\"$efiDir\"" \
-e "d" \
-e "}" \
-e "/bootloader_id=/{" \
-e "a bootloader_id=\"$label\"" \
-e "d" \
-e "}" \
/etc/secureboot.conf
sudo secure-grub-install
end
runInstaller $argv
end

View file

@ -14,7 +14,11 @@ function deploySoftware -d "Deploys a the specified software action" -a action
end
)
if collectionActive essential
if getConfig valhalla.linux.secureBoot --json | jq --exit-status > /dev/null
source "$dir/../Config/SecureBoot/main.fish" $argv
end
and if collectionActive essential
if $isInstall
yayinst \
mkinitcpio-firmware \