summaryrefslogtreecommitdiff
path: root/com/influencedbybooks.nix
blob: f9d0f364d3f33dadabbc6e4e0f70af48d98ac7c5 (plain)
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
{ 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";
      };
    };
  };
}