modules#steam: create xsession for Steam

This commit is contained in:
Timothy DeHerrera 2020-07-09 00:05:24 -06:00
parent e9be8e5f5e
commit 4ebf259d11
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
5 changed files with 88 additions and 1 deletions

View File

@ -3,4 +3,5 @@
./security/mitigations.nix ./security/mitigations.nix
./services/hardware/wii-u-gc-adapter.nix ./services/hardware/wii-u-gc-adapter.nix
./services/games/gamemode.nix ./services/games/gamemode.nix
./services/x11/window-managers/steam.nix
] ]

View File

@ -0,0 +1,45 @@
{ pkgs, lib, config, ... }:
with lib;
let cfg = config.services.xserver.windowManager.steam;
in {
options = {
services.xserver.windowManager.steam = {
enable = mkEnableOption "steam";
package = mkOption {
type = lib.types.package;
default = pkgs.steam;
description = ''
The Steam package to use.
'';
};
extraSessionCommands = mkOption {
type = lib.types.str;
default = "";
description = ''
Shell commands executed just before Steam is started.
'';
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ cfg.package ];
services.xserver.windowManager.session = [{
name = "steam";
start = ''
${cfg.extraSessionCommands}
# needed to ensure conflicting compositors are not running
${pkgs.systemd}/bin/systemctl --user stop graphical-session.target
${pkgs.xorg.xset}/bin/xset -dpms
${pkgs.xorg.xset}/bin/xset s off
${pkgs.steamcompmgr}/bin/steamcompmgr &
steam -tenfoot -fulldesktopres
'';
}];
};
}

View File

@ -0,0 +1,34 @@
{ stdenv, fetchFromGitHub, libudev, SDL, SDL_image, libXdamage, libXcomposite
, libXrender, libXext, libXxf86vm, pkgconfig, autoreconfHook, gnumake }:
stdenv.mkDerivation {
name = "steamcompmgr";
src = fetchFromGitHub {
owner = "gamer-os";
repo = "steamos-compositor-plus";
rev = "c3855fcb5015ecdca299ee4b46b9f90c7a6788de";
hash = "sha256-sRthjN+pnabl67PuJS+zbUznW4ws0fub0R9bTzelg18=";
};
buildInputs = [
libudev
SDL
SDL_image
libXdamage
libXcomposite
libXrender
libXext
libXxf86vm
pkgconfig
autoreconfHook
gnumake
];
meta = with stdenv.lib; {
description = "SteamOS Compositor";
homepage = "https://github.com/steamos-compositor-plus";
maintainers = [ maintainers.nrdxp ];
license = licenses.bsd2;
inherit version;
};
}

View File

@ -7,4 +7,6 @@ final: prev: {
wii-u-gc-adapter = prev.callPackage ./misc/drivers/wii-u-gc-adapter { }; wii-u-gc-adapter = prev.callPackage ./misc/drivers/wii-u-gc-adapter { };
libinih = prev.callPackage ./development/libraries/libinih { }; libinih = prev.callPackage ./development/libraries/libinih { };
gamemode = prev.callPackage ./os-specific/linux/gamemode { }; gamemode = prev.callPackage ./os-specific/linux/gamemode { };
steamcompmgr =
prev.callPackage ./applications/window-managers/steamcompmgr { };
} }

View File

@ -2,7 +2,6 @@
imports = [ ../graphical ./udev.nix ]; imports = [ ../graphical ./udev.nix ];
environment.systemPackages = with unstablePkgs; [ environment.systemPackages = with unstablePkgs; [
retroarchBare retroarchBare
steam
steam-run steam-run
pcsx2 pcsx2
qjoypad qjoypad
@ -15,6 +14,12 @@
# fps games on laptop need this # fps games on laptop need this
services.xserver.libinput.disableWhileTyping = false; services.xserver.libinput.disableWhileTyping = false;
# Launch steam from display managers
services.xserver.windowManager.steam = {
enable = true;
package = unstablePkgs.steam;
};
# 32-bit support needed for steam # 32-bit support needed for steam
hardware.opengl.driSupport32Bit = true; hardware.opengl.driSupport32Bit = true;
hardware.pulseaudio.support32Bit = true; hardware.pulseaudio.support32Bit = true;