From cf5b024e189cb4ed85f80b521cf9e0e5dc5b5070 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sat, 16 Feb 2019 20:51:58 -0800 Subject: Make port configurable --- ibb/module.nix | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) (limited to 'ibb/module.nix') diff --git a/ibb/module.nix b/ibb/module.nix index b4f7609..e2d4dd0 100644 --- a/ibb/module.nix +++ b/ibb/module.nix @@ -7,24 +7,35 @@ let cfg = config.services.ibb; -in { - options.services.ibb.enable = lib.mkEnableOption "Enable the IBB service"; - config = lib.mkIf cfg.enable { - systemd.services.ibb = { - path = with pkgs; [ ibb bash ]; - wantedBy = [ "multi-user.target" ]; - script = '' - ./bin/ibb - ''; - description = '' - Influenced By Books website - ''; - serviceConfig = { - WorkingDirectory=pkgs.ibb; - KillSignal="INT"; - Type = "simple"; - Restart = "on-abort"; - RestartSec = "10"; +in +{ + options.services.ibb = { + enable = lib.mkEnableOption "Enable the IBB service"; + port = lib.mkOption { + type = lib.types.string; + default = "3000"; + description = '' + The port on which IBB will listen for + incoming HTTP traffic. + ''; + }; + }; + config = lib.mkIf cfg.enable { + systemd.services.ibb = { + path = with pkgs; [ ibb bash ]; + wantedBy = [ "multi-user.target" ]; + script = '' + PORT=${cfg.port} ./bin/ibb + ''; + description = '' + Influenced By Books website + ''; + serviceConfig = { + WorkingDirectory=pkgs.ibb; + KillSignal="INT"; + Type = "simple"; + Restart = "on-abort"; + RestartSec = "10"; }; }; }; -- cgit v1.2.3