2020-05-03 01:49:30 +01:00
{ stdenv
, lib
, fetchzip
2020-11-24 15:29:28 +00:00
, util-linux
2020-05-03 01:49:30 +01:00
, jq
, mtools
} :
2019-05-05 15:26:32 +01:00
stdenv . mkDerivation rec {
pname = " m e m t e s t 8 6 - e f i " ;
2021-12-07 03:47:22 +00:00
version = " 9 . 3 . 1 0 0 0 " ;
2019-05-05 15:26:32 +01:00
2019-10-05 07:57:58 +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 = " h t t p s : / / w e b . a r c h i v e . o r g / w e b / 2 0 2 1 1 1 1 1 0 0 4 7 2 5 / h t t p s : / / w w w . m e m t e s t 8 6 . c o m / d o w n l o a d s / m e m t e s t 8 6 - u s b . z i p " ;
sha256 = " s h a 2 5 6 - G J d Z C U F w 1 u X 4 H c a a A y 5 Q q D G N q H T F t r q l a 1 3 w F 7 x C A a M = " ;
2019-10-05 07:57:58 +01:00
stripRoot = false ;
2019-05-05 15:26:32 +01:00
} ;
2020-05-03 01:49:30 +01:00
nativeBuildInputs = [
2020-11-24 15:29:28 +00:00
util-linux
2020-05-03 01:49:30 +01:00
jq
mtools
] ;
2019-05-05 15:26:32 +01:00
installPhase = ''
2021-02-23 09:06:19 +00:00
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.
#
2020-05-03 01:49:30 +01:00
# 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 : " C 1 2 A 7 3 2 8 - F 8 1 F - 1 1 D 2 - B A 4 B - 0 0 A 0 C 9 3 E C 9 3 B " ;
. partitiontable |
. sectorsize * ( . partitions [ ] | select ( . type == ESP_GUID ) | . start )
' )
mkdir $ out
mcopy - vsi $ IMG @ @ $ ESP_OFFSET : : ' /EFI/BOOT /* ' $ o u t /
2021-02-23 09:06:19 +00:00
runHook postInstall
2019-05-05 15:26:32 +01:00
'' ;
meta = with lib ; {
2021-12-07 03:47:22 +00:00
homepage = " h t t p s : / / w w w . m e m t e s t 8 6 . c o m / " ;
2019-05-05 15:26:32 +01:00
downloadPage = " h t t p s : / / w w w . m e m t e s t 8 6 . c o m / d o w n l o a d . h t m " ;
2021-12-07 03:47:22 +00:00
changelog = " h t t p s : / / w w w . m e m t e s t 8 6 . c o m / w h a t s - n e w . h t m l " ;
2019-05-05 15:26:32 +01:00
description = " A t o o l t o d e t e c t m e m o r y e r r o r s , t o b e r u n f r o m a b o o t l o a d e r " ;
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 ;
} ;
}