32 lines
715 B
Nix
32 lines
715 B
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.schmittlauch.audio-sharing;
|
|
fwPort = 8554;
|
|
in
|
|
{
|
|
options.schmittlauch.audio-sharing = {
|
|
enable = lib.mkEnableOption "enable Gnome audio-sharing application via rtsp";
|
|
openFirewall = lib.mkOption {
|
|
default = true;
|
|
type = lib.types.bool;
|
|
description = "Opens the port ${toString fwPort} to allow access to the rtsp stream";
|
|
};
|
|
};
|
|
config = lib.mkMerge [
|
|
(lib.mkIf cfg.enable {
|
|
environment.systemPackages = [ pkgs.audio-sharing ];
|
|
})
|
|
(lib.mkIf (cfg.enable && cfg.openFirewall) {
|
|
networking.firewall = {
|
|
allowedUDPPorts = [ fwPort ];
|
|
allowedTCPPorts = [ fwPort ];
|
|
};
|
|
})
|
|
];
|
|
|
|
}
|