nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, fetchurl
2, coreutils
3}:
4
5# Note: this package is used for bootstrapping fetchurl, and thus
6# cannot use fetchpatch! All mutable patches (generated by GitHub or
7# cgit) that are needed here should be included directly in Nixpkgs as
8# files.
9
10stdenv.mkDerivation rec {
11 pname = "findutils";
12 version = "4.9.0";
13
14 src = fetchurl {
15 url = "mirror://gnu/findutils/${pname}-${version}.tar.xz";
16 sha256 = "sha256-or+4wJ1DZ3DtxZ9Q+kg+eFsWGjt7nVR1c8sIBl/UYv4=";
17 };
18
19 postPatch = ''
20 substituteInPlace xargs/xargs.c --replace 'char default_cmd[] = "echo";' 'char default_cmd[] = "${coreutils}/bin/echo";'
21 '';
22
23 patches = [ ./no-install-statedir.patch ];
24
25 buildInputs = [ coreutils ]; # bin/updatedb script needs to call sort
26
27 # Since glibc-2.25 the i686 tests hang reliably right after test-sleep.
28 doCheck
29 = !stdenv.hostPlatform.isDarwin
30 && !(stdenv.hostPlatform.libc == "glibc" && stdenv.hostPlatform.isi686)
31 && (stdenv.hostPlatform.libc != "musl")
32 && stdenv.hostPlatform == stdenv.buildPlatform;
33
34 outputs = [ "out" "info" "locate"];
35
36 configureFlags = [
37 # "sort" need not be on the PATH as a run-time dep, so we need to tell
38 # configure where it is. Covers the cross and native case alike.
39 "SORT=${coreutils}/bin/sort"
40 "--localstatedir=/var/cache"
41 ];
42
43 CFLAGS = lib.optionals stdenv.isDarwin [
44 # TODO: Revisit upstream issue https://savannah.gnu.org/bugs/?59972
45 # https://github.com/Homebrew/homebrew-core/pull/69761#issuecomment-770268478
46 "-D__nonnull\\(params\\)="
47 ];
48
49 postInstall = ''
50 moveToOutput bin/locate $locate
51 moveToOutput bin/updatedb $locate
52 '';
53
54 # can't move man pages in postInstall because the multi-output hook will move them back to $out
55 postFixup = ''
56 moveToOutput share/man/man5 $locate
57 moveToOutput share/man/man1/locate.1.gz $locate
58 moveToOutput share/man/man1/updatedb.1.gz $locate
59 '';
60
61 enableParallelBuilding = true;
62
63 # bionic libc is super weird and has issues with fortify outside of its own libc, check this comment:
64 # https://github.com/NixOS/nixpkgs/pull/192630#discussion_r978985593
65 # or you can check libc/include/sys/cdefs.h in bionic source code
66 hardeningDisable = lib.optional (stdenv.hostPlatform.libc == "bionic") "fortify";
67
68 meta = {
69 homepage = "https://www.gnu.org/software/findutils/";
70 description = "GNU Find Utilities, the basic directory searching utilities of the GNU operating system";
71
72 longDescription = ''
73 The GNU Find Utilities are the basic directory searching
74 utilities of the GNU operating system. These programs are
75 typically used in conjunction with other programs to provide
76 modular and powerful directory search and file locating
77 capabilities to other commands.
78
79 The tools supplied with this package are:
80
81 * find - search for files in a directory hierarchy;
82 * xargs - build and execute command lines from standard input.
83
84 The following are available in the locate output:
85
86 * locate - list files in databases that match a pattern;
87 * updatedb - update a file name database;
88 '';
89
90 platforms = lib.platforms.all;
91
92 license = lib.licenses.gpl3Plus;
93 };
94}