2012-04-09 22:37:54 +02:00
|
|
|
# This module allows getting memtest86 in grub menus.
|
2012-04-02 19:19:21 +02:00
|
|
|
|
|
|
|
{config, pkgs, ...}:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
let
|
|
|
|
isEnabled = config.boot.loader.grub.memtest86;
|
2013-01-09 22:44:50 +01:00
|
|
|
memtest86 = pkgs.memtest86plus;
|
2012-04-02 19:19:21 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
boot.loader.grub.memtest86 = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = ''
|
2013-01-22 19:25:14 +01:00
|
|
|
Make Memtest86+, a memory testing program, available from the
|
|
|
|
GRUB menu.
|
2012-04-02 19:19:21 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config.boot.loader.grub = mkIf isEnabled {
|
2012-04-11 00:20:20 +02:00
|
|
|
extraEntries = if config.boot.loader.grub.version == 2 then
|
2012-04-02 19:19:21 +02:00
|
|
|
''
|
2012-04-09 22:37:54 +02:00
|
|
|
menuentry "${memtest86.name}" {
|
2012-12-16 21:41:47 +01:00
|
|
|
linux16 @bootRoot@/memtest.bin
|
2012-04-02 19:19:21 +02:00
|
|
|
}
|
2012-04-11 00:20:20 +02:00
|
|
|
''
|
|
|
|
else
|
|
|
|
''
|
|
|
|
menuentry "${memtest86.name}"
|
2012-12-16 21:41:47 +01:00
|
|
|
linux16 @bootRoot@/memtest.bin
|
2012-04-02 19:19:21 +02:00
|
|
|
'';
|
|
|
|
extraPrepareConfig =
|
|
|
|
''
|
2012-12-16 21:41:47 +01:00
|
|
|
${pkgs.coreutils}/bin/cp ${memtest86}/memtest.bin /boot/memtest.bin;
|
2012-04-02 19:19:21 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|