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