From a6fcd247b763884ef9ae84d7a5ef605cfc551290 Mon Sep 17 00:00:00 2001 From: derped Date: Wed, 20 Nov 2024 21:23:36 +0100 Subject: [PATCH] Add uxplay service. --- machines/Sheol/configuration.nix | 14 -------------- machines/Sheol/options.nix | 1 + services/uxplay.nix | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 services/uxplay.nix diff --git a/machines/Sheol/configuration.nix b/machines/Sheol/configuration.nix index 47991b3..9deacfd 100644 --- a/machines/Sheol/configuration.nix +++ b/machines/Sheol/configuration.nix @@ -12,20 +12,6 @@ }; cron.enable = false; }; - # udp5353 1024-65535 - - networking.firewall = - let - range = { - from = 1024; - to = 65535; - }; - in - { - allowedUDPPorts = [ 5353 ]; - allowedUDPPortRanges = [ range ]; - allowedTCPPortRanges = [ range ]; - }; networking.dhcpcd.extraConfig = "noarp"; system.stateVersion = "24.05"; } diff --git a/machines/Sheol/options.nix b/machines/Sheol/options.nix index 057c6e4..5c56b76 100644 --- a/machines/Sheol/options.nix +++ b/machines/Sheol/options.nix @@ -31,6 +31,7 @@ "mullvad" "openssh" "pipewire" + "uxplay" ]; firewall = { enable = true; diff --git a/services/uxplay.nix b/services/uxplay.nix new file mode 100644 index 0000000..b7df1e2 --- /dev/null +++ b/services/uxplay.nix @@ -0,0 +1,32 @@ +{ + pkgs, + lib, + config, + ... +}: + +lib.mkIf (lib.elem "uxplay" config.machine.services) { + systemd.user.services.uxplay = { + enable = true; + wantedBy = [ "graphical-session.target" ]; + description = "Uxplay is a GPLv3 open source unix AirPlay2 Mirror server for Linux, macOS, and *BSD."; + serviceConfig = { + Type = "simple"; + ConditionEnvironment = "WAYLAND_DISPLAY"; + # Currently only running on my raspberry pi (remove -bt709 for use on other machines) + ExecStart = ''${pkgs.uxplay}/bin/uxplay -bt709''; + }; + }; + networking.firewall = + let + range = { + from = 1024; + to = 65535; + }; + in + { + allowedUDPPorts = [ 5353 ]; + allowedUDPPortRanges = [ range ]; + allowedTCPPortRanges = [ range ]; + }; +}