1 { lib, stdenv, fetchurl, autoPatchelfHook, installShellFiles }:
5 downloadVersion = lib.replaceStrings [ "." ] [ "" ] version;
8 url = "https://www.rarlab.com/rar/rarlinux-x32-${downloadVersion}.tar.gz";
9 hash = "sha256-Vh8Hyd3Y2tDapXY+xZ+6W+X7SQGDsy1x61L28sieYKw=";
12 url = "https://www.rarlab.com/rar/rarlinux-x64-${downloadVersion}.tar.gz";
13 hash = "sha256-ZaGn5OzqVzDojJn8bTrbRh1wvYXM7SK91jl96mbNAeA=";
16 url = "https://www.rarlab.com/rar/rarmacos-arm-${downloadVersion}.tar.gz";
17 hash = "sha256-SR80VxKgLrJqO0JGWMMGUuIuIgGgxcVH+5fCWnVqJks=";
20 url = "https://www.rarlab.com/rar/rarmacos-x64-${downloadVersion}.tar.gz";
21 hash = "sha256-9gfKEr3DE4hMWm9QT79mKgURvzn+BKmyppTJhs00u2c=";
23 }.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
25 url = "https://aur.archlinux.org/cgit/aur.git/plain/rar.1?h=rar&id=8e39a12e88d8a3b168c496c44c18d443c876dd10";
27 hash = "sha256-93cSr9oAsi+xHUtMsUvICyHJe66vAImS2tLie7nt8Uw=";
30 stdenv.mkDerivation rec {
34 src = fetchurl srcUrl;
38 buildInputs = lib.optionals stdenv.isLinux [ stdenv.cc.cc.lib ];
40 nativeBuildInputs = [ installShellFiles ]
41 ++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
46 install -Dm755 {rar,unrar} -t "$out/bin"
47 install -Dm755 default.sfx -t "$out/lib"
48 install -Dm644 {acknow.txt,license.txt} -t "$out/share/doc/rar"
49 install -Dm644 rarfiles.lst -t "$out/etc"
55 installManPage ${manSrc}
59 description = "Utility for RAR archives";
60 homepage = "https://www.rarlab.com/";
61 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
62 license = licenses.unfree;
63 maintainers = with maintainers; [ thiagokokada ];
64 platforms = with platforms; linux ++ darwin;