nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 buildPackages,
6 zlib,
7 libgnurx,
8 updateAutotoolsGnuConfigScriptsHook,
9 testers,
10}:
11
12# Note: this package is used for bootstrapping fetchurl, and thus
13# cannot use fetchpatch! All mutable patches (generated by GitHub or
14# cgit) that are needed here should be included directly in Nixpkgs as
15# files.
16
17stdenv.mkDerivation (finalAttrs: {
18 pname = "file";
19 version = "5.45";
20
21 src = fetchurl {
22 urls = [
23 "https://astron.com/pub/file/file-${finalAttrs.version}.tar.gz"
24 "https://distfiles.macports.org/file/file-${finalAttrs.version}.tar.gz"
25 ];
26 hash = "sha256-/Jf1ECm7DiyfTjv/79r2ePDgOe6HK53lwAKm0Jx4TYI=";
27 };
28
29 outputs = [
30 "out"
31 "dev"
32 "man"
33 ];
34
35 patches = [
36 # Upstream patch to fix 32-bit tests.
37 #
38 # It is included in 5.46+, but we are not updating to it or a later version until:
39 #
40 # https://bugs.astron.com/view.php?id=622
41 # https://bugs.astron.com/view.php?id=638
42 #
43 # are resolved. See also description of the 1st bug here:
44 #
45 # https://github.com/NixOS/nixpkgs/pull/402318#issuecomment-2881163359
46 ./32-bit-time_t.patch
47 ];
48
49 strictDeps = true;
50 enableParallelBuilding = true;
51
52 nativeBuildInputs = [
53 updateAutotoolsGnuConfigScriptsHook
54 ];
55 buildInputs = [ zlib ] ++ lib.optional stdenv.hostPlatform.isMinGW libgnurx;
56
57 # https://bugs.astron.com/view.php?id=382
58 doCheck = !stdenv.buildPlatform.isMusl;
59
60 # In native builds, it will use the newly-compiled file instead.
61 makeFlags = lib.optional (
62 !lib.systems.equals stdenv.hostPlatform stdenv.buildPlatform
63 ) "FILE_COMPILE=${lib.getExe buildPackages.file}";
64
65 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
66
67 meta = {
68 homepage = "https://darwinsys.com/file";
69 description = "Program that shows the type of files";
70 maintainers = with lib.maintainers; [ doronbehar ];
71 license = lib.licenses.bsd2;
72 pkgConfigModules = [ "libmagic" ];
73 platforms = lib.platforms.all;
74 mainProgram = "file";
75 };
76})