Skip to content

Commit 3ce0cde

Browse files
committedNov 7, 2024··
nix: add debug flag
enable keepDebugInfo adapter on debug build with mold linker
1 parent fd4be8b commit 3ce0cde

File tree

1 file changed

+34
-21
lines changed

1 file changed

+34
-21
lines changed
 

‎nix/default.nix

+34-21
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,49 @@
11
{
22
lib,
33
stdenv,
4+
stdenvAdapters,
45
cmake,
56
pkg-config,
67
pixman,
78
version ? "git",
89
doCheck ? false,
9-
}:
10-
stdenv.mkDerivation {
11-
pname = "hyprutils";
12-
inherit version doCheck;
13-
src = ../.;
10+
debug ? false,
11+
}: let
12+
inherit (builtins) foldl';
13+
inherit (lib.lists) flatten;
1414

15-
nativeBuildInputs = [
16-
cmake
17-
pkg-config
15+
adapters = flatten [
16+
stdenvAdapters.useMoldLinker
17+
(lib.optional debug stdenvAdapters.keepDebugInfo)
1818
];
1919

20-
buildInputs = [
21-
pixman
22-
];
20+
customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
21+
in
22+
customStdenv.mkDerivation {
23+
pname = "hyprutils";
24+
inherit version doCheck;
25+
src = ../.;
26+
27+
nativeBuildInputs = [
28+
cmake
29+
pkg-config
30+
];
2331

24-
outputs = ["out" "dev"];
32+
buildInputs = [
33+
pixman
34+
];
2535

26-
cmakeBuildType = "RelWithDebInfo";
36+
outputs = ["out" "dev"];
2737

28-
dontStrip = true;
38+
cmakeBuildType =
39+
if debug
40+
then "Debug"
41+
else "RelWithDebInfo";
2942

30-
meta = with lib; {
31-
homepage = "https://github.com/hyprwm/hyprutils";
32-
description = "Small C++ library for utilities used across the Hypr* ecosystem";
33-
license = licenses.bsd3;
34-
platforms = platforms.linux;
35-
};
36-
}
43+
meta = with lib; {
44+
homepage = "https://github.com/hyprwm/hyprutils";
45+
description = "Small C++ library for utilities used across the Hypr* ecosystem";
46+
license = licenses.bsd3;
47+
platforms = platforms.linux;
48+
};
49+
}

0 commit comments

Comments
 (0)
Please sign in to comment.