Skip to content

Instantly share code, notes, and snippets.

@Philipp-M
Last active February 25, 2023 15:49
Show Gist options
  • Save Philipp-M/ccbda3635848a2c9de3806599173e657 to your computer and use it in GitHub Desktop.
Save Philipp-M/ccbda3635848a2c9de3806599173e657 to your computer and use it in GitHub Desktop.
{
services.xserver.displayManager = {
sessionPackages = [
(
let sessionName = "Hyprland"; in pkgs.writeTextFile
{
name = sessionName;
destination = "/share/wayland-sessions/${sessionName}.desktop";
text = ''
[Desktop Entry]
Version=1.0
Name=${sessionName}
Type=Application
Comment=An intelligent dynamic tiling Wayland compositor
Exec=${pkgs.writeShellScriptBin sessionName ''
. "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"
if [ -e "$HOME/.profile" ]; then
. "$HOME/.profile"
fi
systemctl --user stop graphical-session.target graphical-session-pre.target
${lib.optionalString (config.xsession.importedVariables != [ ])
("systemctl --user import-environment "
+ toString (lib.unique config.xsession.importedVariables))}
${lib.optionalString (config.wayland.windowManager.hyprland.nvidiaPatches) ''
export LIBVA_DRIVER_NAME=nvidia
export GBM_BACKEND=nvidia-drm
export GDK_BACKEND=wayland
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export WLR_NO_HARDWARE_CURSORS=1
''}
export XDG_SESSION_TYPE=wayland
# export GTK_USE_PORTAL=1
export MOZ_GLX_TEST_EARLY_WL_ROUNDTRIP=1
export NIXOS_OZONE_WL=1
systemctl --user start hm-graphical-session.target
systemctl --user start hyprland-session.target
${config.wayland.windowManager.hyprland.package}/bin/Hyprland
systemctl --user stop hyprland-session.target
systemctl --user stop hm-graphical-session.target
systemctl --user stop graphical-session.target
systemctl --user stop graphical-session-pre.target
unset __HM_SESS_VARS_SOURCED
''}/bin/${sessionName}
'';
} // {
providedSessions = [ sessionName ];
}
)
];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment