@@ -24,6 +24,8 @@ common =
2424 , withLibseccomp ? lib.meta.availableOn stdenv.hostPlatform libseccomp, libseccomp
2525 , withAWS ? !enableStatic && (stdenv.isLinux || stdenv.isDarwin), aws-sdk-cpp
2626 , enableStatic ? stdenv.hostPlatform.isStatic
27+ , enableDocumentation ? lib.versionOlder version "2.4pre" ||
28+ stdenv.hostPlatform == stdenv.buildPlatform
2729 , pname, version, suffix ? "", src
2830 , patches ? [ ]
2931 }:
@@ -36,16 +38,20 @@ common =
3638
3739 VERSION_SUFFIX = suffix;
3840
39− outputs = [ "out" "dev" "man" "doc" ];
41+ outputs =
42+ [ "out" "dev" ]
43+ ++ lib.optionals enableDocumentation [ "man" "doc" ];
4044
4145 nativeBuildInputs =
4246 [ pkg-config ]
4347 ++ lib.optionals stdenv.isLinux [ util-linuxMinimal ]
48+ ++ lib.optionals (is24 && enableDocumentation) [
49+ (lib.getBin lowdown) mdbook
50+ ]
4451 ++ lib.optionals is24
4552 [ autoreconfHook
4653 autoconf-archive
4754 bison flex
48− (lib.getBin lowdown) mdbook
4955 jq
5056 ];
5157
@@ -118,6 +124,7 @@ common =
118124 "--sysconfdir=${confDir}"
119125 "--enable-gc"
120126 ]
127+ ++ lib.optional (!enableDocumentation) "--disable-doc-gen"
121128 ++ lib.optionals (!is24) [
122129 # option was removed in 2.4
123130 "--disable-init-state"
@@ -160,7 +167,7 @@ common =
160167 license = lib.licenses.lgpl2Plus;
161168 maintainers = [ lib.maintainers.eelco ];
162169 platforms = lib.platforms.unix;
163− outputsToInstall = [ "out" "man" ];
170+ outputsToInstall = [ "out" ] ++ lib.optional enableDocumentation "man";
164171 };
165172
166173 passthru = {