From 316bc514fa3691208bfc074feae5fb551a73c92d Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 28 Sep 2021 23:39:51 -0300 Subject: [PATCH] rar: init at 6.0.2 --- pkgs/tools/archivers/rar/default.nix | 55 ++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 57 insertions(+) create mode 100644 pkgs/tools/archivers/rar/default.nix diff --git a/pkgs/tools/archivers/rar/default.nix b/pkgs/tools/archivers/rar/default.nix new file mode 100644 index 000000000000..55fa2cc1bb0f --- /dev/null +++ b/pkgs/tools/archivers/rar/default.nix @@ -0,0 +1,55 @@ +{ lib, stdenv, fetchurl, autoPatchelfHook, installShellFiles }: + +let + version = "6.0.2"; + # TODO: add support for macOS + srcUrl = + if stdenv.isi686 then { + url = "https://www.rarlab.com/rar/rarlinux-${version}.tar.gz"; + sha256 = "sha256-5iqK7eOo+hgLtGSCqUoB+wOFZHUqZ0M/8Jf7bxdf9qA="; + } else if stdenv.isx86_64 then { + url = "https://www.rarlab.com/rar/rarlinux-x64-${version}.tar.gz"; + sha256 = "sha256-WAvrUGCgfwI51Mo/RYSSF0OLPPrTegUCuDEsnBeR9uQ="; + } + else throw "Unknown architecture"; + manSrc = fetchurl { + url = "https://aur.archlinux.org/cgit/aur.git/plain/rar.1?h=rar&id=8e39a12e88d8a3b168c496c44c18d443c876dd10"; + name = "rar.1"; + sha256 = "sha256-93cSr9oAsi+xHUtMsUvICyHJe66vAImS2tLie7nt8Uw="; + }; +in +stdenv.mkDerivation rec { + pname = "rar"; + inherit version; + + src = fetchurl srcUrl; + + dontBuild = true; + + buildInputs = [ stdenv.cc.cc.lib ]; + + nativeBuildInputs = [ autoPatchelfHook installShellFiles ]; + + 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} + ''; + + meta = with lib; { + description = "Utility for RAR archives"; + homepage = "https://www.rarlab.com/"; + license = licenses.unfree; + maintainers = with maintainers; [ thiagokokada ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cd63e7444fcb..a09bf84d8668 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8630,6 +8630,8 @@ with pkgs; ranger = callPackage ../applications/misc/ranger { }; + rar = callPackage ../tools/archivers/rar { }; + rarcrack = callPackage ../tools/security/rarcrack { }; rarian = callPackage ../development/libraries/rarian { };