nixos-config/modules/desktop/sway/default.nix
2022-10-31 10:05:30 +01:00

66 lines
1.7 KiB
Nix

#
# Sway configuration
#
# flake.nix
# ├─ ./hosts
# │ └─ ./laptop
# │ └─ default.nix
# └─ ./modules
# └─ ./desktop
# └─ ./hyprland
# └─ hyprland.nix *
#
{ config, lib, user, pkgs, ... }:
{
imports = [ ../../programs/waybar.nix ];
hardware.opengl = {
enable = true;
};
environment = {
loginShellInit = ''
if [ -z $DISPLAY ] && [ $UID != 0 ] && [ "$(tty)" = "/dev/tty1" ]; then
exec sway
fi
''; # Will automatically open sway when logged into tty1
systemPackages = with pkgs; [
xdg-desktop-portal-wlr
swaylock
swayidle
slurp
grim
bemenu
];
};
programs = {
sway.enable = true;
extraSessionCommands = ''
export MOZ_ENABLE_WAYLAND = "1";
export MOZ_WEBRENDER = "1";
export MOZ_USE_XINPUT2 = "2";
export MOZ_DBUS_REMOTE = "1";
#export GDK_BACKEND = "wayland";
export LIBVA_DRIVER_NAME = "iHD";
export VDPAU_DRIVER = "iHD";
export XDG_SESSION_TYPE = "wayland";
export XDG_CURRENT_DESKTOP = "Unity";
#export QT_QPA_PLATFORMTHEME = "wayland-egl";
export GST_VAAPI_ALL_DRIVERS = "1";
export GTK_THEME = "Arc";
export _JAVA_AWT_WM_NONREPARENTING = "1";
#export LIBCL_ALWAYS_SOFTWARE = "1"; # For applications in VM like alacritty to work
#export WLR_NO_HARDWARE_CURSORS = "1"; # For cursor in VM
'';
security.pam.services.swaylock = {};
xdg.portal = { # Required for flatpak with windowmanagers
#enable = true;
wlr.enable = true;
};
}