From 38ef4c59f15de710ce37c1e2331bfa5579ee2988 Mon Sep 17 00:00:00 2001 From: ediblerope Date: Wed, 13 May 2026 22:40:54 +0100 Subject: [PATCH] Maybe fix hyprland. --- settings/hyprland.nix | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/settings/hyprland.nix b/settings/hyprland.nix index ac1cb42..a6039d2 100644 --- a/settings/hyprland.nix +++ b/settings/hyprland.nix @@ -1,12 +1,38 @@ # settings/hyprland.nix { config, pkgs, lib, inputs, ... }: +let + hyprland-pkgs = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}; + hyprutils = hyprland-pkgs.hyprutils; + + # hyprutils-0.13.1 was compiled with GCC 15 (requires GLIBCXX_3.4.34) but + # its RPATH was patched to gcc-14.3.0-lib which only goes to GLIBCXX_3.4.33. + # Locate gcc-15's libstdc++ from hyprutils's own runtime closure so the + # version is always in sync with whatever hyprland shipped. + gcc15-lib = lib.head (lib.filter + (p: lib.hasInfix "gcc-15" p && lib.hasSuffix "-lib" p) + (lib.splitString "\n" + (lib.removeSuffix "\n" + (builtins.readFile (pkgs.writeReferencesToFile hyprutils))))); + + hyprland-wrapped = pkgs.symlinkJoin { + name = hyprland-pkgs.hyprland.name; + paths = [ hyprland-pkgs.hyprland ]; + nativeBuildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/start-hyprland \ + --set LD_PRELOAD "${gcc15-lib}/lib/libstdc++.so.6" + wrapProgram $out/bin/Hyprland \ + --set LD_PRELOAD "${gcc15-lib}/lib/libstdc++.so.6" + ''; + }; +in { config = lib.mkIf (config.networking.hostName == "FredOS-Gaming") { programs.hyprland = { enable = true; xwayland.enable = true; - package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; - portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland; + package = hyprland-wrapped; + portalPackage = hyprland-pkgs.xdg-desktop-portal-hyprland; }; xdg.portal = { @@ -58,7 +84,7 @@ wayland.windowManager.hyprland = { enable = true; systemd.variables = [ "--all" ]; - package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; + package = hyprland-wrapped; settings = { monitor = "DP-2,3440x1440@180,0x0,1";