diff --git a/pkgs/tools/system/which/default.nix b/pkgs/tools/system/which/default.nix index aecf68e8c7fa..82316541f4c7 100644 --- a/pkgs/tools/system/which/default.nix +++ b/pkgs/tools/system/which/default.nix @@ -12,6 +12,13 @@ stdenv.mkDerivation rec { strictDeps = true; enableParallelBuilding = true; + 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 = with lib; { homepage = "https://www.gnu.org/software/which/"; description = "Shows the full path of (shell) commands";