62 lines
1.7 KiB
Nix
62 lines
1.7 KiB
Nix
{ config, pkgs, lib, inputs, system, ... }:
|
|
|
|
let cfg = config.sydnix.steam;
|
|
in {
|
|
options.sydnix.steam = {
|
|
enable = lib.mkEnableOption "Steam";
|
|
impermanenceUsers = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = [];
|
|
description = ''
|
|
A list of users for which ~/.local/share/Steam shall be persisted. This
|
|
is a disgusting hack to get around an issue with Impermanence's
|
|
home-manager module.
|
|
https://github.com/nix-community/impermanence/issues/165#issuecomment-2537723929
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
programs.steam = {
|
|
enable = true;
|
|
remotePlay.openFirewall = true;
|
|
dedicatedServer.openFirewall = true;
|
|
gamescopeSession.enable = true;
|
|
extraPackages = with pkgs; [
|
|
mono gtk3 gtk3-x11 libgdiplus zlib nss SDL2
|
|
];
|
|
# Work around xwayland-satellite#252 by clearing the clipboard
|
|
# before launching Steam.
|
|
#
|
|
# https://github.com/Supreeeme/xwayland-satellite/issues/252
|
|
package = pkgs.steam.override {
|
|
extraPreBwrapCmds =
|
|
let wl-copy = lib.getExe' pkgs.wl-clipboard "wl-copy";
|
|
in "${wl-copy} --clear";
|
|
};
|
|
};
|
|
|
|
programs.gamemode = {
|
|
enable = true;
|
|
enableRenice = true;
|
|
};
|
|
|
|
# This fixes the "glXChooseVisual failed" bug, see:
|
|
# https://github.com/NixOS/nixpkgs/issues/47932.
|
|
hardware.graphics = {
|
|
enable = true;
|
|
enable32Bit = true;
|
|
};
|
|
|
|
environment.persistence
|
|
.${config.sydnix.impermanence.persistDirectory}.users =
|
|
builtins.listToAttrs
|
|
(builtins.map
|
|
(user: {
|
|
name = user;
|
|
value.directories = [".local/share/Steam"];
|
|
})
|
|
cfg.impermanenceUsers);
|
|
};
|
|
}
|