2024-01-13 08:15:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, autoPatchelfHook
|
|
|
|
, installShellFiles
|
|
|
|
}:
|
2021-10-01 09:20:50 +00:00
|
|
|
|
|
|
|
let
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "7.01";
|
2022-03-30 09:31:56 +00:00
|
|
|
downloadVersion = lib.replaceStrings [ "." ] [ "" ] version;
|
2024-01-13 08:15:51 +00:00
|
|
|
# Use `./update.sh` to generate the entries below
|
|
|
|
srcs = {
|
2021-10-04 12:37:57 +00:00
|
|
|
i686-linux = {
|
2022-03-30 09:31:56 +00:00
|
|
|
url = "https://www.rarlab.com/rar/rarlinux-x32-${downloadVersion}.tar.gz";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-1CSbxM7arGpn4Yj5fHEFKcDURFPrC2+XptLoaDH8LDs=";
|
2021-10-04 12:37:57 +00:00
|
|
|
};
|
|
|
|
x86_64-linux = {
|
2022-03-30 09:31:56 +00:00
|
|
|
url = "https://www.rarlab.com/rar/rarlinux-x64-${downloadVersion}.tar.gz";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-34iWajylsSmIOuAT6kV7c2537qWFHc+gT+JT/trWrw8=";
|
2022-03-30 09:31:56 +00:00
|
|
|
};
|
|
|
|
aarch64-darwin = {
|
|
|
|
url = "https://www.rarlab.com/rar/rarmacos-arm-${downloadVersion}.tar.gz";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-BjEJFzKyRpN4XL6KYW7ykQcSxqF4tYr2dCFf50JHH38=";
|
2021-10-04 12:37:57 +00:00
|
|
|
};
|
|
|
|
x86_64-darwin = {
|
2022-03-30 09:31:56 +00:00
|
|
|
url = "https://www.rarlab.com/rar/rarmacos-x64-${downloadVersion}.tar.gz";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-1ExnVDre49wWwB/BKP/L9xdYOMx8qkeZfmObJ7xm4dY=";
|
2021-10-04 12:37:57 +00:00
|
|
|
};
|
2024-01-13 08:15:51 +00:00
|
|
|
};
|
2021-10-01 09:20:50 +00:00
|
|
|
manSrc = fetchurl {
|
|
|
|
url = "https://aur.archlinux.org/cgit/aur.git/plain/rar.1?h=rar&id=8e39a12e88d8a3b168c496c44c18d443c876dd10";
|
|
|
|
name = "rar.1";
|
2022-09-09 14:08:57 +00:00
|
|
|
hash = "sha256-93cSr9oAsi+xHUtMsUvICyHJe66vAImS2tLie7nt8Uw=";
|
2021-10-01 09:20:50 +00:00
|
|
|
};
|
|
|
|
in
|
2024-01-13 08:15:51 +00:00
|
|
|
stdenv.mkDerivation {
|
2021-10-01 09:20:50 +00:00
|
|
|
pname = "rar";
|
|
|
|
inherit version;
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
src = fetchurl (srcs.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}"));
|
2021-10-01 09:20:50 +00:00
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [ stdenv.cc.cc.lib ];
|
2021-10-01 09:20:50 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ]
|
|
|
|
++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
|
2021-10-01 09:20:50 +00:00
|
|
|
|
|
|
|
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}
|
|
|
|
'';
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
2021-10-01 09:20:50 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Utility for RAR archives";
|
|
|
|
homepage = "https://www.rarlab.com/";
|
|
|
|
license = licenses.unfree;
|
2024-01-13 08:15:51 +00:00
|
|
|
mainProgram = "rar";
|
2021-10-01 09:20:50 +00:00
|
|
|
maintainers = with maintainers; [ thiagokokada ];
|
2024-01-13 08:15:51 +00:00
|
|
|
platforms = lib.attrNames srcs;
|
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2021-10-01 09:20:50 +00:00
|
|
|
};
|
|
|
|
}
|