17 stdenv.mkDerivation rec {
22 url = "mirror://savannah/man-db/man-db-${version}.tar.xz";
23 sha256 = "sha256-7peVTUkqE3MZA8nQcnubAeUIntvWlfDNtY1AWlr1UU0=";
26 outputs = [ "out" "doc" ];
27 outputMan = "out"; # users will want `man man` to work
30 nativeBuildInputs = [ autoreconfHook groff makeWrapper pkg-config zstd ];
31 buildInputs = [ libpipeline db groff ]; # (Yes, 'groff' is both native and build input)
32 checkInputs = [ libiconv /* for 'iconv' binary */ ];
34 patches = [ ./systemwide-man-db-conf.patch ];
37 # Remove all mandatory manpaths. Nixpkgs makes no requirements on
38 # these directories existing.
39 sed -i 's/^MANDATORY_MANPATH/# &/' src/man_db.conf.in
41 # Add Nix-related manpaths
42 echo "MANPATH_MAP /nix/var/nix/profiles/default/bin /nix/var/nix/profiles/default/share/man" >> src/man_db.conf.in
44 # Add mandb locations for the above
45 echo "MANDB_MAP /nix/var/nix/profiles/default/share/man /var/cache/man/nixpkgs" >> src/man_db.conf.in
50 "--disable-cache-owner"
51 "--localstatedir=/var"
52 "--with-config-file=${placeholder "out"}/etc/man_db.conf"
53 "--with-systemdtmpfilesdir=${placeholder "out"}/lib/tmpfiles.d"
54 "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
56 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
57 "ac_cv_func__set_invalid_parameter_handler=no"
58 "ac_cv_func_posix_fadvise=no"
59 "ac_cv_func_mempcpy=no"
63 configureFlagsArray+=("--with-sections=1 n l 8 3 0 2 5 4 9 6 7")
67 # apropos/whatis uses program name to decide whether to act like apropos or whatis
68 # (multi-call binary). `apropos` is actually just a symlink to whatis. So we need to
69 # make sure that we don't wrap symlinks (since that changes argv[0] to the -wrapped name)
70 find "$out/bin" -type f | while read file; do
72 --prefix PATH : "${lib.makeBinPath [ groff gzip zstd ]}"
76 disallowedReferences = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
80 enableParallelBuilding = true;
82 doCheck = !stdenv.hostPlatform.isMusl /* iconv binary */ && !stdenv.hostPlatform.isDarwin;
85 nixos = nixosTests.man;
89 homepage = "http://man-db.nongnu.org";
90 description = "An implementation of the standard Unix documentation system accessed using the man command";
91 license = licenses.gpl2;
92 platforms = lib.platforms.unix;