16 stdenv.mkDerivation rec {
20 src = fetchFromGitHub {
22 # the unar repo contains a shallow clone of both XADMaster and universal-detector
25 sha256 = "0p846q1l66k3rnd512sncp26zpv411b8ahi145sghfcsz9w8abc4";
29 if stdenv.isDarwin then ''
30 substituteInPlace "./XADMaster.xcodeproj/project.pbxproj" \
31 --replace "libstdc++.6.dylib" "libc++.1.dylib"
33 for f in Makefile.linux ../UniversalDetector/Makefile.linux ; do
34 substituteInPlace $f \
35 --replace "= gcc" "=${stdenv.cc.targetPrefix}cc" \
36 --replace "= g++" "=${stdenv.cc.targetPrefix}c++" \
37 --replace "-DGNU_RUNTIME=1" "" \
38 --replace "-fgnu-runtime" "-fobjc-runtime=gnustep-2.0"
41 # we need to build inside this directory as well, so we have to make it writeable
42 chmod +w ../UniversalDetector -R
45 buildInputs = [ bzip2 icu openssl wavpack zlib ] ++
46 lib.optionals stdenv.isLinux [ gnustep.base ] ++
47 lib.optionals stdenv.isDarwin [ Foundation AppKit ];
49 nativeBuildInputs = [ installShellFiles ] ++
50 lib.optionals stdenv.isLinux [ gnustep.make ] ++
51 lib.optionals stdenv.isDarwin [ xcbuildHook ];
53 xcbuildFlags = lib.optionals stdenv.isDarwin [
56 "-configuration Release"
57 "MACOSX_DEPLOYMENT_TARGET=10.12"
58 # Fix "ld: file not found: /nix/store/*-clang-7.1.0/lib/arc/libarclite_macosx." error
59 # Disabling ARC may leak memory, however since this program is generally not used for
60 # long periods of time, it shouldn't be an issue
61 "CLANG_LINK_OBJC_RUNTIME=NO"
64 makefile = lib.optionalString (!stdenv.isDarwin) "Makefile.linux";
66 enableParallelBuilding = true;
70 sourceRoot = "./source/XADMaster";
75 install -Dm555 -t $out/bin ${lib.optionalString stdenv.isDarwin "Products/Release/"}{lsar,unar}
76 for f in lsar unar; do
77 installManPage ./Extra/$f.?
78 installShellCompletion --bash --name $f ./Extra/$f.bash_completion
85 homepage = "https://theunarchiver.com";
86 description = "An archive unpacker program";
88 The Unarchiver is an archive unpacker program with support for the popular
89 zip, RAR, 7z, tar, gzip, bzip2, LZMA, XZ, CAB, MSI, NSIS, EXE, ISO, BIN,
90 and split file formats, as well as the old Stuffit, Stuffit X, DiskDouble,
91 Compact Pro, Packit, cpio, compress (.Z), ARJ, ARC, PAK, ACE, ZOO, LZH,
92 ADF, DMS, LZX, PowerPacker, LBR, Squeeze, Crunch, and other old formats.
94 license = licenses.lgpl21Plus;
95 maintainers = with maintainers; [ peterhoeg thiagokokada ];
96 platforms = platforms.unix;