aboutsummaryrefslogtreecommitdiff
path: root/services/lazylibrarian/default.nix
blob: 45147130c23887cd3df68fc39d873d733d9a21d6 (plain) (blame)
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
{ config, pkgs, lib, ... }:
with lib;
let
  lazylibrarian = pkgs.callPackage ./package.nix {};
  cfg = config.services.lazylibrarian;
in
{
  options.services.lazylibrarian = {
    enable = mkEnableOption "lazy librarian";
    # port = mkOption { type = types.int; default = 53; };
    # hosts = mkOption { type = types.attrsOf types.str; default = {}; };
  };

  environment.systemPackages = [lazylibrarian];

  config.systemd.services.lazylibrarian = mkIf cfg.enable {
    description = "Lazylibrarian";
    after = [ "network.service" ];
    wantedBy = [ "multi-user.target" ];

    serviceConfig = {
      ExecStart = "${lazylibrarian}/bin/lazylibrarian";
      Restart = "on-failure";
      RestartSec = 3;
      TimeoutSec = "5min";
      IgnoreSIGPIPE = "no";
      KillMode = "process";
      GuessMainPID = "no";
      RemainAfterExit = "yes";
    };
  };
}