summary refs log tree commit diff
path: root/pkgs/tools/misc/rmlint
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-06-14 01:30:18 +0200
committerFlorian Klink <flokli@flokli.de>2020-06-17 19:41:41 +0200
commit35040cfafdba3a08d68e6cd23169e6617c5e7a77 (patch)
tree98df6c02ac970c6f499dab7bad63e9fd71512a2a /pkgs/tools/misc/rmlint
parent33bc279247797b88817d5ed83c8514b985c05622 (diff)
downloadnixpkgs-35040cfafdba3a08d68e6cd23169e6617c5e7a77.tar
nixpkgs-35040cfafdba3a08d68e6cd23169e6617c5e7a77.tar.gz
nixpkgs-35040cfafdba3a08d68e6cd23169e6617c5e7a77.tar.bz2
nixpkgs-35040cfafdba3a08d68e6cd23169e6617c5e7a77.tar.lz
nixpkgs-35040cfafdba3a08d68e6cd23169e6617c5e7a77.tar.xz
nixpkgs-35040cfafdba3a08d68e6cd23169e6617c5e7a77.tar.zst
nixpkgs-35040cfafdba3a08d68e6cd23169e6617c5e7a77.zip
rmlint: fix running rmlint --gui
rmlint has a `--gui` option which is writing a python "bootstrap" script
in `/tmp`.

It currently can't find its own python modules, as we don't prefix
`PYTHONPATH` to point to it. Also, there's some other runtime
dependencies, mostly due to using gtk from python(3), which also needs
to be preprended to `PYTHONPATH`.

The `rmlint` GUI components also execute `rmlint` again with `--version`
to determine some features, for which we need to prefix `PATH` with
`$out/bin`.
Diffstat (limited to 'pkgs/tools/misc/rmlint')
-rw-r--r--pkgs/tools/misc/rmlint/default.nix53
1 files changed, 47 insertions, 6 deletions
diff --git a/pkgs/tools/misc/rmlint/default.nix b/pkgs/tools/misc/rmlint/default.nix
index 2ea1668409a..936c78b695d 100644
--- a/pkgs/tools/misc/rmlint/default.nix
+++ b/pkgs/tools/misc/rmlint/default.nix
@@ -1,6 +1,22 @@
-{ stdenv, fetchFromGitHub
-, gettext, pkgconfig, scons
-, glib, json-glib, libelf, sphinx, utillinux }:
+{ stdenv
+, cairo
+, fetchFromGitHub
+, gettext
+, glib
+, gobject-introspection
+, gtksourceview3
+, json-glib
+, libelf
+, makeWrapper
+, pango
+, pkgconfig
+, polkit
+, python3
+, scons
+, sphinx
+, utillinux
+, wrapGAppsHook
+, withGui ? false }:
 
 with stdenv.lib;
 stdenv.mkDerivation rec {
@@ -17,14 +33,39 @@ stdenv.mkDerivation rec {
   CFLAGS="-I${stdenv.lib.getDev utillinux}/include";
 
   nativeBuildInputs = [
-    pkgconfig sphinx gettext scons
+    pkgconfig
+    sphinx
+    gettext
+    scons
+  ] ++ stdenv.lib.optionals withGui [
+    makeWrapper
+    wrapGAppsHook
   ];
 
   buildInputs = [
-    glib json-glib libelf utillinux
+    glib
+    json-glib
+    libelf
+    utillinux
+  ] ++ stdenv.lib.optionals withGui [
+    cairo
+    gobject-introspection
+    gtksourceview3
+    pango
+    polkit
+    python3
+    python3.pkgs.pygobject3
   ];
 
-  prefixKey = "--prefix=";
+  # 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";