diff options
| author | Fernando Ayats <ayatsfer@gmail.com> | 2022-09-01 19:35:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-01 20:35:50 +0300 |
| commit | c0a7dffcdc6cb04e5dd7dacf04681f9d2b361b97 (patch) | |
| tree | 9aa8fb0df9d75c188afaa26ddd9cb4163ac7dc0e | |
| parent | 8581e7178961ebe3a6c25f49583d13f9ee6ee22a (diff) | |
nix: move wlroots and add nvidia patches (#608)
| -rw-r--r-- | flake.nix | 5 | ||||
| -rw-r--r-- | nix/default.nix | 7 | ||||
| -rw-r--r-- | nix/hidpi_wlroots.nix | 31 | ||||
| -rw-r--r-- | nix/wlroots.nix | 64 |
4 files changed, 68 insertions, 39 deletions
@@ -28,11 +28,10 @@ ]); in { overlays.default = _: prev: rec { - wlroots-hyprland = prev.wlroots.overrideAttrs (__: { + wlroots-hyprland = prev.callPackage ./nix/wlroots.nix { version = mkDate (inputs.wlroots.lastModifiedDate or "19700101") + "_" + (inputs.wlroots.shortRev or "dirty"); src = inputs.wlroots; - }); - + }; hyprland = prev.callPackage ./nix/default.nix { stdenv = prev.gcc12Stdenv; version = "0.12.1beta" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); diff --git a/nix/default.nix b/nix/default.nix index f840da1a..27aaf6bc 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -24,6 +24,7 @@ enableXWayland ? true, hidpiXWayland ? true, legacyRenderer ? false, + nvidiaPatches ? false, version ? "git", }: let assertXWayland = lib.assertMsg (hidpiXWayland -> enableXWayland) '' @@ -68,11 +69,7 @@ in wayland wayland-protocols wayland-scanner - ( - if hidpiXWayland - then (import ./hidpi_wlroots.nix {inherit wlroots xwayland fetchpatch;}) - else wlroots.override {inherit enableXWayland;} - ) + (wlroots.override {inherit enableXWayland hidpiXWayland nvidiaPatches;}) xcbutilwm ] ++ lib.optional enableXWayland xwayland; diff --git a/nix/hidpi_wlroots.nix b/nix/hidpi_wlroots.nix deleted file mode 100644 index c0f7db55..00000000 --- a/nix/hidpi_wlroots.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - wlroots, - xwayland, - fetchpatch, -}: -(wlroots.overrideAttrs - (old: { - patches = - (old.patches or []) - ++ [ - (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; - }) - ]; - })) -.override { - xwayland = xwayland.overrideAttrs (old: { - patches = - (old.patches or []) - ++ [ - ./xwayland-vsync.patch - ./xwayland-hidpi.patch - ]; - }); -} diff --git a/nix/wlroots.nix b/nix/wlroots.nix new file mode 100644 index 00000000..65b281aa --- /dev/null +++ b/nix/wlroots.nix @@ -0,0 +1,64 @@ +{ + version, + src, + # + wlroots, + xwayland, + fetchpatch, + lib, + 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 "" + ); + })) + .override { + xwayland = xwayland.overrideAttrs (old: { + patches = + (old.patches or []) + ++ (lib.optionals hidpiXWayland [ + ./xwayland-vsync.patch + ./xwayland-hidpi.patch + ]); + }); + } |
