nixpkgs/pkgs/tools/misc/memtest86-efi/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

65 lines
2.2 KiB
Nix
Raw Normal View History

{ stdenv
, lib
, fetchzip
2020-11-24 15:29:28 +00:00
, util-linux
, jq
, mtools
}:
2019-05-05 15:26:32 +01:00
stdenv.mkDerivation rec {
pname = "memtest86-efi";
2021-12-07 03:47:22 +00:00
version = "9.3.1000";
2019-05-05 15:26:32 +01:00
src = fetchzip {
2021-12-07 03:47:22 +00:00
# We're using the Internet Archive Wayback Machine because the company developing MemTest86 has stopped providing a versioned download link for the latest version:
# https://forums.passmark.com/memtest86/44494-version-8-1-distribution-file-is-not-versioned
url = "https://web.archive.org/web/20211111004725/https://www.memtest86.com/downloads/memtest86-usb.zip";
sha256 = "sha256-GJdZCUFw1uX4HcaaAy5QqDGNqHTFtrqla13wF7xCAaM=";
stripRoot = false;
2019-05-05 15:26:32 +01:00
};
nativeBuildInputs = [
2020-11-24 15:29:28 +00:00
util-linux
jq
mtools
];
2019-05-05 15:26:32 +01:00
installPhase = ''
runHook preInstall
2019-05-05 15:26:32 +01:00
# memtest86 is distributed as a bootable USB image. It contains the actual
# memtest86 EFI app.
#
# The following uses sfdisk to calculate the offset of the FAT EFI System
# Partition in the disk image, and mcopy to extract the actual EFI app from
# the filesystem so that it can be installed directly on the hard drive.
IMG=$src/memtest86-usb.img
ESP_OFFSET=$(sfdisk --json $IMG | jq -r '
# Partition type GUID identifying EFI System Partitions
def ESP_GUID: "C12A7328-F81F-11D2-BA4B-00A0C93EC93B";
.partitiontable |
.sectorsize * (.partitions[] | select(.type == ESP_GUID) | .start)
')
mkdir $out
mcopy -vsi $IMG@@$ESP_OFFSET ::'/EFI/BOOT/*' $out/
runHook postInstall
2019-05-05 15:26:32 +01:00
'';
meta = with lib; {
2021-12-07 03:47:22 +00:00
homepage = "https://www.memtest86.com/";
2019-05-05 15:26:32 +01:00
downloadPage = "https://www.memtest86.com/download.htm";
2021-12-07 03:47:22 +00:00
changelog = "https://www.memtest86.com/whats-new.html";
2019-05-05 15:26:32 +01:00
description = "A tool to detect memory errors, to be run from a bootloader";
longDescription = ''
2019-05-05 15:29:29 +01:00
A UEFI app that is able to detect errors in RAM. It can be run from a
2019-05-05 15:26:32 +01:00
bootloader. Released under a proprietary freeware license.
'';
2021-12-07 03:47:22 +00:00
# MemTest86 Free Edition is free to download with no restrictions on usage. However, the source code is not available.
# https://www.memtest86.com/tech_license-information.html
2019-05-05 15:26:32 +01:00
license = licenses.unfreeRedistributable;
maintainers = with maintainers; [ cdepillabout ];
platforms = platforms.linux;
};
}