Skip to content

Commit

Permalink
nix: add debug flag
Browse files Browse the repository at this point in the history
enable keepDebugInfo adapter on debug
build with mold linker
  • Loading branch information
fufexan committed Nov 7, 2024
1 parent fd4be8b commit 3ce0cde
Showing 1 changed file with 34 additions and 21 deletions.
55 changes: 34 additions & 21 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,49 @@
{
lib,
stdenv,
stdenvAdapters,
cmake,
pkg-config,
pixman,
version ? "git",
doCheck ? false,
}:
stdenv.mkDerivation {
pname = "hyprutils";
inherit version doCheck;
src = ../.;
debug ? false,
}: let
inherit (builtins) foldl';
inherit (lib.lists) flatten;

nativeBuildInputs = [
cmake
pkg-config
adapters = flatten [
stdenvAdapters.useMoldLinker
(lib.optional debug stdenvAdapters.keepDebugInfo)
];

buildInputs = [
pixman
];
customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
in
customStdenv.mkDerivation {
pname = "hyprutils";
inherit version doCheck;
src = ../.;

nativeBuildInputs = [
cmake
pkg-config
];

outputs = ["out" "dev"];
buildInputs = [
pixman
];

cmakeBuildType = "RelWithDebInfo";
outputs = ["out" "dev"];

dontStrip = true;
cmakeBuildType =
if debug
then "Debug"
else "RelWithDebInfo";

meta = with lib; {
homepage = "https://github.com/hyprwm/hyprutils";
description = "Small C++ library for utilities used across the Hypr* ecosystem";
license = licenses.bsd3;
platforms = platforms.linux;
};
}
meta = with lib; {
homepage = "https://github.com/hyprwm/hyprutils";
description = "Small C++ library for utilities used across the Hypr* ecosystem";
license = licenses.bsd3;
platforms = platforms.linux;
};
}

0 comments on commit 3ce0cde

Please sign in to comment.