From df7d5f3f93ecaf99c9c041cc9c028778be8128e5 Mon Sep 17 00:00:00 2001 From: Jordan Holt Date: Fri, 22 Aug 2025 21:04:58 +0100 Subject: [PATCH] users/guest: init and add steam --- flake.lock | 8 +-- hosts/artemis/default.nix | 3 + .../guest/common/optional/graphical/steam.nix | 30 +++++++++ users/guest/default.nix | 66 +++++++++++++++++++ 4 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 users/guest/common/optional/graphical/steam.nix create mode 100644 users/guest/default.nix diff --git a/flake.lock b/flake.lock index 1c8773f..6c638d2 100644 --- a/flake.lock +++ b/flake.lock @@ -1143,11 +1143,11 @@ "secrets": { "flake": false, "locked": { - "lastModified": 1753994653, - "narHash": "sha256-kVd17w6oo9dbZfgZXMMPEssspp8vAr32G5U8VnfuIFc=", + "lastModified": 1755887038, + "narHash": "sha256-HoEMwFfR3rwNxwJjFCbj3rfW8k6EabHuMJAZOwsT95c=", "ref": "refs/heads/master", - "rev": "e0cb8c5b8de3f61fbef13c80219715f2e3e5ffb5", - "revCount": 39, + "rev": "9e47b557087ebde3a30c9f97189d110c29d144fd", + "revCount": 40, "type": "git", "url": "ssh://git@git.vimium.com/jordan/nix-secrets.git" }, diff --git a/hosts/artemis/default.nix b/hosts/artemis/default.nix index 92e2077..8d009d0 100644 --- a/hosts/artemis/default.nix +++ b/hosts/artemis/default.nix @@ -18,6 +18,7 @@ in ./hardware-configuration.nix ./disko-config.nix ../desktop.nix + ../../users/guest ]; nixpkgs = { @@ -72,6 +73,8 @@ in capSysAdmin = true; }; + programs.steam.enable = true; + environment = { systemPackages = [ pkgs.wine ]; sessionVariables.WINE_BIN = getExe pkgs.wine; diff --git a/users/guest/common/optional/graphical/steam.nix b/users/guest/common/optional/graphical/steam.nix new file mode 100644 index 0000000..e7d3344 --- /dev/null +++ b/users/guest/common/optional/graphical/steam.nix @@ -0,0 +1,30 @@ +{ + pkgs, + ... +}: +{ + home.packages = with pkgs; [ + gamescope + steam + ]; + + systemd.user.services.steam-big-picture = { + Unit = { + Description = "Steam Big Picture in Gamescope"; + After = [ + "graphical.target" + "default.target" + ]; + }; + Service = { + ExecStart = '' + ${pkgs.gamescope}/bin/gamescope --rt --backend drm --steam -- \ + ${pkgs.steam}/bin/steam -pipewire-dmabuf -tenfoot + ''; + Restart = "always"; + }; + Install = { + WantedBy = [ "default.target" ]; + }; + }; +} diff --git a/users/guest/default.nix b/users/guest/default.nix new file mode 100644 index 0000000..49d93c9 --- /dev/null +++ b/users/guest/default.nix @@ -0,0 +1,66 @@ +{ + config, + pkgs, + lib, + ... +}: +let + inherit (lib) + optional + ; + name = "guest"; + hostFile = ./. + "/${config.networking.hostName}.nix"; +in +{ + users.users.${name} = { + description = "Guest"; + extraGroups = [ + "audio" + "input" + "render" + "video" + ]; + group = "users"; + isNormalUser = true; + shell = pkgs.zsh; + }; + + home-manager.users.${name} = { + imports = [ + ./common/optional/graphical/steam.nix + { + home.persistence."/state" = { + directories = [ + ".local/state/wireplumber" + ]; + }; + home.persistence."/persist" = { + directories = [ + ".config/gamescope" + ".local/share/icons" + ".local/share/Steam" + ".local/share/vulkan" + ".steam" + ]; + }; + } + ] + ++ optional (builtins.pathExists hostFile) hostFile; + + home = { + username = name; + }; + + xdg.enable = true; + }; + + services.getty = { + autologinOnce = true; + autologinUser = "guest"; + }; + + # Workaround: https://github.com/nix-community/home-manager/issues/7166 + systemd.services."home-manager-${name}".serviceConfig = { + RemainAfterExit = "yes"; + }; +}