blob: cd78e11e80bb33050e4031890d5f30ed93389f0f (
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
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
|
{ lib
, stdenv
, fetchurl
, autoPatchelfHook
, installShellFiles
}:
let
version = "7.01";
downloadVersion = lib.replaceStrings [ "." ] [ "" ] version;
# Use `./update.sh` to generate the entries below
srcs = {
i686-linux = {
url = "https://www.rarlab.com/rar/rarlinux-x32-${downloadVersion}.tar.gz";
hash = "sha256-1CSbxM7arGpn4Yj5fHEFKcDURFPrC2+XptLoaDH8LDs=";
};
x86_64-linux = {
url = "https://www.rarlab.com/rar/rarlinux-x64-${downloadVersion}.tar.gz";
hash = "sha256-34iWajylsSmIOuAT6kV7c2537qWFHc+gT+JT/trWrw8=";
};
aarch64-darwin = {
url = "https://www.rarlab.com/rar/rarmacos-arm-${downloadVersion}.tar.gz";
hash = "sha256-BjEJFzKyRpN4XL6KYW7ykQcSxqF4tYr2dCFf50JHH38=";
};
x86_64-darwin = {
url = "https://www.rarlab.com/rar/rarmacos-x64-${downloadVersion}.tar.gz";
hash = "sha256-1ExnVDre49wWwB/BKP/L9xdYOMx8qkeZfmObJ7xm4dY=";
};
};
manSrc = fetchurl {
url = "https://aur.archlinux.org/cgit/aur.git/plain/rar.1?h=rar&id=8e39a12e88d8a3b168c496c44c18d443c876dd10";
name = "rar.1";
hash = "sha256-93cSr9oAsi+xHUtMsUvICyHJe66vAImS2tLie7nt8Uw=";
};
in
stdenv.mkDerivation {
pname = "rar";
inherit version;
src = fetchurl (srcs.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}"));
dontBuild = true;
buildInputs = lib.optionals stdenv.isLinux [ stdenv.cc.cc.lib ];
nativeBuildInputs = [ installShellFiles ]
++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
installPhase = ''
runHook preInstall
install -Dm755 {rar,unrar} -t "$out/bin"
install -Dm755 default.sfx -t "$out/lib"
install -Dm644 {acknow.txt,license.txt} -t "$out/share/doc/rar"
install -Dm644 rarfiles.lst -t "$out/etc"
runHook postInstall
'';
postInstall = ''
installManPage ${manSrc}
'';
passthru.updateScript = ./update.sh;
meta = with lib; {
description = "Utility for RAR archives";
homepage = "https://www.rarlab.com/";
license = licenses.unfree;
mainProgram = "rar";
maintainers = with maintainers; [ thiagokokada ];
platforms = lib.attrNames srcs;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
};
}
|