Skip to content

Commit

Permalink
treewide: finalAttrs.doCheck -> finalAttrs.finalPackage.doCheck
Browse files Browse the repository at this point in the history
This will respect `doCheck = false;` overrides, common for cross.
  • Loading branch information
pbsds committed Nov 30, 2023
1 parent 9b11307 commit ad5e744
Show file tree
Hide file tree
Showing 31 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion pkgs/by-name/db/dbus-cpp/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ stdenv.mkDerivation (finalAttrs: {
# pkg-config output patching hook expects prefix variable here
substituteInPlace data/dbus-cpp.pc.in \
--replace 'includedir=''${exec_prefix}' 'includedir=''${prefix}'
'' + lib.optionalString (!finalAttrs.doCheck) ''
'' + lib.optionalString (!finalAttrs.finalPackage.doCheck) ''
sed -i -e '/add_subdirectory(tests)/d' CMakeLists.txt
'';

Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ne/net-cpp/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ stdenv.mkDerivation (finalAttrs: {
})
];

postPatch = lib.optionalString finalAttrs.doCheck ''
postPatch = lib.optionalString finalAttrs.finalPackage.doCheck ''
# Use wrapped python. Removing just the /usr/bin doesn't seem to work?
substituteInPlace tests/httpbin.h.in \
--replace '/usr/bin/python3' '${lib.getExe pythonEnv}'
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/tr/trealla/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optional enableSSL openssl
++ lib.optional (lineEditingLibrary == "readline") readline;

nativeCheckInputs = lib.optionals finalAttrs.doCheck [ valgrind ];
nativeCheckInputs = lib.optionals finalAttrs.finalPackage.doCheck [ valgrind ];

strictDeps = true;

Expand Down
2 changes: 1 addition & 1 deletion pkgs/desktops/lomiri/development/deviceinfo/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ stdenv.mkDerivation (finalAttrs: {
];

cmakeFlags = [
"-DDISABLE_TESTS=${lib.boolToString (!finalAttrs.doCheck)}"
"-DDISABLE_TESTS=${lib.boolToString (!finalAttrs.finalPackage.doCheck)}"
];

doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
Expand Down
4 changes: 2 additions & 2 deletions pkgs/desktops/lomiri/development/geonames/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ stdenv.mkDerivation (finalAttrs: {
];

# Tests need to be able to check locale
LC_ALL = lib.optionalString finalAttrs.doCheck "en_US.UTF-8";
LC_ALL = lib.optionalString finalAttrs.finalPackage.doCheck "en_US.UTF-8";
nativeCheckInputs = [
glibcLocales
];
Expand All @@ -86,7 +86,7 @@ stdenv.mkDerivation (finalAttrs: {
cmakeFlags = [
"-DWANT_DOC=${lib.boolToString withDocumentation}"
"-DWANT_DEMO=${lib.boolToString withExamples}"
"-DWANT_TESTS=${lib.boolToString finalAttrs.doCheck}"
"-DWANT_TESTS=${lib.boolToString finalAttrs.finalPackage.doCheck}"
# Keeps finding & using glib-compile-resources from buildInputs otherwise
"-DCMAKE_PROGRAM_PATH=${lib.makeBinPath [ buildPackages.glib.dev ]}"
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
Expand Down
2 changes: 1 addition & 1 deletion pkgs/desktops/lomiri/development/gmenuharness/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ stdenv.mkDerivation (finalAttrs: {
];

cmakeFlags = [
"-Denable_tests=${lib.boolToString finalAttrs.doCheck}"
"-Denable_tests=${lib.boolToString finalAttrs.finalPackage.doCheck}"
];

dontWrapQtApps = true;
Expand Down
4 changes: 2 additions & 2 deletions pkgs/desktops/lomiri/development/libusermetrics/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ stdenv.mkDerivation (finalAttrs: {
substituteInPlace doc/CMakeLists.txt \
--replace "\''${CMAKE_INSTALL_DATAROOTDIR}/doc/libusermetrics-doc" "\''${CMAKE_INSTALL_DOCDIR}"
'' + lib.optionalString (!finalAttrs.doCheck) ''
'' + lib.optionalString (!finalAttrs.finalPackage.doCheck) ''
# Only needed by tests
sed -i -e '/QTDBUSTEST/d' CMakeLists.txt
'';
Expand Down Expand Up @@ -93,7 +93,7 @@ stdenv.mkDerivation (finalAttrs: {
cmakeFlags = [
"-DGSETTINGS_LOCALINSTALL=ON"
"-DGSETTINGS_COMPILE=ON"
"-DENABLE_TESTS=${lib.boolToString finalAttrs.doCheck}"
"-DENABLE_TESTS=${lib.boolToString finalAttrs.finalPackage.doCheck}"
];

doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/cairo/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ in {
"-Dspectre=disabled"

(lib.mesonEnable "glib" gobjectSupport)
(lib.mesonEnable "tests" finalAttrs.doCheck)
(lib.mesonEnable "tests" finalAttrs.finalPackage.doCheck)
(lib.mesonEnable "xlib" x11Support)
(lib.mesonEnable "xcb" xcbSupport)
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/epoll-shim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ stdenv.mkDerivation (finalAttrs: {

cmakeFlags = [
"-DCMAKE_INSTALL_PKGCONFIGDIR=${placeholder "out"}/lib/pkgconfig"
"-DBUILD_TESTING=${lib.boolToString finalAttrs.doCheck}"
"-DBUILD_TESTING=${lib.boolToString finalAttrs.finalPackage.doCheck}"
];

# https://github.com/jiixyj/epoll-shim/issues/41
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/glib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ stdenv.mkDerivation (finalAttrs: {

nativeCheckInputs = [ tzdata desktop-file-utils shared-mime-info ];

preCheck = lib.optionalString finalAttrs.doCheck or config.doCheckByDefault or false ''
preCheck = lib.optionalString finalAttrs.finalPackage.doCheck or config.doCheckByDefault or false ''
export LD_LIBRARY_PATH="$NIX_BUILD_TOP/glib-${finalAttrs.version}/glib/.libs''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
export TZDIR="${tzdata}/share/zoneinfo"
export XDG_CACHE_HOME="$TMP"
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/libraries/hnswlib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ stdenv.mkDerivation (finalAttrs: {

# this is a header-only library, so we don't need to build it
# we need `cmake` only to run tests
nativeBuildInputs = lib.optionals finalAttrs.doCheck [
nativeBuildInputs = lib.optionals finalAttrs.finalPackage.doCheck [
cmake
python
];

# we only want to run buildPhase when we run tests
dontBuild = !finalAttrs.doCheck;
dontBuild = !finalAttrs.finalPackage.doCheck;

installPhase = ''
runHook preInstall
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/libayatana-common/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ stdenv.mkDerivation (finalAttrs: {
];

cmakeFlags = [
"-DENABLE_TESTS=${lib.boolToString finalAttrs.doCheck}"
"-DENABLE_TESTS=${lib.boolToString finalAttrs.finalPackage.doCheck}"
"-DENABLE_LOMIRI_FEATURES=OFF"
"-DGSETTINGS_LOCALINSTALL=ON"
"-DGSETTINGS_COMPILE=ON"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/libcbor/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ stdenv.mkDerivation (finalAttrs: {
cmocka # cmake expects cmocka module
];

cmakeFlags = lib.optional finalAttrs.doCheck "-DWITH_TESTS=ON"
cmakeFlags = lib.optional finalAttrs.finalPackage.doCheck "-DWITH_TESTS=ON"
++ lib.optional (!stdenv.hostPlatform.isStatic) "-DBUILD_SHARED_LIBS=ON";

# Tests are restricted while pkgsStatic.cmocka is broken. Tracked at:
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/libqtdbusmock/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ stdenv.mkDerivation (finalAttrs: {
# Workaround for "error: expected unqualified-id before 'public'" on "**signals"
sed -i -e '/add_definitions/a -DQT_NO_KEYWORDS' CMakeLists.txt
'' + lib.optionalString (!finalAttrs.doCheck) ''
'' + lib.optionalString (!finalAttrs.finalPackage.doCheck) ''
# Don't build tests when we're not running them
sed -i -e '/add_subdirectory(tests)/d' CMakeLists.txt
'';
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/libqtdbustest/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ stdenv.mkDerivation (finalAttrs: {

strictDeps = true;

postPatch = lib.optionalString (!finalAttrs.doCheck) ''
postPatch = lib.optionalString (!finalAttrs.finalPackage.doCheck) ''
# Don't build tests when we're not running them
sed -i -e '/add_subdirectory(tests)/d' CMakeLists.txt
'';
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/libspatialindex/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [ cmake ];

cmakeFlags = [
"-DSIDX_BUILD_TESTS=${if finalAttrs.doCheck then "ON" else "OFF"}"
"-DSIDX_BUILD_TESTS=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}"
];

doCheck = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/libuv/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ stdenv.mkDerivation (finalAttrs: {
"shutdown_close_pipe"
];
tdRegexp = lib.concatStringsSep "\\|" toDisable;
in lib.optionalString (finalAttrs.doCheck) ''
in lib.optionalString (finalAttrs.finalPackage.doCheck) ''
sed '/${tdRegexp}/d' -i test/test-list.h
'';

Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/libraries/minizip-ng/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ stdenv.mkDerivation (finalAttrs: {
cmakeFlags = [
"-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
"-DMZ_OPENSSL=ON"
"-DMZ_BUILD_TESTS=${if finalAttrs.doCheck then "ON" else "OFF"}"
"-DMZ_BUILD_UNIT_TESTS=${if finalAttrs.doCheck then "ON" else "OFF"}"
"-DMZ_BUILD_TESTS=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}"
"-DMZ_BUILD_UNIT_TESTS=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}"
"-DMZ_LIB_SUFFIX='-ng'"
] ++ lib.optionals stdenv.isDarwin [
# missing header file
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/msgpack-c/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ stdenv.mkDerivation (finalAttrs: {

cmakeFlags = [
"-DMSGPACK_BUILD_EXAMPLES=OFF" # examples are not installed even if built
] ++ lib.optional (!finalAttrs.doCheck) "-DMSGPACK_BUILD_TESTS=OFF";
] ++ lib.optional (!finalAttrs.finalPackage.doCheck) "-DMSGPACK_BUILD_TESTS=OFF";

checkInputs = [
gtest
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/msgpack-cxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ stdenv.mkDerivation (finalAttrs: {

cmakeFlags = [
"-DMSGPACK_BUILD_DOCS=OFF" # docs are not installed even if built
] ++ lib.optional finalAttrs.doCheck "-DMSGPACK_BUILD_TESTS=ON";
] ++ lib.optional finalAttrs.finalPackage.doCheck "-DMSGPACK_BUILD_TESTS=ON";

checkInputs = [
zlib
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/libraries/nlohmann_json/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ in stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [ cmake ];

cmakeFlags = [
"-DJSON_BuildTests=${if finalAttrs.doCheck then "ON" else "OFF"}"
"-DJSON_BuildTests=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}"
"-DJSON_FastTests=ON"
"-DJSON_MultipleHeaders=ON"
] ++ lib.optional finalAttrs.doCheck "-DJSON_TestDataDirectory=${testData}";
] ++ lib.optional finalAttrs.finalPackage.doCheck "-DJSON_TestDataDirectory=${testData}";

doCheck = stdenv.hostPlatform == stdenv.buildPlatform;

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/open62541/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ stdenv.mkDerivation (finalAttrs: {
"-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
"-DUA_NAMESPACE_ZERO=FULL"

"-DUA_BUILD_UNIT_TESTS=${if finalAttrs.doCheck then "ON" else "OFF"}"
"-DUA_BUILD_UNIT_TESTS=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}"
]
++ lib.optional withExamples "-DUA_BUILD_EXAMPLES=ON"
++ lib.optional (withEncryption != false)
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/libraries/poppler/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ stdenv.mkDerivation (finalAttrs: rec {
(mkFlag qt5Support "QT5")
(mkFlag qt6Support "QT6")
(mkFlag gpgmeSupport "GPGME")
] ++ lib.optionals finalAttrs.doCheck [
] ++ lib.optionals finalAttrs.finalPackage.doCheck [
"-DTESTDATADIR=${testData}"
];
disallowedReferences = lib.optional finalAttrs.doCheck testData;
disallowedReferences = lib.optional finalAttrs.finalPackage.doCheck testData;

dontWrapQtApps = true;

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/properties-cpp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-C/BDEuKNMQHOjATO5aWBptjIlgfv6ykzjFAsHb6uP3Q=";
};

postPatch = lib.optionalString (!finalAttrs.doCheck) ''
postPatch = lib.optionalString (!finalAttrs.finalPackage.doCheck) ''
sed -i "/add_subdirectory(tests)/d" CMakeLists.txt
'';

Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/libraries/qmenumodel/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ stdenv.mkDerivation (finalAttrs: {
substituteInPlace libqmenumodel/QMenuModel/CMakeLists.txt \
--replace "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
'' + lib.optionalString finalAttrs.doCheck ''
'' + lib.optionalString finalAttrs.finalPackage.doCheck ''
patchShebangs tests/{client,script}/*.py
'';

Expand Down Expand Up @@ -64,7 +64,7 @@ stdenv.mkDerivation (finalAttrs: {
dontWrapQtApps = true;

cmakeFlags = [
"-DENABLE_TESTS=${lib.boolToString finalAttrs.doCheck}"
"-DENABLE_TESTS=${lib.boolToString finalAttrs.finalPackage.doCheck}"
];

doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/xsimd/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ stdenv.mkDerivation (finalAttrs: {
];

cmakeFlags = [
"-DBUILD_TESTS=${if (finalAttrs.doCheck && stdenv.hostPlatform == stdenv.buildPlatform) then "ON" else "OFF"}"
"-DBUILD_TESTS=${if (finalAttrs.finalPackage.doCheck && stdenv.hostPlatform == stdenv.buildPlatform) then "ON" else "OFF"}"
];

doCheck = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/xtensor/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ stdenv.mkDerivation (finalAttrs: {
cmakeFlags = let
cmakeBool = x: if x then "ON" else "OFF";
in [
"-DBUILD_TESTS=${cmakeBool finalAttrs.doCheck}"
"-DBUILD_TESTS=${cmakeBool finalAttrs.finalPackage.doCheck}"
"-DXTENSOR_ENABLE_ASSERT=${cmakeBool enableAssertions}"
"-DXTENSOR_CHECK_DIMENSION=${cmakeBool enableBoundChecks}"
];
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/python-modules/xtensor-python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ toPythonModule (stdenv.mkDerivation(finalAttrs: {
];
doCheck = true;
cmakeFlags = [
"-DBUILD_TESTS=${if finalAttrs.doCheck then "ON" else "OFF"}"
"-DBUILD_TESTS=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}"
];

propagatedBuildInputs = [
Expand Down
2 changes: 1 addition & 1 deletion pkgs/os-specific/linux/libnvme/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ stdenv.mkDerivation (finalAttrs: {

mesonFlags = [
"-Ddocs=man"
(lib.mesonBool "tests" finalAttrs.doCheck)
(lib.mesonBool "tests" finalAttrs.finalPackage.doCheck)
(lib.mesonBool "docs-build" withDocs)
];

Expand Down
4 changes: 2 additions & 2 deletions pkgs/servers/mir/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ stdenv.mkDerivation (finalAttrs: {
pkg-config
(python3.withPackages (ps: with ps; [
pillow
] ++ lib.optionals finalAttrs.doCheck [
] ++ lib.optionals finalAttrs.finalPackage.doCheck [
pygobject3
python-dbusmock
]))
Expand Down Expand Up @@ -141,7 +141,7 @@ stdenv.mkDerivation (finalAttrs: {
cmakeFlags = [
"-DBUILD_DOXYGEN=OFF"
"-DMIR_PLATFORM='gbm-kms;x11;eglstream-kms;wayland'"
"-DMIR_ENABLE_TESTS=${if finalAttrs.doCheck then "ON" else "OFF"}"
"-DMIR_ENABLE_TESTS=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}"
# BadBufferTest.test_truncated_shm_file *doesn't* throw an error as the test expected, mark as such
# https://github.com/MirServer/mir/pull/1947#issuecomment-811810872
"-DMIR_SIGBUS_HANDLER_ENVIRONMENT_BROKEN=ON"
Expand Down
6 changes: 3 additions & 3 deletions pkgs/tools/graphics/mangohud/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ stdenv.mkDerivation (finalAttrs: {
# Unpack subproject sources
postUnpack = ''(
cd "$sourceRoot/subprojects"
${lib.optionalString finalAttrs.doCheck ''
${lib.optionalString finalAttrs.finalPackage.doCheck ''
cp -R --no-preserve=mode,ownership ${cmocka.src} cmocka
''}
cp -R --no-preserve=mode,ownership ${imgui.src} imgui-${imgui.version}
Expand Down Expand Up @@ -146,7 +146,7 @@ stdenv.mkDerivation (finalAttrs: {
mesonFlags = [
"-Dwith_wayland=enabled"
"-Duse_system_spdlog=enabled"
"-Dtests=${if finalAttrs.doCheck then "enabled" else "disabled"}"
"-Dtests=${if finalAttrs.finalPackage.doCheck then "enabled" else "disabled"}"
] ++ lib.optionals gamescopeSupport [
"-Dmangoapp=true"
"-Dmangoapp_layer=true"
Expand Down Expand Up @@ -215,7 +215,7 @@ stdenv.mkDerivation (finalAttrs: {
addOpenGLRunpath "$out/lib/mangohud/libMangoHud.so"
'' + lib.optionalString gamescopeSupport ''
addOpenGLRunpath "$out/bin/mangoapp"
'' + lib.optionalString finalAttrs.doCheck ''
'' + lib.optionalString finalAttrs.finalPackage.doCheck ''
# libcmocka.so is only used for tests
rm "$out/lib/libcmocka.so"
'';
Expand Down

0 comments on commit ad5e744

Please sign in to comment.