diff --git a/shared/core/default.nix b/shared/core/default.nix index 3b46f2c..9709b26 100644 --- a/shared/core/default.nix +++ b/shared/core/default.nix @@ -3,8 +3,7 @@ { imports = [ - ./gui/pipewire.nix - ./gui/sway.nix + ./gui.nix ./nix.nix ./ssh.nix ]; diff --git a/shared/core/gui.nix b/shared/core/gui.nix new file mode 100644 index 0000000..100cb52 --- /dev/null +++ b/shared/core/gui.nix @@ -0,0 +1,57 @@ +# Almost everything in this file is required to get screen sharing on sway +# to work properly. The rest is required to get sway to work at all. + +{ pkgs, config, lib, ... }: + +let cfg = config.custom.gui; +in { + + options.custom.gui = { + enable = lib.mkEnableOption "Nix-managed GUI services"; + }; + + config = lib.mkIf (cfg.enable) { + hardware.opengl.enable = true; + hardware.nvidia.modesetting.enable = true; + + security.rtkit.enable = true; + + services.xserver = { + enable = true; + displayManager.gdm.enable = true; + videoDrivers = [ "nvidia" ]; + }; + + services.pipewire = { + enable = true; + pulse.enable = true; + wireplumber.enable = true; + }; + + services.dbus.enable = true; + + programs.sway = { + enable = true; + extraPackages = [ + pkgs.vulkan-validation-layers + ]; + }; + + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-kde + ]; + }; + + environment.systemPackages = with pkgs; [ + brightnessctl + mesa + polkit_gnome + vulkan-tools + xdg-desktop-portal-wlr + ]; + }; + +} diff --git a/shared/core/gui/pipewire.nix b/shared/core/gui/pipewire.nix deleted file mode 100644 index 20e0add..0000000 --- a/shared/core/gui/pipewire.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ pkgs, lib, config, ... }: - -let cfg = config.custom.gui.pipewire; - -in with lib; { - - options.custom.gui.pipewire = { - enable = mkEnableOption "pipewire"; - }; - - config = mkIf (cfg.enable) { - - environment.defaultPackages = with pkgs; [ - pavucontrol - ]; - - services.pipewire = { - enable = true; - pulse.enable = true; - }; - - }; - -} \ No newline at end of file diff --git a/shared/core/gui/sway.nix b/shared/core/gui/sway.nix deleted file mode 100644 index 4a97f8d..0000000 --- a/shared/core/gui/sway.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: { - hardware.opengl.enable = true; - services.xserver.enable = true; - services.xserver.displayManager.gdm = { - enable = true; - }; - programs.sway.enable = true; - services.xserver.videoDrivers = [ "nvidia" ]; - hardware.nvidia.modesetting.enable = true; -} diff --git a/shared/home/gui/sway.nix b/shared/home/gui/sway.nix index a7e0dd2..63346a1 100644 --- a/shared/home/gui/sway.nix +++ b/shared/home/gui/sway.nix @@ -47,15 +47,19 @@ in with lib; { '') ]; - # programs.swaylock.enable = true; - # services.swayidle.enable = true; programs.waybar.enable = true; wayland.windowManager.sway = { # This is all required to get it to not die. enable = true; - extraSessionCommands = "export WLR_NO_HARDWARE_CURSORS=1"; + wrapperFeatures.gtk = true; + extraSessionCommands = '' + export WLR_NO_HARDWARE_CURSORS=1; + export WLR_RENDERER=vulkan; + export WLR_EGL_NO_MODIFIERS=1; + ''; extraOptions = [ "--unsupported-gpu" ]; + systemdIntegration = true; config = rec { output."*".bg = "${../../data/wallpaper.jpg} fill"; @@ -93,8 +97,8 @@ in with lib; { "${mod}+q" = "exec ${pkgs.foot}/bin/foot"; "${mod}+Return" = "exec ${terminal}"; "${mod}+Escape" = "exec swaylock"; - "${mod}+Tab" = "exec ${pkgs.firefox}/bin/firefox"; - "${mod}+Alt+Tab" = "exec ${pkgs.google-chrome}/bin/google-chrome-stable"; + "${mod}+Tab" = "exec ${pkgs.firefox-wayland}/bin/firefox"; + "${mod}+Alt+Tab" = "exec ${pkgs.google-chrome}/bin/google-chrome-stable --ozone-platform-hint=auto --enable-features=VaapiVideoDecoder,VaapiVideoEncoder"; "${mod}+Backspace" = "mode kill"; } diff --git a/system/strawberry/core.nix b/system/strawberry/core.nix index 666ece4..7b1a5cd 100644 --- a/system/strawberry/core.nix +++ b/system/strawberry/core.nix @@ -1,7 +1,7 @@ { ... }: { custom = { - gui.pipewire.enable = true; + gui.enable = true; }; system.stateVersion = "21.11";