refactor(steam): port to home
This commit is contained in:
parent
4017da619a
commit
a7d23cfec2
|
@ -1,23 +0,0 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ... }: with lib; let
|
||||
cfg = config.faucet.steam;
|
||||
in {
|
||||
options.faucet.steam = {
|
||||
enable = mkEnableOption "steam software and environment";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
|
||||
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
|
||||
};
|
||||
|
||||
users.home.persist.directories = [
|
||||
".local/share/Steam"
|
||||
".steam"
|
||||
];
|
||||
};
|
||||
}
|
14
home/steam/config.nix
Normal file
14
home/steam/config.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ... }: with lib; let
|
||||
cfg = config.home.steam;
|
||||
in mkIf cfg.enable {
|
||||
hardware.steam-hardware.enable = true;
|
||||
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [ 27015 27036 ];
|
||||
allowedUDPPorts = [ 27015 ];
|
||||
allowedUDPPortRanges = [ { from = 27031; to = 27036; } ];
|
||||
};
|
||||
}
|
13
home/steam/home.nix
Normal file
13
home/steam/home.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ... }: with lib; let
|
||||
cfg = config.passthrough.steam;
|
||||
enable = cfg.enable && (cfg.allUsers || (config.home.username == "app"));
|
||||
package = config.programs.steam.package;
|
||||
in mkIf enable {
|
||||
home.packages = with pkgs; [
|
||||
cfg.package
|
||||
cfg.package.run
|
||||
];
|
||||
}
|
29
home/steam/nixos.nix
Normal file
29
home/steam/nixos.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ... }: with lib; let
|
||||
cfg = config.home.steam;
|
||||
persist = [ ".steam" ".local/share/Steam" ];
|
||||
in {
|
||||
imports = [ ./config.nix ];
|
||||
|
||||
options.home.steam = {
|
||||
enable = mkEnableOption "steam software and environment";
|
||||
package = mkOption {
|
||||
type = with types; package;
|
||||
default = config.programs.steam.package;
|
||||
description = "steam package";
|
||||
};
|
||||
allUsers = mkEnableOption "set up for all users";
|
||||
};
|
||||
|
||||
config = {
|
||||
users.homeModules = [
|
||||
# this module passes steam configuration to home-manager
|
||||
{ passthrough.steam = cfg; }
|
||||
];
|
||||
|
||||
users.home.persist.directories = with cfg; mkIf (enable && allUsers) persist;
|
||||
users.home.persistApp.directories = with cfg; mkIf (enable && !allUsers) persist;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue