From 3213902bb699f81ff5a10ffe8dcd07cd9ef35098 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Tue, 26 Dec 2023 22:08:57 +0100 Subject: [PATCH] Add alvr nixos module --- modules/nixos/alvr.nix | 34 ++++++++++++++++++++++++++++++++++ modules/nixos/default.nix | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 modules/nixos/alvr.nix diff --git a/modules/nixos/alvr.nix b/modules/nixos/alvr.nix new file mode 100644 index 0000000..334fce8 --- /dev/null +++ b/modules/nixos/alvr.nix @@ -0,0 +1,34 @@ +{ + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.programs.alvr; +in { + options = { + programs.alvr = { + enable = mkEnableOption (lib.mdDoc "ALVR"); + + package = mkPackageOption pkgs "alvr" {}; + + openFirewall = mkOption { + type = types.bool; + default = false; + description = lib.mdDoc '' + Open the default ports in the firewall for the ALVR server. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [cfg.package]; + + networking.firewall = mkIf cfg.openFirewall { + allowedTCPPorts = [9943 9944]; + allowedUDPPorts = [9943 9944]; + }; + }; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 8605069..402d229 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -2,5 +2,5 @@ # These should be stuff you would like to share with others, not your personal configurations. { # List your module files here - # my-module = import ./my-module.nix; + alvr = import ./alvr.nix; }