refactor: removing needless module complexity
This commit is contained in:
64
modules/home/programs/steam/default.nix
Normal file
64
modules/home/programs/steam/default.nix
Normal file
@@ -0,0 +1,64 @@
|
||||
# Yanked from Misterio77
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption concatStringsSep head filter getExe;
|
||||
cfg = config.home.programs.steam;
|
||||
steam-with-pkgs = pkgs.steam.override {
|
||||
extraPkgs = pkgs:
|
||||
with pkgs; [
|
||||
xorg.libXcursor
|
||||
xorg.libXi
|
||||
xorg.libXinerama
|
||||
xorg.libXScrnSaver
|
||||
libpng
|
||||
libpulseaudio
|
||||
libvorbis
|
||||
stdenv.cc.cc.lib
|
||||
libkrb5
|
||||
keyutils
|
||||
gamescope
|
||||
];
|
||||
};
|
||||
|
||||
monitor = head (filter (m: m.primary) config.monitors);
|
||||
steam-session = let
|
||||
gamescope = concatStringsSep " " [
|
||||
(getExe pkgs.gamescope)
|
||||
"--output-width ${toString monitor.width}"
|
||||
"--output-height ${toString monitor.height}"
|
||||
"--framerate-limit ${toString monitor.refreshRate}"
|
||||
"--prefer-output ${monitor.name}"
|
||||
# "--adaptive-sync"
|
||||
"--expose-wayland"
|
||||
"--hdr-enabled"
|
||||
"--steam"
|
||||
];
|
||||
steam = concatStringsSep " " [
|
||||
"steam"
|
||||
"steam://open/bigpicture"
|
||||
];
|
||||
in
|
||||
pkgs.writeTextDir "share/wayland-sessions/steam-sesson.desktop" # ini
|
||||
|
||||
''
|
||||
[Desktop Entry]
|
||||
Name=Steam Session
|
||||
Exec=${gamescope} -- ${steam}
|
||||
Type=Application
|
||||
'';
|
||||
in {
|
||||
options = {
|
||||
home.programs.steam.enable = mkEnableOption "Enables steam";
|
||||
};
|
||||
config = {
|
||||
home.packages = mkIf cfg.enable [
|
||||
steam-with-pkgs
|
||||
steam-session
|
||||
pkgs.gamescope
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user