nix: add debug flag

enable keepDebugInfo adapter on debug
build with mold linker
This commit is contained in:
Mihai Fufezan 2024-11-05 14:34:54 +02:00
parent fd4be8b9ca
commit 3ce0cde870
Signed by: fufexan
SSH key fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg

View file

@ -1,13 +1,25 @@
{
lib,
stdenv,
stdenvAdapters,
cmake,
pkg-config,
pixman,
version ? "git",
doCheck ? false,
}:
stdenv.mkDerivation {
debug ? false,
}: let
inherit (builtins) foldl';
inherit (lib.lists) flatten;
adapters = flatten [
stdenvAdapters.useMoldLinker
(lib.optional debug stdenvAdapters.keepDebugInfo)
];
customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
in
customStdenv.mkDerivation {
pname = "hyprutils";
inherit version doCheck;
src = ../.;
@ -23,9 +35,10 @@ stdenv.mkDerivation {
outputs = ["out" "dev"];
cmakeBuildType = "RelWithDebInfo";
dontStrip = true;
cmakeBuildType =
if debug
then "Debug"
else "RelWithDebInfo";
meta = with lib; {
homepage = "https://github.com/hyprwm/hyprutils";