summary refs log tree commit diff
path: root/pkgs/tools/misc/rmlint
diff options
context:
space:
mode:
authorAndreas Schmid <service@aaschmid.de>2021-04-04 15:33:01 +0200
committerAndreas Schmid <service@aaschmid.de>2021-04-09 20:38:20 +0200
commitb0a1a08800425d2e5f0822462ebda4ae0b10cb39 (patch)
tree26f3c127a4e7f8b377616975c9a6c00bbeabd939 /pkgs/tools/misc/rmlint
parent7462194620fcce0f025fcc24576710d715dbbb3d (diff)
downloadnixpkgs-b0a1a08800425d2e5f0822462ebda4ae0b10cb39.tar
nixpkgs-b0a1a08800425d2e5f0822462ebda4ae0b10cb39.tar.gz
nixpkgs-b0a1a08800425d2e5f0822462ebda4ae0b10cb39.tar.bz2
nixpkgs-b0a1a08800425d2e5f0822462ebda4ae0b10cb39.tar.lz
nixpkgs-b0a1a08800425d2e5f0822462ebda4ae0b10cb39.tar.xz
nixpkgs-b0a1a08800425d2e5f0822462ebda4ae0b10cb39.tar.zst
nixpkgs-b0a1a08800425d2e5f0822462ebda4ae0b10cb39.zip
rmlint: darwin support
by providing correct build flags.
Also remove same sources of non-determinism.
Thanks to @abathur.

Signed-off-by: Andreas Schmid <service@aaschmid.de>
Diffstat (limited to 'pkgs/tools/misc/rmlint')
-rw-r--r--pkgs/tools/misc/rmlint/default.nix27
1 files changed, 19 insertions, 8 deletions
diff --git a/pkgs/tools/misc/rmlint/default.nix b/pkgs/tools/misc/rmlint/default.nix
index 09ebbe33a34..8211c5aebc7 100644
--- a/pkgs/tools/misc/rmlint/default.nix
+++ b/pkgs/tools/misc/rmlint/default.nix
@@ -18,6 +18,8 @@
 , wrapGAppsHook
 , withGui ? false }:
 
+assert withGui -> !stdenv.isDarwin;
+
 with lib;
 stdenv.mkDerivation rec {
   pname = "rmlint";
@@ -30,12 +32,9 @@ stdenv.mkDerivation rec {
     sha256 = "15xfkcw1bkfyf3z8kl23k3rlv702m0h7ghqxvhniynvlwbgh6j2x";
   };
 
-  CFLAGS="-I${lib.getDev util-linux}/include";
-
   nativeBuildInputs = [
     pkg-config
     sphinx
-    gettext
     scons
   ] ++ lib.optionals withGui [
     makeWrapper
@@ -57,9 +56,21 @@ stdenv.mkDerivation rec {
     python3.pkgs.pygobject3
   ];
 
-  # this doesn't seem to support configureFlags, and appends $out afterwards,
-  # so add the --without-gui in front of it
-  prefixKey = lib.optionalString (!withGui) " --without-gui " + "--prefix=";
+  prePatch = ''
+    export CFLAGS="$NIX_CFLAGS_COMPILE"
+    export LDFLAGS="''${NIX_LDFLAGS//-rpath /-Wl,-rpath=}"
+
+    # remove sources of nondeterminism
+    substituteInPlace lib/cmdline.c \
+      --replace "__DATE__" "\"Jan  1 1970\"" \
+      --replace "__TIME__" "\"00:00:00\""
+    substituteInPlace docs/SConscript \
+      --replace "gzip -c " "gzip -cn "
+  '';
+
+  prefixKey = "--prefix=";
+
+  sconsFlags = lib.optionals (!withGui) [ "--without-gui" ];
 
   # in GUI mode, this shells out to itself, and tries to import python modules
   postInstall = lib.optionalString withGui ''
@@ -70,8 +81,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Extremely fast tool to remove duplicates and other lint from your filesystem";
     homepage = "https://rmlint.readthedocs.org";
-    platforms = platforms.linux;
+    platforms = platforms.unix;
     license = licenses.gpl3;
-    maintainers = [ maintainers.koral ];
+    maintainers = with maintainers; [ aaschmid koral ];
   };
 }