about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/archivers/7zz/default.nix
blob: 63e603353409efd1b04dcef44d19d20f6a2f8e55 (plain) (blame)
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
{ lib, stdenv, fetchurl, autoPatchelfHook }:

let platform =       if stdenv.isi686    then "x86"
                else if stdenv.isx86_64  then "x64"
                else if stdenv.isAarch32 then "arm"
                else if stdenv.isAarch64 then "arm64"
                else throw "Unsupported architecture";

    url = "https://7-zip.org/a/7z2101-linux-${platform}.tar.xz";

    hashes = {
      x86 = "0k6vg85ld8i2pcv5sv3xbvf3swqh9qj8hf2jcpadssys3yyidqyj";
      x64 = "1yfanx98fizj8d2s87yxgsy30zydx7h5w9wf4wy3blgsp0vkbjb3";
      arm = "04iah9vijm86r8rbkhxig86fx3lpag4xi7i3vq7gfrlwkymclhm1";
      arm64 = "0a26ginpb22aydcyvffxpbi7lxh4sgs9gb6cj96qqx7cnf7bk2ri";
    };
    sha256 = hashes."${platform}";

in stdenv.mkDerivation {
  pname = "7zz";
  version = "21.01";

  src = fetchurl { inherit url sha256; };
  sourceRoot = ".";

  nativeBuildInputs = [ autoPatchelfHook ];
  buildInputs = [ stdenv.cc.cc.lib ];

  dontBuild = true;

  installPhase = ''
    runHook preInstall
    install -D -t $out/bin 7zz
    runHook postInstall
  '';

  meta = with lib; {
    description = "Command line archiver utility";
    homepage = "https://www.7-zip.org";

    # source not released yet. will be under LGPL 2.1+ with RAR exception
    license = licenses.unfree;

    platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" ];
    maintainers = with maintainers; [ anna328p ];
  };
}