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

54 lines
1.1 KiB
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 = {
2023-07-02 20:56:42 +02:00
isNormalUser = false;
isSystemUser = 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" ];
2023-07-02 20:56:42 +02:00
group = "steam";
2023-07-05 20:43:59 +02:00
shell = pkgs.bashInteractive;
2019-10-24 02:20:38 +02:00
};
2023-07-02 20:56:42 +02:00
users.groups.steam = { };
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
'';
2019-10-24 02:20:38 +02:00
};
}