efi-boot-stub: enable hook for running (fixup) commands after efibootmgr run

This commit is contained in:
Mathijs Kwik 2012-12-28 11:21:39 +01:00
parent 9b7ce4a1b5
commit a3ee9aac98
2 changed files with 19 additions and 1 deletions

View file

@ -122,3 +122,10 @@ for fn in "@efiSysMountPoint@/efi/nixos/"*; do
rm -vf -- "$fn"
fi
done
# Run any extra commands users may need
if test -n "@runEfibootmgr@"; then
set +e
@postEfiBootMgrCommands@
set -e
fi

View file

@ -8,7 +8,7 @@ let
isExecutable = true;
inherit (pkgs) bash;
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.glibc] ++ (pkgs.stdenv.lib.optionals config.boot.loader.efiBootStub.runEfibootmgr [pkgs.efibootmgr pkgs.module_init_tools]);
inherit (config.boot.loader.efiBootStub) efiSysMountPoint runEfibootmgr installStartupNsh efiDisk efiPartition;
inherit (config.boot.loader.efiBootStub) efiSysMountPoint runEfibootmgr installStartupNsh efiDisk efiPartition postEfiBootMgrCommands;
efiShell = if config.boot.loader.efiBootStub.installShell then
if pkgs.stdenv.isi686 then
@ -103,6 +103,17 @@ in
'';
};
postEfiBootMgrCommands = mkOption {
default = "";
type = types.string;
description = ''
Shell commands to be executed immediately after efibootmgr has setup the system EFI.
Some systems do not follow the EFI specifications properly and insert extra entries.
Others will brick (fix by removing battery) on boot when it finds more than X entries.
This hook allows for running a few extra efibootmgr commands to combat these issues.
'';
};
};
};
};