summary refs log tree commit diff
path: root/modules/system/boot/loader/grub/memtest.nix
blob: 006d777b120163af11014bfa1cc88c7a2b99ba8b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# This module adds Memtest86+ to the GRUB boot menu.

{ config, pkgs, ... }:

with pkgs.lib;

let
  memtest86 = pkgs.memtest86plus;
in

{
  options = {

    boot.loader.grub.memtest86 = mkOption {
      default = false;
      type = types.bool;
      description = ''
        Make Memtest86+, a memory testing program, available from the
        GRUB boot menu.
      '';
    };
  };

  config = mkIf config.boot.loader.grub.memtest86 {

    boot.loader.grub.extraEntries =
      if config.boot.loader.grub.version == 2 then
        ''
          menuentry "Memtest86+" {
            linux16 @bootRoot@/memtest.bin
          }
        ''
      else
        ''
          menuentry "Memtest86+"
            linux16 @bootRoot@/memtest.bin
        '';

    boot.loader.grub.extraFiles."memtest.bin" = "${memtest86}/memtest.bin";

  };
}