mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-01-31 15:36:47 +02:00
Add installing unit test flags
This commit is contained in:
parent
19d41fb20a
commit
0ca49b0c86
1 changed files with 26 additions and 11 deletions
37
package.nix
37
package.nix
|
@ -38,6 +38,17 @@
|
||||||
, sqlite
|
, sqlite
|
||||||
, util-linux
|
, util-linux
|
||||||
, xz
|
, xz
|
||||||
|
|
||||||
|
# Configuration Options
|
||||||
|
#
|
||||||
|
# This probably seems like too many degrees of freedom, but it
|
||||||
|
# faithfully reflects how the underlying configure + make build system
|
||||||
|
# work. The top-level flake.nix will choose useful combinations.
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
, installUnitTests ? stdenv.hostPlatform != stdenv.buildPlatform
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -69,7 +80,13 @@ let
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
stdenv.mkDerivation (finalAttrs: let
|
||||||
|
|
||||||
|
# Either running the unit tests during the build, or installing them
|
||||||
|
# to be run later, requiresthe unit tests to be built.
|
||||||
|
buildUnitTests = finalAttrs.doCheck || installUnitTests;
|
||||||
|
|
||||||
|
in {
|
||||||
pname = "nix";
|
pname = "nix";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
|
@ -97,7 +114,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
VERSION_SUFFIX = versionSuffix;
|
VERSION_SUFFIX = versionSuffix;
|
||||||
|
|
||||||
outputs = [ "out" "dev" "doc" ]
|
outputs = [ "out" "dev" "doc" ]
|
||||||
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "check";
|
++ lib.optional installUnitTests "check";
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
bison
|
bison
|
||||||
|
@ -142,7 +159,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = stdenv.hostPlatform != stdenv.buildPlatform;
|
||||||
|
|
||||||
checkInputs = [
|
checkInputs = [
|
||||||
# see buildInputs. The configure script always wants its test libs
|
# see buildInputs. The configure script always wants its test libs
|
||||||
|
@ -190,14 +207,12 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
"LDFLAGS=-fuse-ld=gold"
|
"LDFLAGS=-fuse-ld=gold"
|
||||||
++ [ "--sysconfdir=/etc" ]
|
++ [ "--sysconfdir=/etc" ]
|
||||||
++ lib.optional stdenv.hostPlatform.isStatic "--enable-embedded-sandbox-shell"
|
++ lib.optional stdenv.hostPlatform.isStatic "--enable-embedded-sandbox-shell"
|
||||||
++ [ (lib.enableFeature finalAttrs.doCheck "tests") ]
|
++ lib.optional buildUnitTests "RAPIDCHECK_HEADERS=${lib.getDev rapidcheck}/extras/gtest/include"
|
||||||
++ lib.optionals finalAttrs.doCheck (
|
++ lib.optionals installUnitTests [
|
||||||
[ "RAPIDCHECK_HEADERS=${lib.getDev rapidcheck}/extras/gtest/include" ]
|
"--enable-install-unit-tests"
|
||||||
++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
"--with-check-bin-dir=${builtins.placeholder "check"}/bin"
|
||||||
"--enable-install-unit-tests"
|
"--with-check-lib-dir=${builtins.placeholder "check"}/lib"
|
||||||
"--with-check-bin-dir=${builtins.placeholder "check"}/bin"
|
]
|
||||||
"--with-check-lib-dir=${builtins.placeholder "check"}/lib"
|
|
||||||
])
|
|
||||||
++ lib.optional (!canRunInstalled) "--disable-doc-gen";
|
++ lib.optional (!canRunInstalled) "--disable-doc-gen";
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
Loading…
Reference in a new issue