Nix: always test in debug mode

This commit is contained in:
Mihai Fufezan 2025-11-22 00:32:57 +02:00
parent 1454845751
commit 31f29957df
Signed by: fufexan
SSH key fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg
2 changed files with 6 additions and 10 deletions

View file

@ -7,7 +7,6 @@
gtest, gtest,
pixman, pixman,
version ? "git", version ? "git",
doCheck ? false,
debug ? false, debug ? false,
# whether to use the mold linker # whether to use the mold linker
# disable this for older machines without SSE4_2 and AVX2 support # disable this for older machines without SSE4_2 and AVX2 support
@ -15,9 +14,8 @@
}: }:
let let
inherit (builtins) foldl'; inherit (builtins) foldl';
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.lists) flatten optional; inherit (lib.lists) flatten optional;
inherit (lib.strings) cmakeBool optionalString; inherit (lib.strings) optionalString;
adapters = flatten [ adapters = flatten [
(lib.optional withMold stdenvAdapters.useMoldLinker) (lib.optional withMold stdenvAdapters.useMoldLinker)
@ -28,16 +26,18 @@ let
in in
customStdenv.mkDerivation { customStdenv.mkDerivation {
pname = "hyprutils" + optionalString debug "-debug"; pname = "hyprutils" + optionalString debug "-debug";
inherit version doCheck; inherit version;
src = ../.; src = ../.;
doCheck = debug;
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
pkg-config pkg-config
]; ];
buildInputs = flatten [ buildInputs = flatten [
(optional doCheck gtest) (optional debug gtest)
pixman pixman
]; ];
@ -48,10 +48,6 @@ customStdenv.mkDerivation {
cmakeBuildType = if debug then "Debug" else "RelWithDebInfo"; cmakeBuildType = if debug then "Debug" else "RelWithDebInfo";
cmakeFlags = mapAttrsToList cmakeBool {
"DISABLE_TESTING" = !doCheck;
};
meta = with lib; { meta = with lib; {
homepage = "https://github.com/hyprwm/hyprutils"; homepage = "https://github.com/hyprwm/hyprutils";
description = "Small C++ library for utilities used across the Hypr* ecosystem"; description = "Small C++ library for utilities used across the Hypr* ecosystem";

View file

@ -18,6 +18,6 @@ in {
inherit version; inherit version;
}; };
hyprutils-debug = final.hyprutils.override {debug = true;}; hyprutils-debug = final.hyprutils.override {debug = true;};
hyprutils-with-tests = final.hyprutils.override {doCheck = true;}; hyprutils-with-tests = final.hyprutils-debug;
}; };
} }