diff --git a/pkgs/tools/misc/file/default.nix b/pkgs/tools/misc/file/default.nix index c96214519966..34f58c1f92a8 100644 --- a/pkgs/tools/misc/file/default.nix +++ b/pkgs/tools/misc/file/default.nix @@ -2,7 +2,7 @@ lib, stdenv, fetchurl, - file, + buildPackages, zlib, libgnurx, updateAutotoolsGnuConfigScriptsHook, @@ -51,14 +51,16 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook - ] - ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) file; + ]; buildInputs = [ zlib ] ++ lib.optional stdenv.hostPlatform.isMinGW libgnurx; # https://bugs.astron.com/view.php?id=382 doCheck = !stdenv.buildPlatform.isMusl; - makeFlags = lib.optional stdenv.hostPlatform.isWindows "FILE_COMPILE=file"; + # In native builds, it will use the newly-compiled file instead. + makeFlags = lib.optional ( + !lib.systems.equals stdenv.hostPlatform stdenv.buildPlatform + ) "FILE_COMPILE=${lib.getExe buildPackages.file}"; passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;