diff --git a/common/audio-sharing.nix b/common/audio-sharing.nix new file mode 100644 index 0000000..8d15584 --- /dev/null +++ b/common/audio-sharing.nix @@ -0,0 +1,32 @@ +{ + 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 ]; + }; + }) + ]; + +} diff --git a/common/default.nix b/common/default.nix index 73d5200..26bc5c4 100644 --- a/common/default.nix +++ b/common/default.nix @@ -16,6 +16,7 @@ in ./nix-settings.nix ./upgrade-diff.nix ./guest.nix + ./audio-sharing.nix ]; services.davfs2.enable = true; diff --git a/hosts/framenix/default.nix b/hosts/framenix/default.nix index 42740ef..aba91d0 100644 --- a/hosts/framenix/default.nix +++ b/hosts/framenix/default.nix @@ -83,4 +83,6 @@ in pkgs.framework-tool unstable.amd-debug-tools ]; + + schmittlauch.audio-sharing.enable = true; }