From a49bc3583ff223f426cb3526fdaa4bcaa247ec14 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Tue, 5 Nov 2024 08:48:06 +0200 Subject: [PATCH] nix: add stdenvAdapters --- nix/default.nix | 93 ++++++++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 40 deletions(-) diff --git a/nix/default.nix b/nix/default.nix index d982aaf..31f9091 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,6 +1,7 @@ { lib, stdenv, + stdenvAdapters, cmake, hwdata, hyprutils, @@ -20,51 +21,63 @@ wayland-scanner, version ? "git", doCheck ? false, -}: -stdenv.mkDerivation { - pname = "aquamarine"; - inherit version doCheck; - src = ../.; + debug ? false, +}: let + inherit (builtins) foldl'; + inherit (lib.lists) flatten; - strictDeps = true; - - depsBuildBuild = [ - pkg-config + adapters = flatten [ + stdenvAdapters.useMoldLinker + (lib.optional debug stdenvAdapters.keepDebugInfo) ]; - nativeBuildInputs = [ - cmake - hyprwayland-scanner - pkg-config - ]; + customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters; +in + customStdenv.mkDerivation { + pname = "aquamarine"; + inherit version doCheck; + src = ../.; - buildInputs = [ - hwdata - hyprutils - libdisplay-info - libdrm - libffi - libGL - libinput - mesa - pixman - seatd - udev - wayland - wayland-protocols - wayland-scanner - ]; + strictDeps = true; - outputs = ["out" "dev"]; + depsBuildBuild = [ + pkg-config + ]; - cmakeBuildType = "RelWithDebInfo"; + nativeBuildInputs = [ + cmake + hyprwayland-scanner + pkg-config + ]; - dontStrip = true; + buildInputs = [ + hwdata + hyprutils + libdisplay-info + libdrm + libffi + libGL + libinput + mesa + pixman + seatd + udev + wayland + wayland-protocols + wayland-scanner + ]; - meta = { - homepage = "https://github.com/hyprwm/aquamarine"; - description = "A very light linux rendering backend library"; - license = lib.licenses.bsd3; - platforms = lib.platforms.linux; - }; -} + outputs = ["out" "dev"]; + + cmakeBuildType = + if debug + then "Debug" + else "RelWithDebInfo"; + + meta = { + homepage = "https://github.com/hyprwm/aquamarine"; + description = "A very light linux rendering backend library"; + license = lib.licenses.bsd3; + platforms = lib.platforms.linux; + }; + }