feat(koi): uxplay server
This commit is contained in:
parent
9ec641fb19
commit
1b165364de
6 changed files with 93 additions and 2 deletions
|
@ -16,6 +16,7 @@
|
|||
./services/coredns.nix
|
||||
./services/nginx.nix
|
||||
|
||||
./containers/uxplay.nix
|
||||
./containers/torrent.nix
|
||||
./containers/puffer.nix
|
||||
./containers/sharkey
|
||||
|
|
|
@ -143,6 +143,10 @@ let
|
|||
sftpgoConfig
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
uxplay
|
||||
];
|
||||
|
||||
users.groups.puffer = { };
|
||||
users.users.smb-guest = {
|
||||
isNormalUser = true;
|
||||
|
@ -157,7 +161,8 @@ let
|
|||
"d /mnt/puffer/Backups 0755 smb-guest puffer - -"
|
||||
];
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 22 ];
|
||||
networking.firewall.allowedTCPPorts = [ 22 7000 7001 7002 ];
|
||||
networking.firewall.allowedUDPPorts = [ 22 7000 7001 7002 ];
|
||||
};
|
||||
|
||||
mounts = {
|
||||
|
|
47
hosts/koi/containers/uxplay.nix
Normal file
47
hosts/koi/containers/uxplay.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{ abs, lib, pkgs, config, ... }@inputs:
|
||||
let
|
||||
containers = import (abs "lib/containers.nix") inputs;
|
||||
uxplay = import (abs "services/uxplay.nix") inputs;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(containers.mkNixosContainer {
|
||||
name = "uxplay";
|
||||
ip = "10.42.0.6";
|
||||
private = false;
|
||||
|
||||
config = { ... }: {
|
||||
imports = [
|
||||
(uxplay {
|
||||
params = [
|
||||
"-p 7000"
|
||||
"-vs 0"
|
||||
"-async"
|
||||
"-n koi -nh"
|
||||
];
|
||||
withAvahi = true;
|
||||
})
|
||||
];
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 7000 7001 7002 ];
|
||||
networking.firewall.allowedUDPPorts = [ 7000 7001 7002 ];
|
||||
services.avahi.openFirewall = true;
|
||||
};
|
||||
|
||||
containerConfig.extraFlags = [
|
||||
"--bind=/run/pipewire"
|
||||
"--bind=/dev/snd"
|
||||
"--bind=/dev/shm"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
systemWide = true;
|
||||
};
|
||||
}
|
|
@ -55,4 +55,5 @@ in
|
|||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
hardware.firmware = [ pkgs.alsa-firmware ];
|
||||
}
|
||||
|
|
37
services/uxplay.nix
Executable file
37
services/uxplay.nix
Executable file
|
@ -0,0 +1,37 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
# UXPlay parameters
|
||||
params ? [ ]
|
||||
# Whether to also set up avahi daemon
|
||||
, withAvahi ? false
|
||||
, # Name of the systemd service
|
||||
serviceName ? "uxplay"
|
||||
, # UXPlay package
|
||||
package ? pkgs.uxplay
|
||||
, serviceConfig ? { }
|
||||
}:
|
||||
let
|
||||
paramsJoined = builtins.concatStringsSep " " params;
|
||||
in
|
||||
{
|
||||
systemd.services.${serviceName} = {
|
||||
description = "${serviceName} Daemon";
|
||||
after = [ "network.target" ] ++ lib.optionals withAvahi [ "avahi-daemon.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.PrivateTmp = true;
|
||||
script = ''
|
||||
sleep 5 # idk needed for some reason
|
||||
exec ${package}/bin/uxplay ${paramsJoined}
|
||||
'';
|
||||
} // serviceConfig;
|
||||
} // lib.optionalAttrs withAvahi {
|
||||
services.avahi = {
|
||||
enable = true;
|
||||
nssmdns4 = true;
|
||||
publish = {
|
||||
enable = true;
|
||||
userServices = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
{
|
||||
users.users.teidesu = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" "kvm" "docker" ];
|
||||
extraGroups = [ "wheel" "kvm" "docker" "pipewire" ];
|
||||
shell = pkgs.zsh;
|
||||
|
||||
openssh.authorizedKeys.keyFiles = [
|
||||
|
|
Loading…
Reference in a new issue