summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/me/memtest86plus/package.nix
blob: 0d94df1bc8bf06149c24c408a3ce898dac7a9db7 (plain)
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
43
44
45
46
{
  lib,
  stdenv,
  fetchFromGitHub,
  nixosTests,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "memtest86+";
  version = "8.10";

  src = fetchFromGitHub {
    owner = "memtest86plus";
    repo = "memtest86plus";
    rev = "v${finalAttrs.version}";
    hash = "sha256-gRJmPrJGxb5c2fQxVBL/TFplQpmqHw98MUrWzJKpct0=";
  };

  # Binaries are booted directly by BIOS/UEFI or bootloader
  # and should not be patched/stripped
  dontPatchELF = true;
  dontStrip = true;

  passthru.efi = "${finalAttrs.finalPackage}/mt86plus.efi";

  preBuild = ''
    cd build/${if stdenv.hostPlatform.isi686 then "i586" else "x86_64"}
  '';

  installPhase = ''
    install -Dm0444 mt86plus $out/mt86plus.efi
  '';

  passthru.tests.systemd-boot-memtest = nixosTests.systemd-boot.memtest86;

  meta = {
    homepage = "https://www.memtest.org/";
    description = "Tool to detect memory errors";
    license = lib.licenses.gpl2Only;
    platforms = [
      "x86_64-linux"
      "i686-linux"
    ];
    maintainers = [ lib.maintainers.LunNova ];
  };
})