diff --git a/objectifier-module.nix b/objectifier-module.nix index 0f54046..dcc22cb 100644 --- a/objectifier-module.nix +++ b/objectifier-module.nix @@ -29,6 +29,12 @@ in { default = 3; }; + pool-size = mkOption { + type = int; + description = "Number of nets to initialize."; + default = 5; + }; + listen-addresses = mkOption { type = listOf str; description = @@ -36,18 +42,18 @@ in { default = [ "127.0.0.1" ]; }; - pool-size = mkOption { - type = int; - description = "Number of nets to initialize."; - default = 5; - }; - detection-timeout = mkOption { type = int; description = "Time in seconds to allow for detection to start."; default = 5; }; + hostname = mkOption { + type = nullOr str; + description = "Hostname on which to listen for requests."; + default = null; + }; + cleanup = { max_file_age = mkOption { type = int; @@ -65,6 +71,17 @@ in { }; config = mkIf cfg.enable { + services.nginx = mkIf (!isNull cfg.hostname) { + enable = true; + recommendedOptimisations = true; + recommendedProxySettings = true; + recommendedGzipSettings = true; + + virtualHosts."${cfg.hostname}" = { + locations."/".proxyPass = "http://127.0.0.1:${toString cfg.port}"; + }; + }; + systemd.services.objectifier = { after = [ "network-online.target" ]; wantedBy = [ "multi-user.target" ];