nixos-config/nixos/modules/programs/steam.nix
2021-11-01 09:20:42 +01:00

48 lines
955 B
Nix

{ 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;
in
{
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;
home = "/home/steam";
createHome = true;
extraGroups = [ "audio" "input" "video" ];
};
# for steam
# ---------
hardware.opengl.driSupport = true;
hardware.opengl.driSupport32Bit = true;
security.sudo.extraConfig = ''
${config.users.extraUsers.mainUser.name} ALL=(steam) NOPASSWD: ALL
'';
};
}