mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-01-11 22:30:25 +01:00
refactor: steam (#217)
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
{
|
||||
pkgs,
|
||||
nix-gaming,
|
||||
...
|
||||
}:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
# nix-gaming.packages.${pkgs.system}.osu-laser-bin
|
||||
gamescope # SteamOS session compositing window manager
|
||||
prismlauncher # A free, open source launcher for Minecraft
|
||||
winetricks # A script to install DLLs needed to work around problems in Wine
|
||||
];
|
||||
}
|
||||
@@ -19,7 +19,7 @@ in
|
||||
./hardware-configuration.nix
|
||||
./nvidia.nix
|
||||
./ai
|
||||
./game
|
||||
./gaming.nix
|
||||
|
||||
./preservation.nix
|
||||
./secureboot.nix
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{ mylib, ... }:
|
||||
{
|
||||
imports = mylib.scanPaths ./.;
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
# https://github.com/fufexan/dotfiles/blob/483680e121b73db8ed24173ac9adbcc718cbbc6e/system/programs/gamemode.nix
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
nix-gaming,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
programs = lib.makeBinPath [
|
||||
config.programs.hyprland.package
|
||||
pkgs.coreutils
|
||||
pkgs.power-profiles-daemon
|
||||
];
|
||||
|
||||
startscript = pkgs.writeShellScript "gamemode-start" ''
|
||||
export PATH=$PATH:${programs}
|
||||
export HYPRLAND_INSTANCE_SIGNATURE=$(ls -1 /tmp/hypr | tail -1)
|
||||
hyprctl --batch 'keyword decoration:blur 0 ; keyword animations:enabled 0 ; keyword misc:vfr 0'
|
||||
powerprofilesctl set performance
|
||||
'';
|
||||
|
||||
endscript = pkgs.writeShellScript "gamemode-end" ''
|
||||
export PATH=$PATH:${programs}
|
||||
export HYPRLAND_INSTANCE_SIGNATURE=$(ls -1 /tmp/hypr | tail -1)
|
||||
hyprctl --batch 'keyword decoration:blur 1 ; keyword animations:enabled 1 ; keyword misc:vfr 1'
|
||||
powerprofilesctl set power-saver
|
||||
'';
|
||||
in
|
||||
{
|
||||
# Optimise Linux system performance on demand
|
||||
# https://github.com/FeralInteractive/GameMode
|
||||
# https://wiki.archlinux.org/title/Gamemode
|
||||
#
|
||||
# Usage:
|
||||
# 1. For games/launchers which integrate GameMode support:
|
||||
# https://github.com/FeralInteractive/GameMode#apps-with-gamemode-integration
|
||||
# simply running the game will automatically activate GameMode.
|
||||
# 2. For others, launching the game through gamemoderun: `gamemoderun ./game`
|
||||
# 3. For steam: `gamemoderun steam-runtime`
|
||||
programs.gamemode = {
|
||||
enable = pkgs.stdenv.isx86_64;
|
||||
settings = {
|
||||
general = {
|
||||
softrealtime = "auto";
|
||||
renice = 15;
|
||||
};
|
||||
custom = {
|
||||
start = startscript.outPath;
|
||||
end = endscript.outPath;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# see https://github.com/fufexan/nix-gaming/#pipewire-low-latency
|
||||
services.pipewire.lowLatency.enable = true;
|
||||
programs.steam.platformOptimizations.enable = true;
|
||||
imports = with nix-gaming.nixosModules; [
|
||||
pipewireLowLatency
|
||||
platformOptimizations
|
||||
];
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
# https://github.com/fufexan/dotfiles/blob/483680e/system/programs/steam.nix
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
# https://wiki.archlinux.org/title/steam
|
||||
# Games installed by Steam works fine on NixOS, no other configuration needed.
|
||||
programs.steam = {
|
||||
# Some location that should be persistent:
|
||||
# ~/.local/share/Steam - The default Steam install location
|
||||
# ~/.local/share/Steam/steamapps/common - The default Game install location
|
||||
# ~/.steam/root - A symlink to ~/.local/share/Steam
|
||||
# ~/.steam - Some Symlinks & user info
|
||||
enable = pkgs.stdenv.isx86_64;
|
||||
# https://github.com/ValveSoftware/gamescope
|
||||
# enables features such as resolution upscaling and stretched aspect ratios (such as 4:3)
|
||||
gamescopeSession.enable = true;
|
||||
|
||||
# fix gamescope inside steam
|
||||
package = pkgs.steam.override {
|
||||
extraPkgs =
|
||||
pkgs: with pkgs; [
|
||||
xorg.libXcursor
|
||||
xorg.libXi
|
||||
xorg.libXinerama
|
||||
xorg.libXScrnSaver
|
||||
libpng
|
||||
libpulseaudio
|
||||
libvorbis
|
||||
stdenv.cc.cc.lib
|
||||
libkrb5
|
||||
keyutils
|
||||
|
||||
# fix CJK fonts
|
||||
source-sans
|
||||
source-serif
|
||||
source-han-sans
|
||||
source-han-serif
|
||||
|
||||
# audio
|
||||
pipewire
|
||||
|
||||
# other common
|
||||
udev
|
||||
alsa-lib
|
||||
vulkan-loader
|
||||
xorg.libX11
|
||||
xorg.libXcursor
|
||||
xorg.libXi
|
||||
xorg.libXrandr # To use the x11 feature
|
||||
libxkbcommon
|
||||
wayland # To use the wayland feature
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
fonts.packages = with pkgs; [
|
||||
wqy_zenhei # Need by steam for Chinese
|
||||
];
|
||||
}
|
||||
58
hosts/idols-ai/gaming.nix
Normal file
58
hosts/idols-ai/gaming.nix
Normal file
@@ -0,0 +1,58 @@
|
||||
{ pkgs, nix-gaming, ... }:
|
||||
{
|
||||
# https://wiki.archlinux.org/title/steam
|
||||
# Games installed by Steam works fine on NixOS, no other configuration needed.
|
||||
programs.steam = {
|
||||
# Some location that should be persistent:
|
||||
# ~/.local/share/Steam - The default Steam install location
|
||||
# ~/.local/share/Steam/steamapps/common - The default Game install location
|
||||
# ~/.steam/root - A symlink to ~/.local/share/Steam
|
||||
# ~/.steam - Some Symlinks & user info
|
||||
enable = pkgs.stdenv.isx86_64;
|
||||
# https://github.com/ValveSoftware/gamescope
|
||||
# Run a GameScope driven Steam session from your display-manager
|
||||
# fix resolution upscaling and stretched aspect ratios
|
||||
gamescopeSession.enable = true;
|
||||
# https://github.com/Winetricks/winetricks
|
||||
# Whether to enable protontricks, a simple wrapper for running Winetricks commands for Proton-enabled games.
|
||||
protontricks.enable = true;
|
||||
# Whether to enable Load the extest library into Steam, to translate X11 input events to uinput events (e.g. for using Steam Input on Wayland) .
|
||||
extest.enable = true;
|
||||
fontPackages = [
|
||||
pkgs.wqy_zenhei # Need by steam for Chinese
|
||||
];
|
||||
};
|
||||
|
||||
# see https://github.com/fufexan/nix-gaming/#pipewire-low-latency
|
||||
services.pipewire.lowLatency.enable = true;
|
||||
programs.steam.platformOptimizations.enable = true;
|
||||
imports = with nix-gaming.nixosModules; [
|
||||
pipewireLowLatency
|
||||
platformOptimizations
|
||||
];
|
||||
|
||||
# ==========================================================================
|
||||
# Other Optimizations
|
||||
# Usage:
|
||||
# Lutris - enable advanced options, go to the System options -> Command prefix, add: `mangohud`
|
||||
# Steam - add this as a launch option: `mangohud %command%` / `gamemoderun %command%`
|
||||
# ==========================================================================
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
# https://github.com/flightlessmango/MangoHud
|
||||
# a simple overlay program for monitoring FPS, temperature, CPU and GPU load, and more.
|
||||
mangohud
|
||||
# a GUI game launcher for Steam/GoG/Epic
|
||||
lutris
|
||||
];
|
||||
|
||||
# Optimise Linux system performance on demand
|
||||
# https://github.com/FeralInteractive/GameMode
|
||||
# https://wiki.archlinux.org/title/Gamemode
|
||||
#
|
||||
# Usage:
|
||||
# 1. For games/launchers which integrate GameMode support:
|
||||
# https://github.com/FeralInteractive/GameMode#apps-with-gamemode-integration
|
||||
# simply running the game will automatically activate GameMode.
|
||||
programs.gamemode.enable = pkgs.stdenv.isx86_64;
|
||||
}
|
||||
Reference in New Issue
Block a user