1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-01-22 14:45:27 +00:00
nixpkgs/modules/system/boot/loader/grub/memtest.nix
Lluís Batlle i Rossell 358239348a making memtest grub entries work again
I'm not any good at perl, and I only came up with this after many
slow attempts. Any review welcome.

But until this, memtest was broken, and extraPrepareConfig as well, in grub.
2012-12-16 21:41:47 +01:00

39 lines
835 B
Nix

# This module allows getting memtest86 in grub menus.
{config, pkgs, ...}:
with pkgs.lib;
let
isEnabled = config.boot.loader.grub.memtest86;
memtest86 = pkgs.memtest86;
in
{
options = {
boot.loader.grub.memtest86 = mkOption {
default = false;
type = types.bool;
description = ''
Add a menu entry in grub for memtest86+
'';
};
};
config.boot.loader.grub = mkIf isEnabled {
extraEntries = if config.boot.loader.grub.version == 2 then
''
menuentry "${memtest86.name}" {
linux16 @bootRoot@/memtest.bin
}
''
else
''
menuentry "${memtest86.name}"
linux16 @bootRoot@/memtest.bin
'';
extraPrepareConfig =
''
${pkgs.coreutils}/bin/cp ${memtest86}/memtest.bin /boot/memtest.bin;
'';
};
}