Merge pull request #247008 from fufexan/hyprland

Update hyprwm packages and nixos/hyprland
This commit is contained in:
Ilan Joselevich 2023-08-12 14:55:29 +03:00 committed by GitHub
commit 2393e099a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 90 additions and 87 deletions

View file

@ -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 <https://wiki.hyprland.org/Nix/Options-Overrides/#xwayland-hidpi> 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" ]
)
];
}

View file

@ -2,8 +2,10 @@
, stdenv
, fetchFromGitHub
, pkg-config
, makeWrapper
, meson
, ninja
, binutils
, cairo
, git
, hyprland-protocols
@ -24,34 +26,35 @@
, 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"
# NOTE: revert back to the patch inside SRC on the next version bump
# "${finalAttrs.src}/nix/patches/portals.patch"
./portals.patch
];
postPatch = ''
@ -64,6 +67,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
jq
makeWrapper
meson
ninja
pkg-config
@ -90,7 +94,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 +110,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; {

View file

@ -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);
- }
}
}

View file

@ -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
];
})

View file

@ -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

View file

@ -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; {