2023-11-30 22:48:44 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2023-12-03 19:10:09 +00:00
|
|
|
, releaseTools
|
2023-11-30 22:48:44 +00:00
|
|
|
, autoconf-archive
|
|
|
|
, autoreconfHook
|
|
|
|
, aws-sdk-cpp
|
|
|
|
, boehmgc
|
|
|
|
, nlohmann_json
|
|
|
|
, bison
|
|
|
|
, boost
|
|
|
|
, brotli
|
|
|
|
, bzip2
|
|
|
|
, changelog-d
|
|
|
|
, curl
|
|
|
|
, editline
|
2023-09-02 19:56:37 +00:00
|
|
|
, readline
|
2023-11-30 22:48:44 +00:00
|
|
|
, fileset
|
|
|
|
, flex
|
|
|
|
, git
|
|
|
|
, gtest
|
|
|
|
, jq
|
2023-12-03 19:10:09 +00:00
|
|
|
, doxygen
|
2023-11-30 22:48:44 +00:00
|
|
|
, libarchive
|
|
|
|
, libcpuid
|
|
|
|
, libgit2
|
|
|
|
, libseccomp
|
|
|
|
, libsodium
|
|
|
|
, lowdown
|
|
|
|
, mdbook
|
|
|
|
, mdbook-linkcheck
|
|
|
|
, mercurial
|
|
|
|
, openssh
|
|
|
|
, openssl
|
|
|
|
, pkg-config
|
|
|
|
, rapidcheck
|
|
|
|
, sqlite
|
|
|
|
, util-linux
|
|
|
|
, xz
|
2023-12-03 17:47:07 +00:00
|
|
|
|
2023-12-03 21:48:50 +00:00
|
|
|
, busybox-sandbox-shell ? null
|
|
|
|
|
2023-12-03 17:47:07 +00:00
|
|
|
# Configuration Options
|
2023-12-03 23:12:05 +00:00
|
|
|
#:
|
2023-12-03 17:47:07 +00:00
|
|
|
# This probably seems like too many degrees of freedom, but it
|
|
|
|
# faithfully reflects how the underlying configure + make build system
|
2023-12-03 23:39:33 +00:00
|
|
|
# work. The top-level flake.nix will choose useful combinations of these
|
|
|
|
# options to CI.
|
2023-12-03 17:47:07 +00:00
|
|
|
|
2023-12-03 19:10:09 +00:00
|
|
|
, pname ? "nix"
|
|
|
|
|
2023-12-03 23:12:05 +00:00
|
|
|
, versionSuffix ? ""
|
|
|
|
, officialRelease ? false
|
|
|
|
|
2023-12-03 23:39:33 +00:00
|
|
|
# Whether to build Nix. Useful to skip for tasks like (a) just
|
|
|
|
# generating API docs or (b) testing existing pre-built versions of Nix
|
2023-12-03 19:10:09 +00:00
|
|
|
, doBuild ? true
|
2023-12-03 23:39:33 +00:00
|
|
|
|
|
|
|
# Run the unit tests as part of the build. See `installUnitTests` for an
|
|
|
|
# alternative to this.
|
2023-12-03 21:48:50 +00:00
|
|
|
, doCheck ? __forDefaults.canRunInstalled
|
2023-12-03 23:39:33 +00:00
|
|
|
|
|
|
|
# Run the functional tests as part of the build.
|
2023-12-03 23:12:05 +00:00
|
|
|
, doInstallCheck ? test-client != null || __forDefaults.canRunInstalled
|
2023-12-03 19:10:09 +00:00
|
|
|
|
2023-12-03 23:39:33 +00:00
|
|
|
# Check test coverage of Nix. Probably want to use with with at least
|
|
|
|
# one of `doCHeck` or `doInstallCheck` enabled.
|
2023-12-03 19:10:09 +00:00
|
|
|
, withCoverageChecks ? false
|
|
|
|
|
2023-12-03 21:48:50 +00:00
|
|
|
# Whether to build the regular manual
|
|
|
|
, enableManual ? __forDefaults.canRunInstalled
|
2023-12-03 23:39:33 +00:00
|
|
|
|
2024-01-09 22:31:40 +00:00
|
|
|
# Whether to use garbage collection for the Nix language evaluator.
|
|
|
|
#
|
|
|
|
# If it is disabled, we just leak memory, but this is not as bad as it
|
|
|
|
# sounds so long as evaluation just takes places within short-lived
|
|
|
|
# processes. (When the process exits, the memory is reclaimed; it is
|
|
|
|
# only leaked *within* the process.)
|
|
|
|
, enableGC ? true
|
|
|
|
|
2024-01-08 19:37:42 +00:00
|
|
|
# Whether to enable Markdown rendering in the Nix binary.
|
|
|
|
, enableMarkdown ? !stdenv.hostPlatform.isWindows
|
|
|
|
|
2023-09-02 19:56:37 +00:00
|
|
|
# Which interactive line editor library to use for Nix's repl.
|
|
|
|
#
|
|
|
|
# Currently supported choices are:
|
|
|
|
#
|
|
|
|
# - editline (default)
|
|
|
|
# - readline
|
|
|
|
, readlineFlavor ? if stdenv.hostPlatform.isWindows then "readline" else "editline"
|
|
|
|
|
2023-12-03 23:39:33 +00:00
|
|
|
# Whether to compile `rl-next.md`, the release notes for the next
|
|
|
|
# not-yet-released version of Nix in the manul, from the individual
|
|
|
|
# change log entries in the directory.
|
2023-12-03 23:12:05 +00:00
|
|
|
, buildUnreleasedNotes ? false
|
2023-12-03 23:39:33 +00:00
|
|
|
|
2023-12-03 19:10:09 +00:00
|
|
|
# Whether to build the internal API docs, can be done separately from
|
|
|
|
# everything else.
|
|
|
|
, enableInternalAPIDocs ? false
|
|
|
|
|
2023-12-03 17:47:07 +00:00
|
|
|
# Whether to install unit tests. This is useful when cross compiling
|
|
|
|
# since we cannot run them natively during the build, but can do so
|
|
|
|
# later.
|
2024-01-11 18:55:28 +00:00
|
|
|
, installUnitTests ? doBuild && !__forDefaults.canExecuteHost
|
2023-12-03 19:10:09 +00:00
|
|
|
|
2023-12-03 21:48:50 +00:00
|
|
|
# For running the functional tests against a pre-built Nix. Probably
|
|
|
|
# want to use in conjunction with `doBuild = false;`.
|
2023-12-03 19:10:09 +00:00
|
|
|
, test-daemon ? null
|
|
|
|
, test-client ? null
|
2023-12-03 21:48:50 +00:00
|
|
|
|
2023-12-18 20:59:58 +00:00
|
|
|
# Avoid setting things that would interfere with a functioning devShell
|
|
|
|
, forDevShell ? false
|
|
|
|
|
2023-12-03 21:48:50 +00:00
|
|
|
# Not a real argument, just the only way to approximate let-binding some
|
|
|
|
# stuff for argument defaults.
|
|
|
|
, __forDefaults ? {
|
2024-01-11 18:55:28 +00:00
|
|
|
canExecuteHost = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
|
|
|
canRunInstalled = doBuild && __forDefaults.canExecuteHost;
|
2023-12-03 21:48:50 +00:00
|
|
|
}
|
2023-12-13 20:41:41 +00:00
|
|
|
}:
|
2023-11-30 22:48:44 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
version = lib.fileContents ./.version + versionSuffix;
|
2023-12-02 17:25:47 +00:00
|
|
|
|
2023-12-03 21:48:50 +00:00
|
|
|
# selected attributes with defaults, will be used to define some
|
|
|
|
# things which should instead be gotten via `finalAttrs` in order to
|
|
|
|
# work with overriding.
|
2023-12-03 19:10:09 +00:00
|
|
|
attrs = {
|
|
|
|
inherit doBuild doCheck doInstallCheck;
|
|
|
|
};
|
|
|
|
|
|
|
|
mkDerivation =
|
|
|
|
if withCoverageChecks
|
2023-12-03 23:12:05 +00:00
|
|
|
then
|
|
|
|
# TODO support `finalAttrs` args function in
|
|
|
|
# `releaseTools.coverageAnalysis`.
|
|
|
|
argsFun:
|
|
|
|
releaseTools.coverageAnalysis (let args = argsFun args; in args)
|
2023-12-03 19:10:09 +00:00
|
|
|
else stdenv.mkDerivation;
|
2023-11-30 22:48:44 +00:00
|
|
|
in
|
|
|
|
|
2023-12-03 19:10:09 +00:00
|
|
|
mkDerivation (finalAttrs: let
|
|
|
|
|
|
|
|
inherit (finalAttrs)
|
|
|
|
doCheck
|
|
|
|
doInstallCheck
|
|
|
|
;
|
|
|
|
|
|
|
|
doBuild = !finalAttrs.dontBuild;
|
2023-12-03 17:47:07 +00:00
|
|
|
|
|
|
|
# Either running the unit tests during the build, or installing them
|
|
|
|
# to be run later, requiresthe unit tests to be built.
|
2023-12-03 19:10:09 +00:00
|
|
|
buildUnitTests = doCheck || installUnitTests;
|
|
|
|
|
2023-12-03 17:47:07 +00:00
|
|
|
in {
|
2023-12-03 19:10:09 +00:00
|
|
|
inherit pname version;
|
2023-11-30 22:48:44 +00:00
|
|
|
|
|
|
|
src =
|
|
|
|
let
|
2023-12-14 05:05:03 +00:00
|
|
|
baseFiles = fileset.fileFilter (f: f.name != ".gitignore") ./.;
|
2023-11-30 22:48:44 +00:00
|
|
|
in
|
|
|
|
fileset.toSource {
|
|
|
|
root = ./.;
|
2023-12-14 05:05:03 +00:00
|
|
|
fileset = fileset.intersect baseFiles (fileset.unions ([
|
|
|
|
# For configure
|
|
|
|
./.version
|
|
|
|
./configure.ac
|
|
|
|
./m4
|
|
|
|
# TODO: do we really need README.md? It doesn't seem used in the build.
|
|
|
|
./README.md
|
|
|
|
# For make, regardless of what we are building
|
|
|
|
./local.mk
|
|
|
|
./Makefile
|
|
|
|
./Makefile.config.in
|
|
|
|
./mk
|
|
|
|
(fileset.fileFilter (f: lib.strings.hasPrefix "nix-profile" f.name) ./scripts)
|
2023-12-03 19:10:09 +00:00
|
|
|
] ++ lib.optionals doBuild [
|
2023-11-30 22:48:44 +00:00
|
|
|
./doc
|
|
|
|
./misc
|
|
|
|
./precompiled-headers.h
|
|
|
|
./src
|
|
|
|
./COPYING
|
|
|
|
./scripts/local.mk
|
2023-12-14 05:05:03 +00:00
|
|
|
] ++ lib.optionals buildUnitTests [
|
|
|
|
./doc/manual
|
|
|
|
] ++ lib.optionals enableInternalAPIDocs [
|
|
|
|
./doc/internal-api
|
2024-01-08 19:47:42 +00:00
|
|
|
# Source might not be compiled, but still must be available
|
|
|
|
# for Doxygen to gather comments.
|
|
|
|
./src
|
|
|
|
./tests/unit
|
2023-12-14 05:05:03 +00:00
|
|
|
] ++ lib.optionals buildUnitTests [
|
|
|
|
./tests/unit
|
|
|
|
] ++ lib.optionals doInstallCheck [
|
|
|
|
./tests/functional
|
2023-12-03 19:10:09 +00:00
|
|
|
]));
|
2023-11-30 22:48:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
VERSION_SUFFIX = versionSuffix;
|
|
|
|
|
2023-12-03 21:48:50 +00:00
|
|
|
outputs = [ "out" ]
|
|
|
|
++ lib.optional doBuild "dev"
|
|
|
|
# If we are doing just build or just docs, the one thing will use
|
|
|
|
# "out". We only need additional outputs if we are doing both.
|
|
|
|
++ lib.optional (doBuild && (enableManual || enableInternalAPIDocs)) "doc"
|
2023-12-03 17:47:07 +00:00
|
|
|
++ lib.optional installUnitTests "check";
|
2023-11-30 22:48:44 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2023-12-03 23:12:05 +00:00
|
|
|
autoconf-archive
|
|
|
|
autoreconfHook
|
|
|
|
pkg-config
|
|
|
|
] ++ lib.optionals doBuild [
|
2023-11-30 22:48:44 +00:00
|
|
|
bison
|
|
|
|
flex
|
2023-12-03 23:12:05 +00:00
|
|
|
] ++ lib.optionals enableManual [
|
2023-11-30 22:48:44 +00:00
|
|
|
(lib.getBin lowdown)
|
|
|
|
mdbook
|
|
|
|
mdbook-linkcheck
|
2023-12-03 23:12:05 +00:00
|
|
|
] ++ lib.optionals (doInstallCheck || enableManual) [
|
|
|
|
jq # Also for custom mdBook preprocessor.
|
|
|
|
] ++ lib.optional stdenv.hostPlatform.isLinux util-linux
|
|
|
|
# Official releases don't have rl-next, so we don't need to compile a
|
|
|
|
# changelog
|
|
|
|
++ lib.optional (!officialRelease && buildUnreleasedNotes) changelog-d
|
|
|
|
++ lib.optional enableInternalAPIDocs doxygen
|
|
|
|
;
|
2023-11-30 22:48:44 +00:00
|
|
|
|
2023-12-03 21:48:50 +00:00
|
|
|
buildInputs = lib.optionals doBuild [
|
2023-11-30 22:48:44 +00:00
|
|
|
boost
|
|
|
|
brotli
|
|
|
|
bzip2
|
|
|
|
curl
|
|
|
|
libarchive
|
|
|
|
libgit2
|
|
|
|
libsodium
|
|
|
|
openssl
|
|
|
|
sqlite
|
|
|
|
xz
|
2023-09-02 19:56:37 +00:00
|
|
|
({ inherit readline editline; }.${readlineFlavor})
|
2024-01-08 19:37:42 +00:00
|
|
|
] ++ lib.optionals enableMarkdown [
|
2023-12-11 20:26:12 +00:00
|
|
|
lowdown
|
2024-01-02 17:41:53 +00:00
|
|
|
] ++ lib.optionals buildUnitTests [
|
|
|
|
gtest
|
|
|
|
rapidcheck
|
2023-12-03 21:48:50 +00:00
|
|
|
] ++ lib.optional stdenv.isLinux libseccomp
|
|
|
|
++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid
|
|
|
|
# There have been issues building these dependencies
|
|
|
|
++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform && (stdenv.isLinux || stdenv.isDarwin))
|
|
|
|
(aws-sdk-cpp.override {
|
|
|
|
apis = ["s3" "transfer"];
|
|
|
|
customMemoryManagement = false;
|
|
|
|
})
|
2023-12-01 11:25:22 +00:00
|
|
|
;
|
|
|
|
|
2023-12-03 19:10:09 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
nlohmann_json
|
2024-01-09 22:31:40 +00:00
|
|
|
] ++ lib.optional enableGC boehmgc;
|
2023-12-03 19:10:09 +00:00
|
|
|
|
|
|
|
dontBuild = !attrs.doBuild;
|
|
|
|
doCheck = attrs.doCheck;
|
2023-12-01 11:25:22 +00:00
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
git
|
2023-12-02 16:08:06 +00:00
|
|
|
mercurial
|
|
|
|
openssh
|
2023-11-30 22:48:44 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
disallowedReferences = [ boost ];
|
|
|
|
|
2023-12-13 20:49:31 +00:00
|
|
|
preConfigure = lib.optionalString (doBuild && ! stdenv.hostPlatform.isStatic) (
|
|
|
|
''
|
|
|
|
# Copy libboost_context so we don't get all of Boost in our closure.
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/45462
|
|
|
|
mkdir -p $out/lib
|
2024-01-05 14:15:25 +00:00
|
|
|
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
|
2023-12-13 20:49:31 +00:00
|
|
|
rm -f $out/lib/*.a
|
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
|
2023-12-01 11:25:22 +00:00
|
|
|
chmod u+w $out/lib/*.so.*
|
|
|
|
patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
|
2023-12-13 20:49:31 +00:00
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
2023-12-01 11:25:22 +00:00
|
|
|
for LIB in $out/lib/*.dylib; do
|
|
|
|
chmod u+w $LIB
|
|
|
|
install_name_tool -id $LIB $LIB
|
|
|
|
install_name_tool -delete_rpath ${boost}/lib/ $LIB || true
|
|
|
|
done
|
|
|
|
install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib
|
2023-12-13 20:49:31 +00:00
|
|
|
''
|
|
|
|
);
|
2023-11-30 22:48:44 +00:00
|
|
|
|
2023-12-03 19:10:09 +00:00
|
|
|
configureFlags = [
|
|
|
|
(lib.enableFeature doBuild "build")
|
2023-12-14 05:05:03 +00:00
|
|
|
(lib.enableFeature buildUnitTests "unit-tests")
|
|
|
|
(lib.enableFeature doInstallCheck "functional-tests")
|
2023-12-03 19:10:09 +00:00
|
|
|
(lib.enableFeature enableInternalAPIDocs "internal-api-docs")
|
2023-12-03 21:48:50 +00:00
|
|
|
(lib.enableFeature enableManual "doc-gen")
|
2024-01-09 22:31:40 +00:00
|
|
|
(lib.enableFeature enableGC "gc")
|
2024-01-08 19:37:42 +00:00
|
|
|
(lib.enableFeature enableMarkdown "markdown")
|
2023-12-03 19:10:09 +00:00
|
|
|
(lib.enableFeature installUnitTests "install-unit-tests")
|
2023-09-02 19:56:37 +00:00
|
|
|
(lib.withFeatureAs true "readline-flavor" readlineFlavor)
|
2023-12-18 20:59:58 +00:00
|
|
|
] ++ lib.optionals (!forDevShell) [
|
|
|
|
"--sysconfdir=/etc"
|
2023-12-03 19:10:09 +00:00
|
|
|
] ++ lib.optionals installUnitTests [
|
|
|
|
"--with-check-bin-dir=${builtins.placeholder "check"}/bin"
|
|
|
|
"--with-check-lib-dir=${builtins.placeholder "check"}/lib"
|
2023-12-13 22:02:52 +00:00
|
|
|
] ++ lib.optionals (doBuild) [
|
2023-12-03 19:10:09 +00:00
|
|
|
"--with-boost=${boost}/lib"
|
2023-12-13 22:02:52 +00:00
|
|
|
] ++ lib.optionals (doBuild && stdenv.isLinux) [
|
2023-12-03 21:48:50 +00:00
|
|
|
"--with-sandbox-shell=${busybox-sandbox-shell}/bin/busybox"
|
|
|
|
] ++ lib.optional (doBuild && stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux"))
|
2023-12-03 19:10:09 +00:00
|
|
|
"LDFLAGS=-fuse-ld=gold"
|
2023-12-03 21:48:50 +00:00
|
|
|
++ lib.optional (doBuild && stdenv.hostPlatform.isStatic) "--enable-embedded-sandbox-shell"
|
2024-01-12 04:50:03 +00:00
|
|
|
;
|
2023-11-30 22:48:44 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
makeFlags = "profiledir=$(out)/etc/profile.d PRECOMPILE_HEADERS=1";
|
|
|
|
|
2023-12-03 19:10:09 +00:00
|
|
|
installTargets = lib.optional doBuild "install"
|
|
|
|
++ lib.optional enableInternalAPIDocs "internal-api-html";
|
|
|
|
|
2023-11-30 22:48:44 +00:00
|
|
|
installFlags = "sysconfdir=$(out)/etc";
|
|
|
|
|
2023-12-03 19:10:09 +00:00
|
|
|
# In this case we are probably just running tests, and so there isn't
|
|
|
|
# anything to install, we just make an empty directory to signify tests
|
|
|
|
# succeeded.
|
|
|
|
installPhase = if finalAttrs.installTargets != [] then null else ''
|
|
|
|
mkdir -p $out
|
|
|
|
'';
|
|
|
|
|
2023-12-03 21:48:50 +00:00
|
|
|
postInstall = lib.optionalString doBuild (
|
2023-12-14 05:05:03 +00:00
|
|
|
lib.optionalString stdenv.hostPlatform.isStatic ''
|
2023-11-30 22:48:44 +00:00
|
|
|
mkdir -p $out/nix-support
|
|
|
|
echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products
|
2023-12-03 21:48:50 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2023-11-30 22:48:44 +00:00
|
|
|
install_name_tool \
|
|
|
|
-change ${boost}/lib/libboost_context.dylib \
|
|
|
|
$out/lib/libboost_context.dylib \
|
|
|
|
$out/lib/libnixutil.dylib
|
2023-12-03 21:48:50 +00:00
|
|
|
''
|
2023-12-14 05:05:03 +00:00
|
|
|
) + lib.optionalString enableManual ''
|
|
|
|
mkdir -p ''${!outputDoc}/nix-support
|
|
|
|
echo "doc manual ''${!outputDoc}/share/doc/nix/manual" >> ''${!outputDoc}/nix-support/hydra-build-products
|
|
|
|
'' + lib.optionalString enableInternalAPIDocs ''
|
2023-12-03 21:48:50 +00:00
|
|
|
mkdir -p ''${!outputDoc}/nix-support
|
|
|
|
echo "doc internal-api-docs $out/share/doc/nix/internal-api/html" >> ''${!outputDoc}/nix-support/hydra-build-products
|
2023-11-30 22:48:44 +00:00
|
|
|
'';
|
|
|
|
|
2023-12-03 19:10:09 +00:00
|
|
|
doInstallCheck = attrs.doInstallCheck;
|
|
|
|
|
2023-11-30 22:48:44 +00:00
|
|
|
installCheckFlags = "sysconfdir=$(out)/etc";
|
2023-12-03 23:57:16 +00:00
|
|
|
# Work around buggy detection in stdenv.
|
2023-12-03 23:12:05 +00:00
|
|
|
installCheckTarget = "installcheck";
|
|
|
|
|
2023-12-03 23:57:16 +00:00
|
|
|
# Work around weird bug where it doesn't think there is a Makefile.
|
2023-12-03 23:12:05 +00:00
|
|
|
installCheckPhase = if (!doBuild && doInstallCheck) then ''
|
|
|
|
mkdir -p src/nix-channel
|
|
|
|
make installcheck -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES
|
|
|
|
'' else null;
|
2023-11-30 22:48:44 +00:00
|
|
|
|
2023-12-03 19:10:09 +00:00
|
|
|
# Needed for tests if we are not doing a build, but testing existing
|
|
|
|
# built Nix.
|
|
|
|
preInstallCheck = lib.optionalString (! doBuild) ''
|
|
|
|
mkdir -p src/nix-channel
|
|
|
|
'';
|
|
|
|
|
2023-11-30 22:48:44 +00:00
|
|
|
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
|
|
|
|
2023-12-03 23:12:05 +00:00
|
|
|
# TODO `releaseTools.coverageAnalysis` in Nixpkgs needs to be updated
|
|
|
|
# to work with `strictDeps`.
|
|
|
|
strictDeps = !withCoverageChecks;
|
2023-11-30 22:48:44 +00:00
|
|
|
|
|
|
|
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
|
|
|
|
|
2023-12-03 19:10:09 +00:00
|
|
|
meta = {
|
2023-12-11 20:26:12 +00:00
|
|
|
platforms = lib.platforms.unix ++ lib.platforms.windows;
|
2023-12-03 19:10:09 +00:00
|
|
|
mainProgram = "nix";
|
|
|
|
broken = !(lib.all (a: a) [
|
2023-12-03 23:39:33 +00:00
|
|
|
# We cannot run or install unit tests if we don't build them or
|
|
|
|
# Nix proper (which they depend on).
|
2023-12-03 19:10:09 +00:00
|
|
|
(installUnitTests -> doBuild)
|
|
|
|
(doCheck -> doBuild)
|
2023-12-03 23:39:33 +00:00
|
|
|
# We have to build the manual to build unreleased notes, as those
|
|
|
|
# are part of the manual
|
|
|
|
(buildUnreleasedNotes -> enableManual)
|
2023-12-03 23:53:05 +00:00
|
|
|
# The build process for the manual currently requires extracting
|
|
|
|
# data from the Nix executable we are trying to document.
|
|
|
|
(enableManual -> doBuild)
|
2023-12-03 19:10:09 +00:00
|
|
|
]);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // lib.optionalAttrs withCoverageChecks {
|
|
|
|
lcovFilter = [ "*/boost/*" "*-tab.*" ];
|
|
|
|
|
|
|
|
hardeningDisable = ["fortify"];
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = "-DCOVERAGE=1";
|
|
|
|
|
|
|
|
dontInstall = false;
|
|
|
|
} // lib.optionalAttrs (test-daemon != null) {
|
|
|
|
NIX_DAEMON_PACKAGE = test-daemon;
|
|
|
|
} // lib.optionalAttrs (test-client != null) {
|
|
|
|
NIX_CLIENT_PACKAGE = test-client;
|
2023-11-30 22:48:44 +00:00
|
|
|
})
|