Hyprland/nix/wlroots.nix

74 lines
1.9 KiB
Nix
Raw Normal View History

{
version,
src,
#
wlroots,
xwayland,
fetchpatch,
lib,
2022-11-13 20:32:15 +01:00
hwdata,
2023-03-03 23:37:00 +01:00
libliftoff,
libdisplay-info,
2023-03-04 00:41:37 +01:00
hidpiXWayland ? true,
enableXWayland ? true,
nvidiaPatches ? false,
}:
assert (lib.assertMsg (hidpiXWayland -> enableXWayland) ''
wlroots-hyprland: cannot have hidpiXWayland when enableXWayland is false.
'');
(wlroots.overrideAttrs
(old: {
inherit version src;
pname =
old.pname
+ "-hyprland"
+ (
if hidpiXWayland
then "-hidpi"
else ""
)
+ (
if nvidiaPatches
then "-nvidia"
else ""
);
patches =
(old.patches or [])
++ (lib.optionals (enableXWayland && hidpiXWayland) [
2023-03-04 00:41:37 +01:00
# adapted from https://gitlab.freedesktop.org/lilydjwg/wlroots/-/commit/6c5ffcd1fee9e44780a6a8792f74ecfbe24a1ca7
./wlroots-hidpi.patch
(fetchpatch {
url = "https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/18595000f3a21502fd60bf213122859cc348f9af.diff";
sha256 = "sha256-jvfkAMh3gzkfuoRhB4E9T5X1Hu62wgUjj4tZkJm0mrI=";
revert = true;
})
2022-12-17 18:01:18 +01:00
])
++ (lib.optionals nvidiaPatches [
2023-07-18 12:13:59 +02:00
./wlroots-nvidia.patch
]);
postPatch =
(old.postPatch or "")
+ (
if nvidiaPatches
then ''
substituteInPlace render/gles2/renderer.c --replace "glFlush();" "glFinish();"
''
else ""
);
2023-03-03 23:37:00 +01:00
buildInputs = old.buildInputs ++ [hwdata libliftoff libdisplay-info];
2023-03-09 00:10:01 +01:00
NIX_CFLAGS_COMPILE = toString [
"-Wno-error=maybe-uninitialized"
];
}))
.override {
xwayland = xwayland.overrideAttrs (old: {
patches =
(old.patches or [])
++ (lib.optionals hidpiXWayland [
./xwayland-vsync.patch
./xwayland-hidpi.patch
]);
});
}