From 5396f6dd6374b6a4b049ad96f1b2ec5bbe517874 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sun, 25 May 2025 19:08:11 +0800 Subject: [PATCH] feat(nixosModules/desktop): add steam --- modules/home/desktop/default.nix | 5 ++ .../windowManager/hyprland/default.nix | 9 +++- modules/nixos/desktop/default.nix | 12 ++++- modules/nixos/hardware/default.nix | 1 + systems/x86_64-linux/nemesis/default.nix | 49 +++++++++++-------- 5 files changed, 53 insertions(+), 23 deletions(-) diff --git a/modules/home/desktop/default.nix b/modules/home/desktop/default.nix index db8ac31..2a77588 100644 --- a/modules/home/desktop/default.nix +++ b/modules/home/desktop/default.nix @@ -21,5 +21,10 @@ zeroconf_port = 5353; }; }) + (lib.mkIf osConfig.desktop.enableSteam { + home.persistence."/persist/home/${config.snowfallorg.user.name}".directories = [ + ".local/share/Steam" + ]; + }) ]; } diff --git a/modules/home/desktop/windowManager/hyprland/default.nix b/modules/home/desktop/windowManager/hyprland/default.nix index e94fd7c..5bdfb58 100644 --- a/modules/home/desktop/windowManager/hyprland/default.nix +++ b/modules/home/desktop/windowManager/hyprland/default.nix @@ -25,6 +25,7 @@ in "uwsm app -- $LOCKSCREEN" "uwsm app -- $NOTIFICATION_DAEMON" ]; + xwayland.force_zero_scaling = true; } (import ./decoration.nix) (import ./keybinds.nix { inherit pkgs; }) @@ -32,7 +33,13 @@ in }; xdg.configFile."uwsm/env".text = # sh '' - + export GDK_SCALE=${mainMonitor.scale} + export STEAM_FORCE_DESKTOPUI_SCALING=${mainMonitor.scale} + ''; + xdg.configFile."uwsm/env-hyprland".text = # sh + '' + export GDK_SCALE=${mainMonitor.scale} + export STEAM_FORCE_DESKTOPUI_SCALING=${mainMonitor.scale} ''; }; } diff --git a/modules/nixos/desktop/default.nix b/modules/nixos/desktop/default.nix index ff13644..48cf993 100644 --- a/modules/nixos/desktop/default.nix +++ b/modules/nixos/desktop/default.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ lib, config, ... }: { imports = [ ./windowManager.nix @@ -17,5 +17,15 @@ terminal = lib.pantheon.mkStrOption; notification-daemon = lib.pantheon.mkStrOption; enableSpotifyd = lib.mkEnableOption ""; + enableSteam = lib.mkEnableOption ""; }; + + config = lib.mkMerge [ + (lib.mkIf config.desktop.enableSteam { + programs.steam = { + enable = true; + gamescopeSession.enable = true; + }; + }) + ]; } diff --git a/modules/nixos/hardware/default.nix b/modules/nixos/hardware/default.nix index 4f83975..c1370bc 100644 --- a/modules/nixos/hardware/default.nix +++ b/modules/nixos/hardware/default.nix @@ -24,5 +24,6 @@ enable = true; settings.General.Experimental = true; }; + hardware.xone.enable = true; }; } diff --git a/systems/x86_64-linux/nemesis/default.nix b/systems/x86_64-linux/nemesis/default.nix index b4b2da4..5797f9a 100644 --- a/systems/x86_64-linux/nemesis/default.nix +++ b/systems/x86_64-linux/nemesis/default.nix @@ -3,30 +3,37 @@ ... }: { - system.hostname = "nemesis"; - system.mainUser.name = "rafiq"; - system.mainUser.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n"; - system.bootloader = "systemd-boot"; - hardware.drives.btrfs = { - enable = true; - drive = "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434"; - ephemeralRoot = true; + system = { + hostname = "nemesis"; + mainUser.name = "rafiq"; + mainUser.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n"; + bootloader = "systemd-boot"; }; - hardware.platform = "amd"; - hardware.gpu = "nvidia"; - desktop.windowManager = "hyprland"; - desktop.browser = "firefox"; - desktop.terminal = "ghostty"; - desktop.lockscreen = "hyprlock"; - desktop.notification-daemon = "mako"; - desktop.mainMonitor = { - id = "desc:OOO AN-270W04K"; - scale = "2"; - resolution = "3840x2160"; - refresh-rate = "60"; + hardware = { + drives.btrfs = { + enable = true; + drive = "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434"; + ephemeralRoot = true; + }; + platform = "amd"; + gpu = "nvidia"; }; - desktop.enableSpotifyd = true; + desktop = { + windowManager = "hyprland"; + browser = "firefox"; + terminal = "ghostty"; + lockscreen = "hyprlock"; + notification-daemon = "mako"; + mainMonitor = { + id = "desc:OOO AN-270W04K"; + scale = "2"; + resolution = "3840x2160"; + refresh-rate = "60"; + }; + enableSpotifyd = true; + enableSteam = true; + }; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; }