From d2eddd374f530b1d49c9e12908bab31cfa9d091f Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Thu, 3 Aug 2023 19:50:26 +0300 Subject: [PATCH 1/5] hyprland: 0.27.0 -> unstable-2023-08-08 --- .../hyprwm/hyprland/default.nix | 38 ++++++---- .../hyprwm/hyprland/wlroots.nix | 71 ++++--------------- 2 files changed, 39 insertions(+), 70 deletions(-) diff --git a/pkgs/applications/window-managers/hyprwm/hyprland/default.nix b/pkgs/applications/window-managers/hyprwm/hyprland/default.nix index b6af6a34151c..f2b430c5bc11 100644 --- a/pkgs/applications/window-managers/hyprwm/hyprland/default.nix +++ b/pkgs/applications/window-managers/hyprwm/hyprland/default.nix @@ -2,8 +2,10 @@ , stdenv , fetchFromGitHub , pkg-config +, makeWrapper , meson , ninja +, binutils , cairo , git , hyprland-protocols @@ -24,34 +26,33 @@ , xcbutilwm , xwayland , debug ? false +, enableNvidiaPatches ? false , enableXWayland ? true -, hidpiXWayland ? false , legacyRenderer ? false -, nvidiaPatches ? false , withSystemd ? true +, wrapRuntimeDeps ? true + # deprecated flags +, nvidiaPatches ? false +, hidpiXWayland ? false }: -let - assertXWayland = lib.assertMsg (hidpiXWayland -> enableXWayland) '' - Hyprland: cannot have hidpiXWayland when enableXWayland is false. - ''; -in -assert assertXWayland; +assert lib.assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been renamed `enableNvidiaPatches`"; +assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland"; stdenv.mkDerivation (finalAttrs: { pname = "hyprland" + lib.optionalString debug "-debug"; - version = "0.27.0"; + version = "unstable-2023-08-08"; src = fetchFromGitHub { owner = "hyprwm"; repo = finalAttrs.pname; - rev = "v${finalAttrs.version}"; - hash = "sha256-mEKF6Wcx+wSF/eos/91A7LxhFLDYhSnQnLpwZF13ntg="; + rev = "8e04a80e60983f5def26bdcaea701040fea9a7ae"; + hash = "sha256-5/vEdU3SzAdeIyPykjks/Zxkvh9luPTIei6oa77OY2Q="; }; patches = [ # make meson use the provided dependencies instead of the git submodules - "${finalAttrs.src}/nix/meson-build.patch" + "${finalAttrs.src}/nix/patches/meson-build.patch" # look into $XDG_DESKTOP_PORTAL_DIR instead of /usr; runtime checks for conflicting portals - "${finalAttrs.src}/nix/portals.patch" + "${finalAttrs.src}/nix/patches/portals.patch" ]; postPatch = '' @@ -64,6 +65,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ jq + makeWrapper meson ninja pkg-config @@ -90,7 +92,7 @@ stdenv.mkDerivation (finalAttrs: { wayland-protocols pango pciutils - (wlroots.override { inherit enableXWayland hidpiXWayland nvidiaPatches; }) + (wlroots.override { inherit enableNvidiaPatches; }) ] ++ lib.optionals enableXWayland [ libxcb xcbutilwm xwayland ] ++ lib.optionals withSystemd [ systemd ]; @@ -106,6 +108,14 @@ stdenv.mkDerivation (finalAttrs: { (lib.optional withSystemd "-Dsystemd=enabled") ]; + postInstall = '' + ln -s ${wlroots}/include/wlr $dev/include/hyprland/wlroots + ${lib.optionalString wrapRuntimeDeps '' + wrapProgram $out/bin/Hyprland \ + --suffix PATH : ${lib.makeBinPath [binutils pciutils]} + ''} + ''; + passthru.providedSessions = [ "hyprland" ]; meta = with lib; { diff --git a/pkgs/applications/window-managers/hyprwm/hyprland/wlroots.nix b/pkgs/applications/window-managers/hyprwm/hyprland/wlroots.nix index e1d6bfc7e516..7b44e9cf5212 100644 --- a/pkgs/applications/window-managers/hyprwm/hyprland/wlroots.nix +++ b/pkgs/applications/window-managers/hyprwm/hyprland/wlroots.nix @@ -1,15 +1,11 @@ { fetchFromGitLab , hyprland , wlroots -, xwayland -, fetchpatch , lib , libdisplay-info , libliftoff , hwdata -, hidpiXWayland ? true -, enableXWayland ? true -, nvidiaPatches ? false +, enableNvidiaPatches ? false }: let libdisplay-info-new = libdisplay-info.overrideAttrs (old: { @@ -38,10 +34,7 @@ let ]; }); in -assert (lib.assertMsg (hidpiXWayland -> enableXWayland) '' - wlroots-hyprland: cannot have hidpiXWayland when enableXWayland is false. -''); -(wlroots.overrideAttrs +wlroots.overrideAttrs (old: { version = "0.17.0-dev"; @@ -49,65 +42,31 @@ assert (lib.assertMsg (hidpiXWayland -> enableXWayland) '' domain = "gitlab.freedesktop.org"; owner = "wlroots"; repo = "wlroots"; - rev = "7e7633abf09b362d0bad9e3fc650fd692369291d"; - hash = "sha256-KovjVFwcuoUO0eu/UiWrnD3+m/K+SHSAVIz4xF9K1XA="; + rev = "e8d545a9770a2473db32e0a0bfa757b05d2af4f3"; + hash = "sha256-gv5kjss6REeQG0BmvK2gTx7jHLRdCnP25po6It6I6N8="; }; pname = old.pname + "-hyprland" - + ( - if hidpiXWayland - then "-hidpi" - else "" - ) - + ( - if nvidiaPatches - then "-nvidia" - else "" - ); + + lib.optionalString enableNvidiaPatches "-nvidia"; patches = (old.patches or [ ]) - ++ (lib.optionals (enableXWayland && hidpiXWayland) [ - "${hyprland.src}/nix/wlroots-hidpi.patch" - (fetchpatch { - url = "https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/18595000f3a21502fd60bf213122859cc348f9af.diff"; - sha256 = "sha256-jvfkAMh3gzkfuoRhB4E9T5X1Hu62wgUjj4tZkJm0mrI="; - revert = true; - }) - ]) - ++ (lib.optionals nvidiaPatches [ - (fetchpatch { - url = "https://aur.archlinux.org/cgit/aur.git/plain/0001-nvidia-format-workaround.patch?h=hyprland-nvidia-screenshare-git&id=2830d3017d7cdd240379b4cc7e5dd6a49cf3399a"; - sha256 = "A9f1p5EW++mGCaNq8w7ZJfeWmvTfUm4iO+1KDcnqYX8="; - }) + ++ (lib.optionals enableNvidiaPatches [ + "${hyprland.src}/nix/patches/nvidia.patch" ]); postPatch = (old.postPatch or "") + ( - if nvidiaPatches - then '' - substituteInPlace render/gles2/renderer.c --replace "glFlush();" "glFinish();" - '' - else "" + lib.optionalString enableNvidiaPatches + ''substituteInPlace render/gles2/renderer.c --replace "glFlush();" "glFinish();"'' ); - buildInputs = - old.buildInputs - ++ [ - hwdata - libdisplay-info-new - libliftoff-new - ]; - })).override { - xwayland = xwayland.overrideAttrs (old: { - patches = - (old.patches or [ ]) - ++ (lib.optionals hidpiXWayland [ - "${hyprland.src}/nix/xwayland-vsync.patch" - "${hyprland.src}/nix/xwayland-hidpi.patch" - ]); - }); -} + buildInputs = old.buildInputs ++ [ + hwdata + libdisplay-info-new + libliftoff-new + ]; + }) From 50ad802e5197db89f304dcbc71395c7c1feca0a1 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Thu, 3 Aug 2023 19:37:03 +0300 Subject: [PATCH 2/5] nixos/hyprland: remove xwayland.hidpi --- nixos/modules/programs/hyprland.nix | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/nixos/modules/programs/hyprland.nix b/nixos/modules/programs/hyprland.nix index faeaa8973fa9..e0ee5b6bd2a4 100644 --- a/nixos/modules/programs/hyprland.nix +++ b/nixos/modules/programs/hyprland.nix @@ -32,11 +32,10 @@ in readOnly = true; default = cfg.package.override { enableXWayland = cfg.xwayland.enable; - hidpiXWayland = cfg.xwayland.hidpi; - nvidiaPatches = cfg.nvidiaPatches; + enableNvidiaPatches = cfg.enableNvidiaPatches; }; defaultText = literalExpression - "`wayland.windowManager.hyprland.package` with applied configuration"; + "`programs.hyprland.package` with applied configuration"; description = mdDoc '' The Hyprland package after applying configuration. ''; @@ -44,17 +43,9 @@ in portalPackage = mkPackageOptionMD pkgs "xdg-desktop-portal-hyprland" { }; - xwayland = { - enable = mkEnableOption (mdDoc "XWayland") // { default = true; }; - hidpi = mkEnableOption null // { - description = mdDoc '' - Enable HiDPI XWayland, based on [XWayland MR 733](https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/733). - See for more info. - ''; - }; - }; + xwayland.enable = mkEnableOption (mdDoc "XWayland") // { default = true; }; - nvidiaPatches = mkEnableOption (mdDoc "patching wlroots for better Nvidia support"); + enableNvidiaPatches = mkEnableOption (mdDoc "patching wlroots for better Nvidia support"); }; config = mkIf cfg.enable { @@ -77,4 +68,15 @@ in extraPortals = [ finalPortalPackage ]; }; }; + + imports = with lib; [ + (mkRemovedOptionModule + [ "programs" "hyprland" "xwayland" "hidpi" ] + "XWayland patches are deprecated. Refer to https://wiki.hyprland.org/Configuring/XWayland" + ) + (mkRenamedOptionModule + [ "programs" "hyprland" "nvidiaPatches" ] + [ "programs" "hyprland" "enableNvidiaPatches" ] + ) + ]; } From 99230bc0bbdef83ecbc7a2a75aaa25f443f836e9 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Thu, 3 Aug 2023 20:17:20 +0300 Subject: [PATCH 3/5] xdg-desktop-portal-hyprland: 0.4.0 -> 0.5.0 --- .../hyprwm/xdg-desktop-portal-hyprland/source.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/window-managers/hyprwm/xdg-desktop-portal-hyprland/source.nix b/pkgs/applications/window-managers/hyprwm/xdg-desktop-portal-hyprland/source.nix index 6b26f0eff426..cb4c3efad137 100644 --- a/pkgs/applications/window-managers/hyprwm/xdg-desktop-portal-hyprland/source.nix +++ b/pkgs/applications/window-managers/hyprwm/xdg-desktop-portal-hyprland/source.nix @@ -3,7 +3,7 @@ , wayland }: let - version = "0.4.0"; + version = "0.5.0"; in { inherit version; @@ -12,7 +12,7 @@ in owner = "hyprwm"; repo = "xdg-desktop-portal-hyprland"; rev = "v${version}"; - hash = "sha256-r+XMyOoRXq+hlfjayb+fyi9kq2JK48TrwuNIAXqlj7U="; + hash = "sha256-C5AO0KnyAFJaCkOn+5nJfWm0kyiPn/Awh0lKTjhgr7Y="; }; meta = with lib; { From 7bacbf43b7c1255fb678a90f0a93bab76c691a24 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Fri, 11 Aug 2023 16:15:08 +0300 Subject: [PATCH 4/5] hyprpaper: 0.3.0 -> 0.4.0 --- .../window-managers/hyprwm/hyprpaper/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/window-managers/hyprwm/hyprpaper/default.nix b/pkgs/applications/window-managers/hyprwm/hyprpaper/default.nix index f329c0ea7fbd..32c2a8085d13 100644 --- a/pkgs/applications/window-managers/hyprwm/hyprpaper/default.nix +++ b/pkgs/applications/window-managers/hyprwm/hyprpaper/default.nix @@ -2,6 +2,7 @@ , stdenv , fetchFromGitHub , cmake +, file , libjpeg , mesa , pango @@ -13,13 +14,13 @@ stdenv.mkDerivation (finalAttrs: { pname = "hyprpaper"; - version = "0.3.0"; + version = "0.4.0"; src = fetchFromGitHub { owner = "hyprwm"; repo = finalAttrs.pname; rev = "v${finalAttrs.version}"; - hash = "sha256-/ehJbAtSJS86NlqHVOeR2ViBKlImKH4guFVPacTmCr8="; + hash = "sha256-V5ulB9CkGh1ghiC4BKvRdoYKZzpaiOKzAOUmJIFkgM0="; }; nativeBuildInputs = [ @@ -29,6 +30,7 @@ stdenv.mkDerivation (finalAttrs: { ]; buildInputs = [ + file libjpeg mesa pango From 355ebe41fa0d2fe121a6b47308e3199d743d3d65 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Sat, 5 Aug 2023 12:51:19 +0300 Subject: [PATCH 5/5] hyprland: don't warn against xdpw and xdph being present It seems that having both the Hyprland and the wlr desktop portals does not result in unexpected behaviour. xdph will be started and wlr ignored. --- .../hyprwm/hyprland/default.nix | 4 ++- .../hyprwm/hyprland/portals.patch | 28 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 pkgs/applications/window-managers/hyprwm/hyprland/portals.patch diff --git a/pkgs/applications/window-managers/hyprwm/hyprland/default.nix b/pkgs/applications/window-managers/hyprwm/hyprland/default.nix index f2b430c5bc11..7d611d1f0d50 100644 --- a/pkgs/applications/window-managers/hyprwm/hyprland/default.nix +++ b/pkgs/applications/window-managers/hyprwm/hyprland/default.nix @@ -52,7 +52,9 @@ stdenv.mkDerivation (finalAttrs: { # make meson use the provided dependencies instead of the git submodules "${finalAttrs.src}/nix/patches/meson-build.patch" # look into $XDG_DESKTOP_PORTAL_DIR instead of /usr; runtime checks for conflicting portals - "${finalAttrs.src}/nix/patches/portals.patch" + # NOTE: revert back to the patch inside SRC on the next version bump + # "${finalAttrs.src}/nix/patches/portals.patch" + ./portals.patch ]; postPatch = '' diff --git a/pkgs/applications/window-managers/hyprwm/hyprland/portals.patch b/pkgs/applications/window-managers/hyprwm/hyprland/portals.patch new file mode 100644 index 000000000000..cb3d97c371ca --- /dev/null +++ b/pkgs/applications/window-managers/hyprwm/hyprland/portals.patch @@ -0,0 +1,28 @@ +diff --git a/src/Compositor.cpp b/src/Compositor.cpp +index 1d978aed..56665389 100644 +--- a/src/Compositor.cpp ++++ b/src/Compositor.cpp +@@ -2365,17 +2365,16 @@ void CCompositor::performUserChecks() { + + static auto* const PSUPPRESSPORTAL = &g_pConfigManager->getConfigValuePtr("misc:suppress_portal_warnings")->intValue; + +- if (!*PSUPPRESSPORTAL) { +- if (std::ranges::any_of(BAD_PORTALS, [&](const std::string& portal) { return std::filesystem::exists("/usr/share/xdg-desktop-portal/portals/" + portal + ".portal"); })) { ++ static auto* const PORTALDIRENV = getenv("XDG_DESKTOP_PORTAL_DIR"); ++ ++ static auto const PORTALDIR = PORTALDIRENV != NULL ? std::string(PORTALDIRENV) : ""; ++ ++ if (!*PSUPPRESSPORTAL && PORTALDIR != "") { ++ if (std::ranges::any_of(BAD_PORTALS, [&](const std::string& portal) { return std::filesystem::exists(PORTALDIR + "/" + portal + ".portal"); })) { + // bad portal detected + g_pHyprNotificationOverlay->addNotification("You have one or more incompatible xdg-desktop-portal impls installed. Please remove incompatible ones to avoid issues.", + CColor(0), 15000, ICON_ERROR); + } +- +- if (std::filesystem::exists("/usr/share/xdg-desktop-portal/portals/hyprland.portal") && std::filesystem::exists("/usr/share/xdg-desktop-portal/portals/wlr.portal")) { +- g_pHyprNotificationOverlay->addNotification("You have xdg-desktop-portal-hyprland and -wlr installed simultaneously. Please uninstall one to avoid issues.", CColor(0), +- 15000, ICON_ERROR); +- } + } + } +