nixos-config/nixos/modules/programs/steam.nix

49 lines
966 B
Nix
Raw Normal View History

2019-10-24 02:20:38 +02:00
{ config, lib, pkgs, ... }:
with lib;
# steam
# -------
# Don't forget to run 'xhost +' with your user
# to make sure the browser user can write to X
let
bin = pkgs.writeShellScriptBin "steam" ''
/var/run/wrappers/bin/sudo -u steam -i ${pkgs.steam}/bin/steam $@
'';
cfg = config.programs.custom.steam;
2021-11-01 09:20:42 +01:00
in
{
2019-10-24 02:20:38 +02:00
options.programs.custom.steam.enable = mkEnableOption "enable steam";
config = mkIf cfg.enable {
environment.systemPackages = [
bin
pkgs.xorg.xhost
# to use xbox controllers
pkgs.xboxdrv
];
users.users.steam = {
isNormalUser = true;
2019-12-20 05:54:26 +01:00
home = "/home/steam";
createHome = true;
2022-04-17 20:16:40 +02:00
extraGroups = [ "audio" "input" "video" "pipewire" ];
2019-10-24 02:20:38 +02:00
};
# for steam
# ---------
hardware.opengl.driSupport = true;
2019-10-24 02:20:38 +02:00
hardware.opengl.driSupport32Bit = true;
security.sudo.extraConfig = ''
${config.users.extraUsers.mainUser.name} ALL=(steam) NOPASSWD: ALL
'';
};
}