about summary refs log tree commit diff
path: root/modules/nixos/lidarr.nix
blob: f73f9176466e2dc4cdaef3d77662f74467c2586c (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
{
  config,
  lib,
  ...
}:
with lib; let
  cfg = config.nixfiles.modules.lidarr;
in {
  options.nixfiles.modules.lidarr = {
    enable = mkEnableOption "Lidarr";

    domain = mkOption {
      description = "Domain name sans protocol scheme.";
      type = with types; str;
      default = "lidarr.${config.networking.fqdn}";
    };
  };

  config = mkIf cfg.enable {
    nixfiles.modules.nginx = {
      enable = true;
      upstreams.lidarr.servers."127.0.0.1:8686" = {};
      virtualHosts.${cfg.domain}.locations."/".proxyPass = "http://lidarr";
    };

    services.lidarr.enable = true;
  };
}

Consider giving Nix/NixOS a try! <3