{ config, lib, pkgs, ... }: { config = lib.mkIf (config.beancloud.software.desktop) { services = { xserver = { displayManager = { gdm = { enable = if config.beancloud.hardware.steamdeck then false else true; wayland = true; autoLogin.delay = lib.mkIf config.beancloud.hardware.steamdeck 6; }; }; desktopManager.gnome = { enable = true; # example for a Gnome config not managed by the home-manager # extraGSettingsOverridePackages = [ pkgs.mutter ]; # extraGSettingsOverrides = '' # [org.gnome.mutter] # experimental-features=['scale-monitor-framebuffer'] # ''; }; }; displayManager = { defaultSession = "gnome"; }; gnome.localsearch.enable = true; udev.packages = [ pkgs.gnome-settings-daemon ]; }; environment.systemPackages = with pkgs; [ adwaita-icon-theme gnome-bluetooth (lib.mkIf config.beancloud.software.development gnome-boxes) (lib.mkIf config.beancloud.software.development gnome-builder) gnome-connections gnome-firmware gnomeExtensions.dash-to-dock gnomeExtensions.gtk4-desktop-icons-ng-ding gnomeExtensions.open-bar gnomeExtensions.no-overview ]; environment.gnome.excludePackages = with pkgs; [ gnome-tour gnome-initial-setup ]; systemd.user.services.display-config = { enable = false; wantedBy = [ "default.target" ]; after = [ "graphical-session.target" ]; partOf = [ "graphical-session.target" ]; description = "Gnome display configuration"; unitConfig = { ConditionUser = "!root"; }; serviceConfig = { Type = "oneshot"; Restart = "on-failure"; RestartSec = "5s"; RestartSteps = 24; RestartMaxDelaySec = "120s"; }; script = '' set -e set -u set -o pipefail export DISPLAY=:0.0 WAIT_TIME="5s" sleep 15s if [ "''$(cat /sys/class/drm/card1-DP-1/status)" = "connected" ]; then ${pkgs.mutter}/bin/gdctl set --logical-monitor --primary --monitor 'DP-1' sleep "''${WAIT_TIME}" if ! ${pkgs.mutter}/bin/gdctl show | grep -A6 'Logical monitor #1' | grep -A2 'Primary: yes' | grep 'DP-1'; then echo "display config not applied..." exit 1 fi else ${pkgs.mutter}/bin/gdctl set --logical-monitor --primary --monitor 'eDP-1' sleep "''${WAIT_TIME}" if ! ${pkgs.mutter}/bin/gdctl show | grep -A6 'Logical monitor #1' | grep -A2 'Primary: yes' | grep 'eDP-1'; then echo "display config not applied..." exit 1 fi fi if ${pkgs.mutter}/bin/gdctl show | grep 'Logical monitor #2'; then echo "display config not applied..." exit 1 fi ''; }; }; imports = [ ./desktop.nix ]; }