diff --git a/doc/stdenv.xml b/doc/stdenv.xml
index 7154a576def..3a7b23baaa7 100644
--- a/doc/stdenv.xml
+++ b/doc/stdenv.xml
@@ -995,13 +995,14 @@ but only if the doCheck variable is enabled.
doCheck
- If set to a non-empty string, the check phase is
- executed, otherwise it is skipped (default). Thus you should set
-
-
-doCheck = true;
-
- in the derivation to enable checks.
+
+ Controls whether the check phase is executed.
+ By default it is skipped, but if doCheck is set to true, the check phase is usually executed.
+ Thus you should set doCheck = true; in the derivation to enable checks.
+ The exception is cross compilation.
+ Cross compiled builds never run tests, no matter how doCheck is set,
+ as the newly-built program won't run on the platform used to build it.
+
@@ -1280,12 +1281,14 @@ installcheck.
doInstallCheck
- If set to a non-empty string, the installCheck phase is
- executed, otherwise it is skipped (default). Thus you should set
-
- doInstallCheck = true;
-
- in the derivation to enable install checks.
+
+ Controls whether the installCheck phase is executed.
+ By default it is skipped, but if doInstallCheck is set to true, the installCheck phase is usually executed.
+ Thus you should set doInstallCheck = true; in the derivation to enable install checks.
+ The exception is cross compilation.
+ Cross compiled builds never run tests, no matter how doInstallCheck is set,
+ as the newly-built program won't run on the platform used to build it.
+
diff --git a/pkgs/applications/editors/ed/default.nix b/pkgs/applications/editors/ed/default.nix
index 6c2f1ea2003..d8af0c6888e 100644
--- a/pkgs/applications/editors/ed/default.nix
+++ b/pkgs/applications/editors/ed/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ lzip ];
- doCheck = hostPlatform == buildPlatform;
+ doCheck = true; # not cross;
meta = {
description = "An implementation of the standard Unix editor";
diff --git a/pkgs/development/libraries/boehm-gc/default.nix b/pkgs/development/libraries/boehm-gc/default.nix
index 421d7072397..9a01cdfe874 100644
--- a/pkgs/development/libraries/boehm-gc/default.nix
+++ b/pkgs/development/libraries/boehm-gc/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
[ "--enable-cplusplus" ]
++ lib.optional enableLargeConfig "--enable-large-config";
- doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
+ doCheck = true; # not cross;
# Don't run the native `strip' when cross-compiling.
dontStrip = hostPlatform != buildPlatform;
diff --git a/pkgs/development/libraries/expat/default.nix b/pkgs/development/libraries/expat/default.nix
index 01f3c11ac73..e341ce842eb 100644
--- a/pkgs/development/libraries/expat/default.nix
+++ b/pkgs/development/libraries/expat/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
outputMan = "dev"; # tiny page for a dev tool
- doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
+ doCheck = true; # not cross;
preCheck = ''
patchShebangs ./run.sh
diff --git a/pkgs/development/libraries/gdbm/default.nix b/pkgs/development/libraries/gdbm/default.nix
index 3b78225a447..7a602f5430e 100644
--- a/pkgs/development/libraries/gdbm/default.nix
+++ b/pkgs/development/libraries/gdbm/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
sha256 = "0lx201q20dvc70f8a3c9s7s18z15inlxvbffph97ngvrgnyjq9cx";
};
- doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
+ doCheck = true; # not cross;
# Linking static stubs on cygwin requires correct ordering.
# Consider upstreaming this.
diff --git a/pkgs/development/libraries/gmp/6.x.nix b/pkgs/development/libraries/gmp/6.x.nix
index dce052f8baa..5973c89cef7 100644
--- a/pkgs/development/libraries/gmp/6.x.nix
+++ b/pkgs/development/libraries/gmp/6.x.nix
@@ -1,6 +1,5 @@
{ stdenv, fetchurl, m4, cxx ? true
, buildPackages
-, buildPlatform, hostPlatform
, withStatic ? false }:
let inherit (stdenv.lib) optional optionalString; in
@@ -43,7 +42,7 @@ let self = stdenv.mkDerivation rec {
configureFlagsArray+=("--build=$(./configfsf.guess)")
'';
- doCheck = buildPlatform == hostPlatform;
+ doCheck = true; # not cross;
dontDisableStatic = withStatic;
diff --git a/pkgs/development/libraries/libjpeg-turbo/default.nix b/pkgs/development/libraries/libjpeg-turbo/default.nix
index bf626df28ea..4ec0e5ebd9f 100644
--- a/pkgs/development/libraries/libjpeg-turbo/default.nix
+++ b/pkgs/development/libraries/libjpeg-turbo/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
- doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
+ doCheck = true; # not cross;
checkTarget = "test";
meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/libmpc/default.nix b/pkgs/development/libraries/libmpc/default.nix
index 4be59af6f0c..d292dd1e536 100644
--- a/pkgs/development/libraries/libmpc/default.nix
+++ b/pkgs/development/libraries/libmpc/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
CFLAGS = "-I${gmp.dev}/include";
- doCheck = hostPlatform == buildPlatform;
+ doCheck = true; # not cross;
meta = {
description = "Library for multiprecision complex arithmetic with exact rounding";
diff --git a/pkgs/development/libraries/libpng/default.nix b/pkgs/development/libraries/libpng/default.nix
index c4a6a246b90..5ad9cf1e7b7 100644
--- a/pkgs/development/libraries/libpng/default.nix
+++ b/pkgs/development/libraries/libpng/default.nix
@@ -30,7 +30,7 @@ in stdenv.mkDerivation rec {
# it's hard to cross-run tests and some check programs didn't compile anyway
makeFlags = stdenv.lib.optional (!doCheck) "check_PROGRAMS=";
- doCheck = hostPlatform == buildPlatform;
+ doCheck = true; # not cross;
passthru = { inherit zlib; };
diff --git a/pkgs/development/libraries/libsigsegv/default.nix b/pkgs/development/libraries/libsigsegv/default.nix
index 8e1079bfbc8..4a13bfd9994 100644
--- a/pkgs/development/libraries/libsigsegv/default.nix
+++ b/pkgs/development/libraries/libsigsegv/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
patches = if enableSigbusFix then [ ./sigbus_fix.patch ] else null;
- doCheck = hostPlatform == buildPlatform;
+ doCheck = true; # not cross;
meta = {
homepage = http://www.gnu.org/software/libsigsegv/;
diff --git a/pkgs/development/libraries/libtiff/default.nix b/pkgs/development/libraries/libtiff/default.nix
index ee21f3df7ac..0f95b6d34c7 100644
--- a/pkgs/development/libraries/libtiff/default.nix
+++ b/pkgs/development/libraries/libtiff/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
- doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
+ doCheck = true; # not cross;
meta = with stdenv.lib; {
description = "Library and utilities for working with the TIFF image file format";
diff --git a/pkgs/development/libraries/lzo/default.nix b/pkgs/development/libraries/lzo/default.nix
index e8f8a6ab9bb..df5cb7c67f3 100644
--- a/pkgs/development/libraries/lzo/default.nix
+++ b/pkgs/development/libraries/lzo/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
- doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
+ doCheck = true; # not cross;
meta = with stdenv.lib; {
description = "Real-time data (de)compression library";
diff --git a/pkgs/development/libraries/mpfr/default.nix b/pkgs/development/libraries/mpfr/default.nix
index 6be199af193..fe364f22f9a 100644
--- a/pkgs/development/libraries/mpfr/default.nix
+++ b/pkgs/development/libraries/mpfr/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
stdenv.lib.optional hostPlatform.isSunOS "--disable-thread-safe" ++
stdenv.lib.optional hostPlatform.is64bit "--with-pic";
- doCheck = hostPlatform == buildPlatform;
+ doCheck = true; # not cross;
enableParallelBuilding = true;
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index 2d702ab389e..3ffa7cfe35f 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -36,6 +36,7 @@ rec {
, depsTargetTarget ? [] # 1 -> 1
, depsTargetTargetPropagated ? [] # 1 -> 1
+ # Configure Phase
, configureFlags ? []
, # Target is not included by default because most programs don't care.
# Including it then would cause needless mass rebuilds.
@@ -44,6 +45,13 @@ rec {
configurePlatforms ? lib.optionals
(stdenv.hostPlatform != stdenv.buildPlatform)
[ "build" "host" ]
+
+ # Check phase
+ , doCheck ? false
+
+ # InstallCheck phase
+ , doInstallCheck ? false
+
, crossConfig ? null
, meta ? {}
, passthru ? {}
@@ -60,6 +68,7 @@ rec {
, hardeningEnable ? []
, hardeningDisable ? []
+
, ... } @ attrs:
# TODO(@Ericson2314): Make this more modular, and not O(n^2).
@@ -178,9 +187,15 @@ rec {
"/bin/sh"
];
__propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps;
- } // (if outputs' != [ "out" ] then {
+ } // lib.optionalAttrs (outputs' != [ "out" ]) {
outputs = outputs';
- } else { }));
+ } // lib.optionalAttrs (attrs ? doCheck) {
+ # TODO(@Ericson2314): Make unconditional / resolve #33599
+ doCheck = doCheck && (stdenv.hostPlatform == stdenv.targetPlatform);
+ } // lib.optionalAttrs (attrs ? doInstallCheck) {
+ # TODO(@Ericson2314): Make unconditional / resolve #33599
+ doInstallCheck = doInstallCheck && (stdenv.hostPlatform == stdenv.targetPlatform);
+ });
# The meta attribute is passed in the resulting attribute set,
# but it's not part of the actual derivation, i.e., it's not
diff --git a/pkgs/tools/system/ddrescue/default.nix b/pkgs/tools/system/ddrescue/default.nix
index bf2ff5a6206..e6af7abeda2 100644
--- a/pkgs/tools/system/ddrescue/default.nix
+++ b/pkgs/tools/system/ddrescue/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ lzip ];
- doCheck = hostPlatform == buildPlatform;
+ doCheck = true; # not cross;
configureFlags = [ "CXX=${stdenv.cc.targetPrefix}c++" ];
meta = with stdenv.lib; {
diff --git a/pkgs/tools/text/gnupatch/default.nix b/pkgs/tools/text/gnupatch/default.nix
index 13579b57e79..dfdb25438cf 100644
--- a/pkgs/tools/text/gnupatch/default.nix
+++ b/pkgs/tools/text/gnupatch/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
"ac_cv_func_strnlen_working=yes"
];
- doCheck = hostPlatform == buildPlatform;
+ doCheck = true; # not cross;
meta = {
description = "GNU Patch, a program to apply differences to files";