mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
WIP
This commit is contained in:
parent
0ca49b0c86
commit
ce598bae14
5 changed files with 117 additions and 100 deletions
|
@ -26,12 +26,4 @@ releaseTools.coverageAnalysis {
|
||||||
;
|
;
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
dontInstall = false;
|
|
||||||
|
|
||||||
lcovFilter = [ "*/boost/*" "*-tab.*" ];
|
|
||||||
|
|
||||||
hardeningDisable = ["fortify"];
|
|
||||||
|
|
||||||
NIX_CFLAGS_COMPILE = "-DCOVERAGE=1";
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,7 +276,12 @@
|
||||||
coverage = nixpkgsFor.x86_64-linux.native.callPackage ./coverage.nix {};
|
coverage = nixpkgsFor.x86_64-linux.native.callPackage ./coverage.nix {};
|
||||||
|
|
||||||
# API docs for Nix's unstable internal C++ interfaces.
|
# API docs for Nix's unstable internal C++ interfaces.
|
||||||
internal-api-docs = nixpkgsFor.x86_64-linux.native.callPackage ./internal-api-docs.nix {};
|
internal-api-docs = nixpkgsFor.x86_64-linux.native.callPackage ./package.nix {
|
||||||
|
doBuild = false;
|
||||||
|
doCheck = false;
|
||||||
|
doInstallCheck = false;
|
||||||
|
enableInternalAPIDocs = true;
|
||||||
|
};
|
||||||
|
|
||||||
# System tests.
|
# System tests.
|
||||||
tests = import ./tests/nixos { inherit lib nixpkgs nixpkgsFor; } // {
|
tests = import ./tests/nixos { inherit lib nixpkgs nixpkgsFor; } // {
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
{ nix
|
|
||||||
, doxygen
|
|
||||||
}:
|
|
||||||
|
|
||||||
nix.overrideAttrs (old: {
|
|
||||||
pname = "nix-internal-api-docs";
|
|
||||||
|
|
||||||
configureFlags = old.configureFlags ++ [
|
|
||||||
"--enable-internal-api-docs"
|
|
||||||
];
|
|
||||||
nativeBuildInputs = old.nativeBuildInputs ++ [
|
|
||||||
doxygen
|
|
||||||
];
|
|
||||||
|
|
||||||
dontBuild = true;
|
|
||||||
doCheck = false;
|
|
||||||
|
|
||||||
installTargets = [ "internal-api-html" ];
|
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
mkdir -p $out/nix-support
|
|
||||||
echo "doc internal-api-docs $out/share/doc/nix/internal-api/html" >> $out/nix-support/hydra-build-products
|
|
||||||
'';
|
|
||||||
})
|
|
139
package.nix
139
package.nix
|
@ -1,6 +1,7 @@
|
||||||
{ lib
|
{ lib
|
||||||
, callPackage
|
, callPackage
|
||||||
, stdenv
|
, stdenv
|
||||||
|
, releaseTools
|
||||||
, versionSuffix ? ""
|
, versionSuffix ? ""
|
||||||
, officialRelease ? false
|
, officialRelease ? false
|
||||||
, buildUnreleasedNotes ? false
|
, buildUnreleasedNotes ? false
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
, git
|
, git
|
||||||
, gtest
|
, gtest
|
||||||
, jq
|
, jq
|
||||||
|
, doxygen
|
||||||
, libarchive
|
, libarchive
|
||||||
, libcpuid
|
, libcpuid
|
||||||
, libgit2
|
, libgit2
|
||||||
|
@ -45,16 +47,35 @@
|
||||||
# faithfully reflects how the underlying configure + make build system
|
# faithfully reflects how the underlying configure + make build system
|
||||||
# work. The top-level flake.nix will choose useful combinations.
|
# work. The top-level flake.nix will choose useful combinations.
|
||||||
|
|
||||||
|
, pname ? "nix"
|
||||||
|
|
||||||
|
, doBuild ? true
|
||||||
|
, doCheck ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
|
||||||
|
, doInstallCheck ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
|
||||||
|
|
||||||
|
, withCoverageChecks ? false
|
||||||
|
|
||||||
|
# Whether to build the internal API docs, can be done separately from
|
||||||
|
# everything else.
|
||||||
|
, enableInternalAPIDocs ? false
|
||||||
|
|
||||||
# Whether to install unit tests. This is useful when cross compiling
|
# Whether to install unit tests. This is useful when cross compiling
|
||||||
# since we cannot run them natively during the build, but can do so
|
# since we cannot run them natively during the build, but can do so
|
||||||
# later.
|
# later.
|
||||||
, installUnitTests ? stdenv.hostPlatform != stdenv.buildPlatform
|
, installUnitTests ? stdenv.hostPlatform != stdenv.buildPlatform
|
||||||
|
|
||||||
|
, test-daemon ? null
|
||||||
|
, test-client ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = lib.fileContents ./.version + versionSuffix;
|
version = lib.fileContents ./.version + versionSuffix;
|
||||||
canRunInstalled = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
canRunInstalled = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
||||||
|
|
||||||
|
attrs = {
|
||||||
|
inherit doBuild doCheck doInstallCheck;
|
||||||
|
};
|
||||||
|
|
||||||
filesets = {
|
filesets = {
|
||||||
baseFiles = fileset.fileFilter (f: f.name != ".gitignore") ./.;
|
baseFiles = fileset.fileFilter (f: f.name != ".gitignore") ./.;
|
||||||
|
|
||||||
|
@ -78,17 +99,30 @@ let
|
||||||
(fileset.fileFilter (f: lib.strings.hasPrefix "nix-profile" f.name) ./scripts)
|
(fileset.fileFilter (f: lib.strings.hasPrefix "nix-profile" f.name) ./scripts)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkDerivation =
|
||||||
|
if withCoverageChecks
|
||||||
|
then releaseTools.coverageAnalysis
|
||||||
|
else stdenv.mkDerivation;
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation (finalAttrs: let
|
mkDerivation (finalAttrs: let
|
||||||
|
|
||||||
|
inherit (finalAttrs)
|
||||||
|
doCheck
|
||||||
|
doInstallCheck
|
||||||
|
;
|
||||||
|
|
||||||
|
doBuild = !finalAttrs.dontBuild;
|
||||||
|
|
||||||
# Either running the unit tests during the build, or installing them
|
# Either running the unit tests during the build, or installing them
|
||||||
# to be run later, requiresthe unit tests to be built.
|
# to be run later, requiresthe unit tests to be built.
|
||||||
buildUnitTests = finalAttrs.doCheck || installUnitTests;
|
buildUnitTests = doCheck || installUnitTests;
|
||||||
|
|
||||||
|
anySortOfTesting = buildUnitTests || doInstallCheck;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
pname = "nix";
|
inherit pname version;
|
||||||
inherit version;
|
|
||||||
|
|
||||||
src =
|
src =
|
||||||
let
|
let
|
||||||
|
@ -96,9 +130,10 @@ in {
|
||||||
in
|
in
|
||||||
fileset.toSource {
|
fileset.toSource {
|
||||||
root = ./.;
|
root = ./.;
|
||||||
fileset = fileset.intersect filesets.baseFiles (fileset.unions [
|
fileset = fileset.intersect filesets.baseFiles (fileset.unions ([
|
||||||
filesets.configureFiles
|
filesets.configureFiles
|
||||||
filesets.topLevelBuildFiles
|
filesets.topLevelBuildFiles
|
||||||
|
] ++ lib.optionals doBuild [
|
||||||
./boehmgc-coroutine-sp-fallback.diff
|
./boehmgc-coroutine-sp-fallback.diff
|
||||||
./doc
|
./doc
|
||||||
./misc
|
./misc
|
||||||
|
@ -107,8 +142,9 @@ in {
|
||||||
./unit-test-data
|
./unit-test-data
|
||||||
./COPYING
|
./COPYING
|
||||||
./scripts/local.mk
|
./scripts/local.mk
|
||||||
|
] ++ lib.optionals anySortOfTesting [
|
||||||
filesets.functionalTestFiles
|
filesets.functionalTestFiles
|
||||||
]);
|
]));
|
||||||
};
|
};
|
||||||
|
|
||||||
VERSION_SUFFIX = versionSuffix;
|
VERSION_SUFFIX = versionSuffix;
|
||||||
|
@ -159,7 +195,13 @@ in {
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
doCheck = stdenv.hostPlatform != stdenv.buildPlatform;
|
propagatedBuildInputs = [
|
||||||
|
boehmgc
|
||||||
|
nlohmann_json
|
||||||
|
];
|
||||||
|
|
||||||
|
dontBuild = !attrs.doBuild;
|
||||||
|
doCheck = attrs.doCheck;
|
||||||
|
|
||||||
checkInputs = [
|
checkInputs = [
|
||||||
# see buildInputs. The configure script always wants its test libs
|
# see buildInputs. The configure script always wants its test libs
|
||||||
|
@ -169,11 +211,8 @@ in {
|
||||||
git
|
git
|
||||||
mercurial
|
mercurial
|
||||||
openssh
|
openssh
|
||||||
];
|
] ++ lib.optionals enableInternalAPIDocs [
|
||||||
|
doxygen
|
||||||
propagatedBuildInputs = [
|
|
||||||
boehmgc
|
|
||||||
nlohmann_json
|
|
||||||
];
|
];
|
||||||
|
|
||||||
disallowedReferences = [ boost ];
|
disallowedReferences = [ boost ];
|
||||||
|
@ -198,30 +237,41 @@ in {
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configureFlags =
|
configureFlags = [
|
||||||
lib.optionals stdenv.isLinux [
|
"--sysconfdir=/etc"
|
||||||
"--with-boost=${boost}/lib"
|
(lib.enableFeature doBuild "build")
|
||||||
"--with-sandbox-shell=${sh}/bin/busybox"
|
(lib.enableFeature anySortOfTesting "test")
|
||||||
]
|
(lib.enableFeature enableInternalAPIDocs "internal-api-docs")
|
||||||
++ lib.optional (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux"))
|
(lib.enableFeature canRunInstalled "doc-gen")
|
||||||
"LDFLAGS=-fuse-ld=gold"
|
(lib.enableFeature installUnitTests "install-unit-tests")
|
||||||
++ [ "--sysconfdir=/etc" ]
|
] ++ lib.optionals installUnitTests [
|
||||||
++ lib.optional stdenv.hostPlatform.isStatic "--enable-embedded-sandbox-shell"
|
|
||||||
++ lib.optional buildUnitTests "RAPIDCHECK_HEADERS=${lib.getDev rapidcheck}/extras/gtest/include"
|
|
||||||
++ lib.optionals installUnitTests [
|
|
||||||
"--enable-install-unit-tests"
|
|
||||||
"--with-check-bin-dir=${builtins.placeholder "check"}/bin"
|
"--with-check-bin-dir=${builtins.placeholder "check"}/bin"
|
||||||
"--with-check-lib-dir=${builtins.placeholder "check"}/lib"
|
"--with-check-lib-dir=${builtins.placeholder "check"}/lib"
|
||||||
]
|
] ++ lib.optionals stdenv.isLinux [
|
||||||
++ lib.optional (!canRunInstalled) "--disable-doc-gen";
|
"--with-boost=${boost}/lib"
|
||||||
|
"--with-sandbox-shell=${sh}/bin/busybox"
|
||||||
|
] ++ lib.optional (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux"))
|
||||||
|
"LDFLAGS=-fuse-ld=gold"
|
||||||
|
++ lib.optional stdenv.hostPlatform.isStatic "--enable-embedded-sandbox-shell"
|
||||||
|
++ lib.optional buildUnitTests "RAPIDCHECK_HEADERS=${lib.getDev rapidcheck}/extras/gtest/include";
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
makeFlags = "profiledir=$(out)/etc/profile.d PRECOMPILE_HEADERS=1";
|
makeFlags = "profiledir=$(out)/etc/profile.d PRECOMPILE_HEADERS=1";
|
||||||
|
|
||||||
|
installTargets = lib.optional doBuild "install"
|
||||||
|
++ lib.optional enableInternalAPIDocs "internal-api-html";
|
||||||
|
|
||||||
installFlags = "sysconfdir=$(out)/etc";
|
installFlags = "sysconfdir=$(out)/etc";
|
||||||
|
|
||||||
postInstall = ''
|
# 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
|
||||||
|
'';
|
||||||
|
|
||||||
|
postInstall = lib.optionalString doBuild ''
|
||||||
mkdir -p $doc/nix-support
|
mkdir -p $doc/nix-support
|
||||||
echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products
|
echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products
|
||||||
${lib.optionalString stdenv.hostPlatform.isStatic ''
|
${lib.optionalString stdenv.hostPlatform.isStatic ''
|
||||||
|
@ -238,12 +288,22 @@ in {
|
||||||
$out/lib/libboost_regex.dylib \
|
$out/lib/libboost_regex.dylib \
|
||||||
$out/lib/libnixexpr.dylib
|
$out/lib/libnixexpr.dylib
|
||||||
''}
|
''}
|
||||||
|
'' + lib.optionalString enableInternalAPIDocs ''
|
||||||
|
mkdir -p $out/nix-support
|
||||||
|
echo "doc internal-api-docs $out/share/doc/nix/internal-api/html" >> $out/nix-support/hydra-build-products
|
||||||
'';
|
'';
|
||||||
|
|
||||||
doInstallCheck = finalAttrs.doCheck;
|
doInstallCheck = attrs.doInstallCheck;
|
||||||
|
|
||||||
installCheckFlags = "sysconfdir=$(out)/etc";
|
installCheckFlags = "sysconfdir=$(out)/etc";
|
||||||
installCheckTarget = "installcheck"; # work around buggy detection in stdenv
|
installCheckTarget = "installcheck"; # work around buggy detection in stdenv
|
||||||
|
|
||||||
|
# Needed for tests if we are not doing a build, but testing existing
|
||||||
|
# built Nix.
|
||||||
|
preInstallCheck = lib.optionalString (! doBuild) ''
|
||||||
|
mkdir -p src/nix-channel
|
||||||
|
'';
|
||||||
|
|
||||||
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
||||||
|
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
|
@ -258,6 +318,25 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
meta.platforms = lib.platforms.unix;
|
meta = {
|
||||||
meta.mainProgram = "nix";
|
platforms = lib.platforms.unix;
|
||||||
|
mainProgram = "nix";
|
||||||
|
broken = !(lib.all (a: a) [
|
||||||
|
(installUnitTests -> doBuild)
|
||||||
|
(doCheck -> doBuild)
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // 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;
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,45 +6,10 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
NIX_DAEMON_PACKAGE = daemon;
|
|
||||||
NIX_CLIENT_PACKAGE = client;
|
|
||||||
name =
|
name =
|
||||||
"nix-tests"
|
"nix-tests"
|
||||||
+ lib.optionalString
|
+ lib.optionalString
|
||||||
(lib.versionAtLeast daemon.version "2.4pre20211005" &&
|
(lib.versionAtLeast daemon.version "2.4pre20211005" &&
|
||||||
lib.versionAtLeast client.version "2.4pre20211005")
|
lib.versionAtLeast client.version "2.4pre20211005")
|
||||||
"-${client.version}-against-${daemon.version}";
|
"-${client.version}-against-${daemon.version}";
|
||||||
|
|
||||||
inherit (client)
|
|
||||||
version
|
|
||||||
VERSION_SUFFIX
|
|
||||||
nativeBuildInputs
|
|
||||||
buildInputs
|
|
||||||
propagatedBuildInputs
|
|
||||||
;
|
|
||||||
|
|
||||||
src = fileset.toSource {
|
|
||||||
root = ./.;
|
|
||||||
fileset = with client.passthru.filesets;
|
|
||||||
fileset.intersect baseFiles (fileset.unions [
|
|
||||||
configureFiles
|
|
||||||
topLevelBuildFiles
|
|
||||||
functionalTestFiles
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
|
|
||||||
configureFlags = client.configureFlags # otherwise configure fails
|
|
||||||
++ [ "--disable-build" ];
|
|
||||||
|
|
||||||
dontBuild = true;
|
|
||||||
doInstallCheck = true;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out
|
|
||||||
'';
|
|
||||||
|
|
||||||
installCheckPhase = ''
|
|
||||||
mkdir -p src/nix-channel
|
|
||||||
make installcheck -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue