aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/tools/misc/rmlint/default.nix
blob: 36da8d0a463b059eacc337fac5576ee50add5b6a (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{ stdenv
, cairo
, fetchFromGitHub
, gettext
, glib
, gobject-introspection
, gtksourceview3
, json-glib
, libelf
, makeWrapper
, pango
, pkgconfig
, polkit
, python3
, scons
, sphinx
, util-linux
, wrapGAppsHook
, withGui ? false }:

with stdenv.lib;
stdenv.mkDerivation rec {
  pname = "rmlint";
  version = "2.10.1";

  src = fetchFromGitHub {
    owner = "sahib";
    repo = "rmlint";
    rev = "v${version}";
    sha256 = "15xfkcw1bkfyf3z8kl23k3rlv702m0h7ghqxvhniynvlwbgh6j2x";
  };

  CFLAGS="-I${stdenv.lib.getDev util-linux}/include";

  nativeBuildInputs = [
    pkgconfig
    sphinx
    gettext
    scons
  ] ++ stdenv.lib.optionals withGui [
    makeWrapper
    wrapGAppsHook
  ];

  buildInputs = [
    glib
    json-glib
    libelf
    util-linux
  ] ++ stdenv.lib.optionals withGui [
    cairo
    gobject-introspection
    gtksourceview3
    pango
    polkit
    python3
    python3.pkgs.pygobject3
  ];

  # this doesn't seem to support configureFlags, and appends $out afterwards,
  # so add the --without-gui in front of it
  prefixKey = stdenv.lib.optionalString (!withGui) " --without-gui " + "--prefix=";

  # in GUI mode, this shells out to itself, and tries to import python modules
  postInstall = stdenv.lib.optionalString withGui ''
    gappsWrapperArgs+=(--prefix PATH : "$out/bin")
    gappsWrapperArgs+=(--prefix PYTHONPATH : "$(toPythonPath $out):$(toPythonPath ${python3.pkgs.pygobject3}):$(toPythonPath ${python3.pkgs.pycairo})")
  '';

  meta = {
    description = "Extremely fast tool to remove duplicates and other lint from your filesystem";
    homepage = "https://rmlint.readthedocs.org";
    platforms = platforms.linux;
    license = licenses.gpl3;
    maintainers = [ maintainers.koral ];
  };
}