hyprutils/nix/default.nix

58 lines
1.1 KiB
Nix
Raw Permalink Normal View History

2024-06-09 00:13:58 +03:00
{
lib,
stdenv,
stdenvAdapters,
2024-06-09 00:13:58 +03:00
cmake,
2024-06-19 09:12:49 +03:00
pkg-config,
gtest,
2024-06-19 09:12:49 +03:00
pixman,
2024-06-09 00:13:58 +03:00
version ? "git",
debug ? false,
2025-08-21 20:05:54 +03:00
# whether to use the mold linker
# disable this for older machines without SSE4_2 and AVX2 support
withMold ? true,
}:
let
inherit (builtins) foldl';
inherit (lib.lists) flatten optional;
2025-11-22 00:32:57 +02:00
inherit (lib.strings) optionalString;
2024-06-09 00:13:58 +03:00
adapters = flatten [
2025-08-21 20:05:54 +03:00
(lib.optional withMold stdenvAdapters.useMoldLinker)
(lib.optional debug stdenvAdapters.keepDebugInfo)
2024-06-19 09:12:49 +03:00
];
customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
in
customStdenv.mkDerivation {
pname = "hyprutils" + optionalString debug "-debug";
2025-11-22 00:32:57 +02:00
inherit version;
src = ../.;
2025-11-22 00:32:57 +02:00
doCheck = debug;
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = flatten [
2025-11-22 00:32:57 +02:00
(optional debug gtest)
pixman
];
outputs = [
"out"
"dev"
];
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;
};
}