From 29970228c5f71f417b0a3e1b4851d9430ed095dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Thu, 30 Nov 2023 11:40:14 +0000 Subject: [PATCH] nix: override libdrm to use newer version (#4003) --- nix/default.nix | 13 ++++++++++++- nix/wlroots.nix | 15 ++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/nix/default.nix b/nix/default.nix index 42808a5f..7ddeae94 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,5 +1,6 @@ { lib, + fetchurl, stdenv, pkg-config, makeWrapper, @@ -38,6 +39,16 @@ nvidiaPatches ? false, hidpiXWayland ? false, }: +let + # NOTE: remove after https://github.com/NixOS/nixpkgs/pull/271096 reaches nixos-unstable + libdrm_2_4_118 = libdrm.overrideAttrs(attrs: rec { + version = "2.4.118"; + src = fetchurl { + url = "https://dri.freedesktop.org/${attrs.pname}/${attrs.pname}-${version}.tar.xz"; + hash = "sha256-p3e9hfK1/JxX+IbIIFgwBXgxfK/bx30Kdp1+mpVnq4g="; + }; + }); +in assert lib.assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed."; assert lib.assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed."; assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland"; @@ -74,7 +85,7 @@ assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been remov cairo hyprland-protocols libGL - libdrm + libdrm_2_4_118 libinput libxkbcommon mesa diff --git a/nix/wlroots.nix b/nix/wlroots.nix index f48ba35c..0b9186e9 100644 --- a/nix/wlroots.nix +++ b/nix/wlroots.nix @@ -1,18 +1,31 @@ { + fetchurl, version, src, wlroots, hwdata, libdisplay-info, libliftoff, + libdrm, enableXWayland ? true, }: +let + # NOTE: remove after https://github.com/NixOS/nixpkgs/pull/271096 reaches nixos-unstable + libdrm_2_4_118 = libdrm.overrideAttrs(old: rec { + version = "2.4.118"; + src = fetchurl { + url = "https://dri.freedesktop.org/${old.pname}/${old.pname}-${version}.tar.xz"; + hash = "sha256-p3e9hfK1/JxX+IbIIFgwBXgxfK/bx30Kdp1+mpVnq4g="; + }; + }); +in wlroots.overrideAttrs (old: { inherit version src enableXWayland; pname = "${old.pname}-hyprland"; - buildInputs = old.buildInputs ++ [hwdata libliftoff libdisplay-info]; + # HACK: libdrm_2_4_118 is placed at the head of list to take precedence over libdrm in `old.buildInputs` + buildInputs = [libdrm_2_4_118] ++ old.buildInputs ++ [hwdata libliftoff libdisplay-info]; NIX_CFLAGS_COMPILE = toString [ "-Wno-error=maybe-uninitialized"