From c6662575a085242fd216729ee3429a8b69f91f73 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sun, 27 Oct 2019 12:43:49 -0700 Subject: use a standard buildNixOS function --- com/influencedbybooks/service.nix | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 com/influencedbybooks/service.nix (limited to 'com/influencedbybooks') diff --git a/com/influencedbybooks/service.nix b/com/influencedbybooks/service.nix new file mode 100644 index 0000000..f9d0f36 --- /dev/null +++ b/com/influencedbybooks/service.nix @@ -0,0 +1,42 @@ +{ options +, lib +, config +, pkgs +, modulesPath +}: + +let + cfg = config.services.ibb; +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