about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/renameutils/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/misc/renameutils/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/misc/renameutils/default.nix17
1 files changed, 16 insertions, 1 deletions
diff --git a/nixpkgs/pkgs/tools/misc/renameutils/default.nix b/nixpkgs/pkgs/tools/misc/renameutils/default.nix
index 2dff399cc9a4..1b6c70a2773d 100644
--- a/nixpkgs/pkgs/tools/misc/renameutils/default.nix
+++ b/nixpkgs/pkgs/tools/misc/renameutils/default.nix
@@ -1,4 +1,4 @@
-{lib, stdenv, fetchurl, readline}:
+{lib, stdenv, fetchurl, readline, coreutils }:
 
 stdenv.mkDerivation rec {
   pname = "renameutils";
@@ -11,8 +11,23 @@ stdenv.mkDerivation rec {
 
   patches = [ ./install-exec.patch ];
 
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    substituteInPlace src/apply.c \
+      --replace "command = \"mv\"" "command = \"${coreutils}/bin/mv\"" \
+      --replace "command = \"cp\"" "command = \"${coreutils}/bin/cp\""
+    substituteInPlace src/icmd.c \
+      --replace "#define MV_COMMAND \"mv\"" "#define MV_COMMAND \"${coreutils}/bin/mv\"" \
+      --replace "#define CP_COMMAND \"cp\"" "#define CP_COMMAND \"${coreutils}/bin/cp\""
+    substituteInPlace src/qcmd.c \
+      --replace "ls_program = xstrdup(\"ls\")" "ls_program = xstrdup(\"${coreutils}/bin/ls\")"
+  '';
+
   nativeBuildInputs = [ readline ];
 
+  preConfigure = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
+    export ac_cv_func_lstat64=no
+  '';
+
   meta = {
     homepage = "https://www.nongnu.org/renameutils/";
     description = "A set of programs to make renaming of files faster";