hyprutils/nix/default.nix

62 lines
1.3 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",
doCheck ? false,
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.attrsets) mapAttrsToList;
inherit (lib.lists) flatten optional;
inherit (lib.strings) cmakeBool 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";
inherit version doCheck;
src = ../.;
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = flatten [
(optional doCheck gtest)
pixman
];
outputs = [
"out"
"dev"
];
cmakeBuildType = if debug then "Debug" else "RelWithDebInfo";
cmakeFlags = mapAttrsToList cmakeBool {
"DISABLE_TESTING" = !doCheck;
};
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;
};
}