{ 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 ]; }; }