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.hostPlatform.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.hostPlatform.isLinux [ gnustep.base ] ++
47 lib.optionals stdenv.hostPlatform.isDarwin [ Foundation AppKit ];
49 nativeBuildInputs = [ installShellFiles ] ++
50 lib.optionals stdenv.hostPlatform.isLinux [ gnustep.make ] ++
51 lib.optionals stdenv.hostPlatform.isDarwin [ xcbuildHook ];
53 xcbuildFlags = lib.optionals stdenv.hostPlatform.isDarwin [
56 "-configuration Release"
57 "MACOSX_DEPLOYMENT_TARGET=${stdenv.hostPlatform.darwinMinVersion}"
60 makefile = lib.optionalString (!stdenv.hostPlatform.isDarwin) "Makefile.linux";
62 enableParallelBuilding = true;
66 sourceRoot = "${src.name}/XADMaster";
71 install -Dm555 -t $out/bin ${lib.optionalString stdenv.hostPlatform.isDarwin "Products/Release/"}{lsar,unar}
72 for f in lsar unar; do
73 installManPage ./Extra/$f.?
74 installShellCompletion --bash --name $f ./Extra/$f.bash_completion
81 homepage = "https://theunarchiver.com";
82 description = "Archive unpacker program";
84 The Unarchiver is an archive unpacker program with support for the popular
85 zip, RAR, 7z, tar, gzip, bzip2, LZMA, XZ, CAB, MSI, NSIS, EXE, ISO, BIN,
86 and split file formats, as well as the old Stuffit, Stuffit X, DiskDouble,
87 Compact Pro, Packit, cpio, compress (.Z), ARJ, ARC, PAK, ACE, ZOO, LZH,
88 ADF, DMS, LZX, PowerPacker, LBR, Squeeze, Crunch, and other old formats.
90 license = licenses.lgpl21Plus;
91 maintainers = with maintainers; [ peterhoeg ];
93 platforms = platforms.unix;