diff --git a/settings/hyprland.nix b/settings/hyprland.nix index c3c4a98..3f21421 100644 --- a/settings/hyprland.nix +++ b/settings/hyprland.nix @@ -14,25 +14,31 @@ let (builtins.readFile "${pkgs.closureInfo { rootPaths = [ hyprland-pkgs.hyprland ]; }}/store-paths")))); - hyprland-wrapped = (pkgs.symlinkJoin { + hyprland-wrapped = pkgs.symlinkJoin { name = hyprland-pkgs.hyprland.name; paths = [ hyprland-pkgs.hyprland ]; nativeBuildInputs = [ pkgs.makeWrapper ]; + # passthru inside symlinkJoin flows through runCommand → mkDerivation, + # which correctly sets drv.passthru. The display manager requires + # providedSessions; HM's hyprland module requires override. + passthru = { + providedSessions = [ "hyprland" ]; + override = _: hyprland-wrapped; + }; 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" + + # The session .desktop symlinks to the original package and contains + # its absolute store path. Rewrite Exec= to our wrapped binary so + # GDM actually launches the LD_PRELOAD wrapper, not the bare binary. + desktop=$out/share/wayland-sessions/hyprland.desktop + orig=$(readlink -f "$desktop") + rm "$desktop" + sed "s|^Exec=.*|Exec=$out/bin/start-hyprland|" "$orig" > "$desktop" ''; - # symlinkJoin lacks passthru; restore it from the original so the display - # manager finds providedSessions, and stub override so HM's hyprland module - # (which calls package.override { enableXWayland = ... }) doesn't error. - }) // { - passthru = (hyprland-pkgs.hyprland.passthru or {}) // { - providedSessions = [ "hyprland" ]; - override = _: hyprland-wrapped; - }; - override = _: hyprland-wrapped; }; in {