about summary refs log tree commit diff
path: root/nixos/modules/programs/envision.nix
blob: 56acd83d7daf8a9c4ad1c1288fd4450f777ce1a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
  config,
  lib,
  pkgs,
  ...
}:

let
  cfg = config.programs.envision;
in
{

  options = {
    programs.envision = {
      enable = lib.mkEnableOption "envision";

      package = lib.mkPackageOption pkgs "envision" {};

      openFirewall = lib.mkEnableOption "the default ports in the firewall for the WiVRn server" // {
        default = true;
      };
    };
  };

  config = lib.mkIf cfg.enable {
    services.avahi = {
      enable = true;
      publish = {
        enable = true;
        userServices = true;
      };
    };

    services.udev = {
      enable = true;
      packages = with pkgs; [
        android-udev-rules
        xr-hardware
      ];
    };

    environment.systemPackages = [ cfg.package ];

    networking.firewall = lib.mkIf cfg.openFirewall {
      allowedTCPPorts = [ 9757 ];
      allowedUDPPorts = [ 9757 ];
    };
  };

  meta.maintainers = pkgs.envision.meta.maintainers;
}