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;
|
2012-04-09 22:37:54 +02:00
|
|
|
memtest86 = pkgs.memtest86;
|
2012-04-02 19:19:21 +02:00
|
|
|
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 {
|
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-04-02 19:19:21 +02:00
|
|
|
linux16 $bootRoot/memtest.bin
|
|
|
|
}
|
2012-04-11 00:20:20 +02:00
|
|
|
''
|
|
|
|
else
|
|
|
|
''
|
|
|
|
menuentry "${memtest86.name}"
|
|
|
|
linux16 $bootRoot/memtest.bin
|
2012-04-02 19:19:21 +02:00
|
|
|
'';
|
|
|
|
extraPrepareConfig =
|
|
|
|
''
|
2012-04-09 22:37:54 +02:00
|
|
|
cp ${memtest86}/memtest.bin /boot/memtest.bin;
|
2012-04-02 19:19:21 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|