2024-01-13 08:15:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, autoPatchelfHook
|
|
|
|
, installShellFiles
|
|
|
|
}:
|
2021-10-01 09:20:50 +00:00
|
|
|
|
|
|
|
let
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "6.24";
|
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-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-aacgJH0iJLRNEaZuVyzl/FxZgSnW3dIZFUfaqt0l88M=";
|
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-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-iOIqjoQSXJR2N7vyjHRuM4oKYyedgPn51zc2A4ddses=";
|
2022-03-30 09:31:56 +00:00
|
|
|
};
|
|
|
|
aarch64-darwin = {
|
|
|
|
url = "https://www.rarlab.com/rar/rarmacos-arm-${downloadVersion}.tar.gz";
|
2024-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-2r4zWDT7Xw/CNvA7oNEsGfrXJDzFa5gNthIB/5TYR5U=";
|
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-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-4vENPNfMpQstsm9+8+glHPK9fAlDmnHWbCHW+HUwSX4=";
|
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-01-13 08:15:51 +00:00
|
|
|
src = fetchurl (srcs.${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
|
|
|
};
|
|
|
|
}
|