summary refs log tree commit diff
path: root/pkgs/tools/system/which/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/system/which/default.nix')
-rw-r--r--pkgs/tools/system/which/default.nix16
1 files changed, 12 insertions, 4 deletions
diff --git a/pkgs/tools/system/which/default.nix b/pkgs/tools/system/which/default.nix
index aecf68e8c7f..831791a2f8b 100644
--- a/pkgs/tools/system/which/default.nix
+++ b/pkgs/tools/system/which/default.nix
@@ -6,16 +6,24 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://gnu/which/which-${version}.tar.gz";
-    sha256 = "1bgafvy3ypbhhfznwjv1lxmd6mci3x1byilnnkc7gcr486wlb8pl";
+    hash = "sha256-9KJFuUEks3fYtJZGv0IfkVXTaqdhS26/g3BdP/x26q0=";
   };
 
   strictDeps = true;
   enableParallelBuilding = true;
 
-  meta = with lib; {
+  env.NIX_CFLAGS_COMPILE = toString (
+    # Enable 64-bit file API. Otherwise `which` fails to find tools
+    # on filesystems with 64-bit inodes (like `btrfs`) when running
+    # binaries from 32-bit systems (like `i686-linux`).
+    lib.optional stdenv.hostPlatform.is32bit "-D_FILE_OFFSET_BITS=64"
+  );
+
+  meta = {
     homepage = "https://www.gnu.org/software/which/";
     description = "Shows the full path of (shell) commands";
-    platforms = platforms.all;
-    license = licenses.gpl3;
+    license = lib.licenses.gpl3Plus;
+    mainProgram = "which";
+    platforms = lib.platforms.all;
   };
 }