nixos-conf/modules/services/gaming-server.nix

99 lines
2.2 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.custom.services.gamingServer;
in
{
options.custom.services.gamingServer.enable = lib.mkOption {
type = lib.types.bool;
default = false;
};
config = lib.mkIf cfg.enable {
systemd.tmpfiles.settings."vili-home" = {
"/home/vili".d = {
user = "vili";
group = "users";
mode = "0700";
};
"/home/vili/.local".d = {
user = "vili";
group = "users";
mode = "0755";
};
"/home/vili/.local/share".d = {
user = "vili";
group = "users";
mode = "0755";
};
};
environment.persistence."/persist" = {
users.vili = {
directories = [
{
directory = ".cache";
mode = "u=rwx,g=rx,o=rx";
}
{
directory = ".local/share/feral-interactive";
mode = "u=rwx,g=rx,o=rx";
}
".local/share/Steam"
{
directory = ".local/share/vulkan";
mode = "u=rwx,g=rx,o=rx";
}
];
};
};
sops.secrets = {
sunshine-state = {
sopsFile = ../../secrets/gaming.yaml;
owner = config.users.users."vili".name;
};
sunshine-cakey = {
sopsFile = ../../secrets/gaming.yaml;
owner = config.users.users."vili".name;
};
sunshine-cacert = {
sopsFile = ../../secrets/gaming.yaml;
owner = config.users.users."vili".name;
};
};
programs.steam = {
enable = true;
extraCompatPackages = with pkgs; [ proton-ge-bin ];
};
services.sunshine = {
enable = true;
autoStart = true;
openFirewall = true;
settings = {
sunshine_name = "NixOS";
address_family = "both";
credentials_file = config.sops.secrets.sunshine-state.path;
pkey = config.sops.secrets.sunshine-cakey.path;
cert = config.sops.secrets.sunshine-cacert.path;
file_state = config.sops.secrets.sunshine-state.path;
};
applications = {
env = {
PATH = "$(PATH):$(HOME)/.local/bin";
};
apps = [
{
name = "Desktop";
image-path = "desktop.png";
}
];
};
};
};
}