aboutsummaryrefslogtreecommitdiffhomepage
path: root/nix/wlroots.nix
blob: ee54557b6502dadfb04e595379564a3595f43ff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
  version,
  src,
  #
  wlroots,
  xwayland,
  fetchpatch,
  lib,
  hwdata,
  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) [
          (fetchpatch {
            url = "https://gitlab.freedesktop.org/lilydjwg/wlroots/-/commit/6c5ffcd1fee9e44780a6a8792f74ecfbe24a1ca7.diff";
            sha256 = "sha256-Eo1pTa/PIiJsRZwIUnHGTIFFIedzODVf0ZeuXb0a3TQ=";
          })
          (fetchpatch {
            url = "https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/18595000f3a21502fd60bf213122859cc348f9af.diff";
            sha256 = "sha256-jvfkAMh3gzkfuoRhB4E9T5X1Hu62wgUjj4tZkJm0mrI=";
            revert = true;
          })
        ]);
      postPatch =
        (old.postPatch or "")
        + (
          if nvidiaPatches
          then ''
            substituteInPlace render/gles2/renderer.c --replace "glFlush();" "glFinish();"
          ''
          else ""
        );
      buildInputs = old.buildInputs ++ [hwdata];
    }))
  .override {
    xwayland = xwayland.overrideAttrs (old: {
      patches =
        (old.patches or [])
        ++ (lib.optionals hidpiXWayland [
          ./xwayland-vsync.patch
          ./xwayland-hidpi.patch
        ]);
    });
  }