1 { lib, stdenv, fetchurl, zlib, perl, nixosTests }:
4 # Name of an UTF-8 locale _always_ present at runtime, used for UTF-8 support
5 # (locale set by the user may differ). This would usually be C.UTF-8, but
6 # darwin has no such locale.
8 if stdenv.hostPlatform.isDarwin
13 stdenv.mkDerivation rec {
18 url = "https://mandoc.bsd.lv/snapshots/mandoc-${version}.tar.gz";
19 sha256 = "8bf0d570f01e70a6e124884088870cbed7537f36328d512909eb10cd53179d9c";
22 buildInputs = [ zlib ];
25 MANPATH_DEFAULT="/run/current-system/sw/share/man"
26 MANPATH_BASE="$MANPATH_DEFAULT"
30 # Use symlinks instead of hardlinks (more commonly used in nixpkgs)
32 # nixpkgs doesn't have sbin, install makewhatis to bin
34 CC=${stdenv.cc.targetPrefix}cc
35 AR=${stdenv.cc.bintools.targetPrefix}ar
36 # Allow makewhatis(8) to follow symlinks from a manpath to the nix store
37 READ_ALLOWED_PATH=${builtins.storeDir}
38 # Bypass the locale(1)-based check for UTF-8 support since it causes trouble:
39 # * We only have meaningful locale(1) implementations for glibc and macOS
40 # * NetBSD's locale(1) (used for macOS) depends on mandoc
41 # * Sandbox and locales cause all kinds of trouble
42 # * build and host libc (and thus locale handling) may differ
44 UTF8_LOCALE=${utf8Locale}
48 printf '%s' "$configureLocal" > configure.local
52 checkTarget = "regress";
53 nativeCheckInputs = [ perl ];
54 preCheck = "patchShebangs --build regress/regress.pl";
57 nixos = nixosTests.man;
61 # check if we can execute binaries for the host platform on the build platform
62 # even though the platforms aren't the same. mandoc can't be cross compiled
63 # (easily) because of its configurePhase which executes compiled programs
64 # for gathering information about the host system. Consequently, we can only
65 # allow “native” cross such as pkgsLLVM and pkgsStatic.
66 # For a lack of a better predicate at the moment, we compare the platforms'
67 # system tuples. See also:
68 # * https://github.com/NixOS/nixpkgs/pull/140271
69 # * https://github.com/NixOS/nixpkgs/issues/61414
70 # We need to use broken instead of, say a top level assert, to keep splicing
72 broken = stdenv.buildPlatform.system != stdenv.hostPlatform.system;
74 homepage = "https://mandoc.bsd.lv/";
75 description = "suite of tools compiling mdoc and man";
76 downloadPage = "http://mandoc.bsd.lv/snapshots/";
77 license = licenses.bsd3;
78 platforms = platforms.all;
79 maintainers = with maintainers; [ ramkromberg sternenseemann ];