about summary refs log tree commit diff
path: root/pkgs/applications/misc/qdirstat/default.nix
blob: cbbac11424eca1a0a324637a34b1d08093297f7f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ stdenv, fetchFromGitHub, qmake
, coreutils, xdg_utils, bash
, perl, makeWrapper, perlPackages }:

let
  version = "1.4";
in stdenv.mkDerivation rec {
  name = "qdirstat-${version}";

  src = fetchFromGitHub {
    owner = "shundhammer";
    repo = "qdirstat";
    rev = "${version}";
    sha256 = "1ppasbr0mq301q6n3rm0bsmprs7vgkcjmmc0gbgqpgw84nmp9fqh";
  };

  nativeBuildInputs = [ qmake makeWrapper ];

  buildInputs = [ perl ];

  preBuild = ''
    substituteInPlace scripts/scripts.pro \
      --replace /bin/true ${coreutils}/bin/true \
      --replace /usr/bin $out/bin
    substituteInPlace src/src.pro \
      --replace /usr/bin $out/bin \
      --replace /usr/share $out/share
    for i in doc/doc.pro doc/stats/stats.pro
    do
      substituteInPlace $i \
        --replace /usr/share $out/share
    done

    for i in src/MainWindow.cpp src/FileSizeStatsWindow.cpp
    do
      substituteInPlace $i \
        --replace /usr/bin/xdg-open ${xdg_utils}/bin/xdg-open
    done
    for i in src/Cleanup.cpp src/cleanup-config-page.ui
    do
      substituteInPlace $i \
        --replace /bin/bash ${bash}/bin/bash \
        --replace /bin/sh ${bash}/bin/sh
    done
    substituteInPlace src/StdCleanup.cpp \
      --replace /bin/bash ${bash}/bin/bash
  '';

  postInstall = ''
    wrapProgram $out/bin/qdirstat-cache-writer \
      --set PERL5LIB "${stdenv.lib.makePerlPath [ perlPackages.URI ]}"
  '';

  meta = with stdenv.lib; {
    description = "Graphical disk usage analyzer";
    homepage = src.meta.homepage;
    license = licenses.gpl2;
    maintainers = with maintainers; [ gnidorah ];
    platforms = platforms.linux;
  };
}