1{ lib
2, fetchFromGitHub
3, python3Packages
4, gnutar
5, unzip
6, lhasa
7, rpm
8, binutils
9, cpio
10, gzip
11, p7zip
12, cabextract
13, unrar
14, unshield
15, bzip2
16, xz
17, lzip
18, unzipSupport ? false
19, unrarSupport ? false
20}:
21
22python3Packages.buildPythonApplication rec {
23 pname = "dtrx";
24 version = "8.5.1";
25
26 src = fetchFromGitHub {
27 owner = "dtrx-py";
28 repo = "dtrx";
29 rev = "refs/tags/${version}";
30 sha256 = "sha256-KOHafmvl17IABlcBuE7isHVCIYRbA68Dna6rgiiWlkQ=";
31 };
32
33 postInstall =
34 let
35 archivers = lib.makeBinPath (
36 [ gnutar lhasa rpm binutils cpio gzip p7zip cabextract unshield bzip2 xz lzip ]
37 ++ lib.optional (unzipSupport) unzip
38 ++ lib.optional (unrarSupport) unrar
39 );
40 in ''
41 wrapProgram "$out/bin/dtrx" --prefix PATH : "${archivers}"
42 '';
43
44 nativeBuildInputs = [ python3Packages.invoke ];
45
46 meta = with lib; {
47 description = "Do The Right Extraction: A tool for taking the hassle out of extracting archives";
48 homepage = "https://github.com/dtrx-py/dtrx";
49 license = licenses.gpl3Plus;
50 maintainers = [ ];
51 };
52}