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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
{
lib,
stdenv,
fetchFromGitHub,
# nativeBuildInputs
nasm,
autoreconfHook,
versionCheckHook,
# passthru
runCommand,
nix,
pkgs,
gitUpdater,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "isa-l";
version = "2.31.1";
src = fetchFromGitHub {
owner = "intel";
repo = "isa-l";
tag = "v${finalAttrs.version}";
hash = "sha256-pv0Aq1Yp/NkGN7KXJ4oQMSG36k5v9YnsELuATl86Zp4=";
};
nativeBuildInputs = [
nasm
autoreconfHook
];
preConfigure = ''
export AS=nasm
'';
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgram = "${placeholder "out"}/bin/igzip";
versionCheckProgramArg = "--version";
doInstallCheck = true;
passthru = {
tests = {
igzip =
runCommand "test-isa-l-igzip"
{
nativeBuildInputs = [
finalAttrs.finalPackage
];
sample =
runCommand "nixpkgs-lib.nar"
{
nativeBuildInputs = [ nix ];
}
''
nix nar --extra-experimental-features nix-command pack ${pkgs.path + "/lib"} > "$out"
'';
meta = {
description = "Cross validation of igzip provided by isa-l with gzip";
};
}
''
HASH_ORIGINAL="$(cat "$sample" | sha256sum | cut -d" " -f1)"
HASH_COMPRESSION_TEST="$(igzip -c "$sample" | gzip -d -c | sha256sum | cut -d" " -f1)"
HASH_DECOMPRESSION_TEST="$(gzip -c "$sample" | igzip -d -c | sha256sum | cut -d" " -f1)"
if [[ "$HASH_COMPRESSION_TEST" != "$HASH_ORIGINAL" ]] || [[ "$HASH_DECOMPRESSION_TEST" != "$HASH_ORIGINAL" ]]; then
if [[ "HASH_COMPRESSION_TEST" != "$HASH_ORIGINAL" ]]; then
echo "The igzip-compressed file does not decompress to the original file." 1>&2
fi
if [[ "HASH_DECOMPRESSION_TEST" != "$HASH_ORIGINAL" ]]; then
echo "igzip does not decompress the gzip-compressed archive to the original file." 1>&2
fi
echo "SHA256 checksums:" 1>&2
printf ' original file:\t%s\n' "$HASH_ORIGINAL" 1>&2
printf ' compression test:\t%s\n' "$HASH_COMPRESSION_TEST" 1>&2
printf ' decompression test:\t%s\n' "$HASH_DECOMPRESSION_TEST" 1>&2
exit 1
fi
touch "$out"
'';
};
updateScript = gitUpdater { rev-prefix = "v"; };
};
meta = {
description = "Collection of optimised low-level functions targeting storage applications";
mainProgram = "igzip";
license = lib.licenses.bsd3;
homepage = "https://github.com/intel/isa-l";
changelog = "https://github.com/intel/isa-l/releases/tag/v${finalAttrs.version}";
maintainers = with lib.maintainers; [ jbedo ];
platforms = lib.platforms.all;
badPlatforms = [
# <instantiation>:4:26: error: unexpected token in argument list
# movk x7, p4_low_b1, lsl 16
"aarch64-darwin"
];
};
})
|