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