steam: integrate into sane.programs, and enable for lappy

This commit is contained in:
Colin 2023-04-23 23:21:08 +00:00
parent 09a1d286d0
commit e7f02c057e
2 changed files with 27 additions and 4 deletions

View File

@ -1,8 +1,8 @@
{ lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
inherit (builtins) attrNames concatLists; inherit (builtins) attrNames concatLists;
inherit (lib) mapAttrs mapAttrsToList mkDefault mkMerge optional; inherit (lib) mapAttrs mapAttrsToList mkDefault mkIf mkMerge optional;
flattenedPkgs = pkgs // (with pkgs; { flattenedPkgs = pkgs // (with pkgs; {
# XXX can't `inherit` a nested attr, so we move them to the toplevel # XXX can't `inherit` a nested attr, so we move them to the toplevel
@ -218,6 +218,7 @@ let
mumble mumble
obsidian obsidian
slic3r slic3r
steam
; ;
}; };
x86GuiPkgs = { x86GuiPkgs = {
@ -361,6 +362,11 @@ in
# creds, widevine .so download. TODO: could easily manage these statically. # creds, widevine .so download. TODO: could easily manage these statically.
spotify.dir = [ ".config/spotify" ]; spotify.dir = [ ".config/spotify" ];
steam.dir = [
".steam"
".local/share/Steam"
];
# sublime music persists any downloaded albums here. # sublime music persists any downloaded albums here.
# it doesn't obey a conventional ~/Music/{Artist}/{Album}/{Track} notation, so no symlinking # it doesn't obey a conventional ~/Music/{Artist}/{Album}/{Track} notation, so no symlinking
# config (e.g. server connection details) is persisted in ~/.config/sublime-music/config.json # config (e.g. server connection details) is persisted in ~/.config/sublime-music/config.json
@ -392,5 +398,13 @@ in
# XXX: this might not be necessary. try removing this and cacert.unbundled (servo)? # XXX: this might not be necessary. try removing this and cacert.unbundled (servo)?
environment.etc."ssl/certs".source = "${pkgs.cacert.unbundled}/etc/ssl/certs/*"; environment.etc."ssl/certs".source = "${pkgs.cacert.unbundled}/etc/ssl/certs/*";
# steam requires system-level config for e.g. firewall or controller support
programs.steam = mkIf config.sane.programs.steam.enabled {
enable = true;
# not sure if needed: stole this whole snippet from the wiki
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
};
}; };
} }

View File

@ -1,6 +1,6 @@
{ config, lib, pkgs, sane-lib, ... }: { config, lib, pkgs, sane-lib, ... }:
let let
inherit (builtins) any elem map; inherit (builtins) any attrValues elem map;
inherit (lib) inherit (lib)
filterAttrs filterAttrs
hasAttrByPath hasAttrByPath
@ -18,7 +18,7 @@ let
; ;
inherit (sane-lib) joinAttrsets; inherit (sane-lib) joinAttrsets;
cfg = config.sane.programs; cfg = config.sane.programs;
pkgSpec = types.submodule ({ name, ... }: { pkgSpec = types.submodule ({ config, name, ... }: {
options = { options = {
package = mkOption { package = mkOption {
type = types.nullOr types.package; type = types.nullOr types.package;
@ -59,6 +59,12 @@ let
place this program on the PATH for some specified user(s). place this program on the PATH for some specified user(s).
''; '';
}; };
enabled = mkOption {
type = types.bool;
description = ''
generated (i.e. read-only) value indicating if the program is enabled either for any user or for the system.
'';
};
suggestedPrograms = mkOption { suggestedPrograms = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
@ -83,6 +89,9 @@ let
}; };
}; };
config = {
enabled = config.enableFor.system || any (en: en) (attrValues config.enableFor.user);
};
}); });
toPkgSpec = types.coercedTo types.package (p: { package = p; }) pkgSpec; toPkgSpec = types.coercedTo types.package (p: { package = p; }) pkgSpec;