1 { config, pkgs, lib, ... }:
6 cfg = config.services.lidarr;
11 enable = mkEnableOption (lib.mdDoc "Lidarr");
15 default = "/var/lib/lidarr/.config/Lidarr";
16 description = lib.mdDoc "The directory where Lidarr stores its data files.";
21 default = pkgs.lidarr;
22 defaultText = literalExpression "pkgs.lidarr";
23 description = lib.mdDoc "The Lidarr package to use";
26 openFirewall = mkOption {
29 description = lib.mdDoc ''
30 Open ports in the firewall for Lidarr
37 description = lib.mdDoc ''
38 User account under which Lidarr runs.
45 description = lib.mdDoc ''
46 Group under which Lidarr runs.
52 config = mkIf cfg.enable {
53 systemd.tmpfiles.rules = [
54 "d '${cfg.dataDir}' 0700 ${cfg.user} ${cfg.group} - -"
57 systemd.services.lidarr = {
58 description = "Lidarr";
59 after = [ "network.target" ];
60 wantedBy = [ "multi-user.target" ];
66 ExecStart = "${cfg.package}/bin/Lidarr -nobrowser -data='${cfg.dataDir}'";
67 Restart = "on-failure";
71 networking.firewall = mkIf cfg.openFirewall {
72 allowedTCPPorts = [ 8686 ];
75 users.users = mkIf (cfg.user == "lidarr") {
78 home = "/var/lib/lidarr";
79 uid = config.ids.uids.lidarr;
83 users.groups = mkIf (cfg.group == "lidarr") {
85 gid = config.ids.gids.lidarr;