Commit 454883d8 authored by Gavin John's avatar Gavin John Committed by Gavin John
Browse files

nixos/envision: init module

parent b9d22518
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@
  ./programs/dublin-traceroute.nix
  ./programs/ecryptfs.nix
  ./programs/environment.nix
  ./programs/envision.nix
  ./programs/evince.nix
  ./programs/extra-container.nix
  ./programs/fcast-receiver.nix
+43 −0
Original line number Diff line number Diff line
{
  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;
      };
    };

    environment.systemPackages = [ cfg.package ];

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

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