From 8e61ea65036bb8e71bddc2f026f66f54449d08e5 Mon Sep 17 00:00:00 2001 From: Kabbone Date: Thu, 27 Jul 2023 21:44:27 +0200 Subject: [PATCH] hosts: steamdeck: separate gnome and steam config --- hosts/steamdeck/default.nix | 1 + hosts/steamdeck/home.nix | 2 +- modules/desktop/gnome/default.nix | 116 +++++++++++++----------------- modules/desktop/steam/default.nix | 40 +++++++++++ modules/desktop/steam/home.nix | 16 +++++ 5 files changed, 107 insertions(+), 68 deletions(-) create mode 100644 modules/desktop/steam/default.nix create mode 100644 modules/desktop/steam/home.nix diff --git a/hosts/steamdeck/default.nix b/hosts/steamdeck/default.nix index 2609758..26be60d 100644 --- a/hosts/steamdeck/default.nix +++ b/hosts/steamdeck/default.nix @@ -22,6 +22,7 @@ { imports = # For now, if applying to other system, swap files [(import ./hardware-configuration.nix)] ++ # Current system hardware config @ /etc/nixos/hardware-configuration.nix + [(import ../../modules/desktop/steam/default.nix)] ++ # Window Manager [(import ../../modules/desktop/gnome/default.nix)] ++ # Window Manager [(import ../../modules/desktop/virtualisation/docker.nix)] ++ # Docker (import ../../modules/hardware); # Hardware devices diff --git a/hosts/steamdeck/home.nix b/hosts/steamdeck/home.nix index 87b8272..9920be8 100644 --- a/hosts/steamdeck/home.nix +++ b/hosts/steamdeck/home.nix @@ -16,7 +16,7 @@ { imports = [ - #../../modules/desktop/hyprland/home.nix # Window Manager + ../../modules/desktop/steam/home.nix # Window Manager ../../modules/desktop/gnome/home.nix # Window Manager ../../modules/home.nix # Window Manager ]; diff --git a/modules/desktop/gnome/default.nix b/modules/desktop/gnome/default.nix index 104d886..f1183f5 100644 --- a/modules/desktop/gnome/default.nix +++ b/modules/desktop/gnome/default.nix @@ -10,32 +10,14 @@ # └─ ./gnome # └─ default.nix * # -{ config, lib, user, pkgs, jovian-nixos, ... }: +{ config, lib, user, pkgs, ... }: { - imports = [ - (jovian-nixos + "/modules") - ]; - - jovian = { - steam.enable = true; - devices.steamdeck = { - enable = true; - }; - }; - hardware.pulseaudio.enable = lib.mkForce false; - hardware.opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; - }; - environment.systemPackages = with pkgs; [ gnome.gnome-terminal gnomeExtensions.dash-to-dock - steamdeck-firmware rocm-opencl-icd rocm-opencl-runtime clinfo @@ -54,52 +36,52 @@ }; }; - systemd.services.gamescope-switcher = { - wantedBy = [ "graphical.target" ]; - serviceConfig = { - User = 2000; - PAMName = "login"; - WorkingDirectory = "~"; - - TTYPath = "/dev/tty7"; - TTYReset = "yes"; - TTYVHangup = "yes"; - TTYVTDisallocate = "yes"; - - StandardInput = "tty-fail"; - StandardOutput = "journal"; - StandardError = "journal"; - - UtmpIdentifier = "tty7"; - UtmpMode = "user"; - - Restart = "always"; - }; - - script = '' - set-session () { - mkdir -p ~/.local/state - >~/.local/state/steamos-session-select echo "$1" - } - consume-session () { - if [[ -e ~/.local/state/steamos-session-select ]]; then - cat ~/.local/state/steamos-session-select - rm ~/.local/state/steamos-session-select - else - echo "gamescope" - fi - } - while :; do - session=$(consume-session) - case "$session" in - plasma) - dbus-run-session -- gnome-shell --display-server --wayland - ;; - gamescope) - steam-session - ;; - esac - done - ''; - }; +# systemd.services.gamescope-switcher = { +# wantedBy = [ "graphical.target" ]; +# serviceConfig = { +# User = 2000; +# PAMName = "login"; +# WorkingDirectory = "~"; +# +# TTYPath = "/dev/tty7"; +# TTYReset = "yes"; +# TTYVHangup = "yes"; +# TTYVTDisallocate = "yes"; +# +# StandardInput = "tty-fail"; +# StandardOutput = "journal"; +# StandardError = "journal"; +# +# UtmpIdentifier = "tty7"; +# UtmpMode = "user"; +# +# Restart = "always"; +# }; +# +# script = '' +# set-session () { +# mkdir -p ~/.local/state +# >~/.local/state/steamos-session-select echo "$1" +# } +# consume-session () { +# if [[ -e ~/.local/state/steamos-session-select ]]; then +# cat ~/.local/state/steamos-session-select +# rm ~/.local/state/steamos-session-select +# else +# echo "gamescope" +# fi +# } +# while :; do +# session=$(consume-session) +# case "$session" in +# plasma) +# dbus-run-session -- gnome-shell --display-server --wayland +# ;; +# gamescope) +# steam-session +# ;; +# esac +# done +# ''; +# }; } diff --git a/modules/desktop/steam/default.nix b/modules/desktop/steam/default.nix new file mode 100644 index 0000000..1ab29fe --- /dev/null +++ b/modules/desktop/steam/default.nix @@ -0,0 +1,40 @@ +# +# Gnome configuration +# +# flake.nix +# ├─ ./hosts +# │ └─ ./laptop +# │ └─ default.nix +# └─ ./modules +# └─ ./desktop +# └─ ./gnome +# └─ default.nix * +# +{ config, lib, user, pkgs, jovian-nixos, ... }: + +{ + imports = [ + (jovian-nixos + "/modules") + ]; + + jovian = { + steam.enable = true; + devices.steamdeck = { + enable = true; + }; + }; + + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + environment.systemPackages = with pkgs; [ + steamdeck-firmware + ]; + +# services = { +# }; + +} diff --git a/modules/desktop/steam/home.nix b/modules/desktop/steam/home.nix new file mode 100644 index 0000000..ab04e3f --- /dev/null +++ b/modules/desktop/steam/home.nix @@ -0,0 +1,16 @@ +# +# Gnome NixOS & Home manager configuration +# +# flake.nix +# ├─ ./hosts +# │ └─ ./steamdeck +# │ └─ home.nix +# └─ ./modules +# └─ ./desktop +# └─ ./steam +# └─ home.nix * +# + +{ config, lib, pkgs, ... }: +{ +}