nix-conf/system/modules/airplay.nix
2025-08-05 12:36:48 +08:00

49 lines
837 B
Nix

{
hostname ? null,
}:
{ pkgs, lib, ... }:
let
inherit (lib) optionalString;
in
{
networking.firewall = {
allowedTCPPorts = [
7000
7001
7100
];
allowedUDPPorts = [
5353
6000
6001
7011
];
};
environment.systemPackages = with pkgs; [
uxplay
];
systemd.user.services.uxplay = {
wantedBy = [ "multi-user.target" ];
after = [ "networking-online.target" ];
serviceConfig = {
ExecStart = "${pkgs.uxplay}/bin/uxplay ${
optionalString (hostname != null) "-n ${hostname} -nh -hls 3"
} -p";
};
};
services.avahi = {
enable = true;
openFirewall = true;
nssmdns4 = true;
publish = {
enable = true;
addresses = true;
workstation = true;
userServices = true;
domain = true;
};
};
}