nixpkgs-suyu/nixos/modules/services/misc/lidarr.nix
David Wood 7e38a64709
nixos/lidarr: allow specifying package
This commit allows users of `services.lidarr` to specify the package
that is used with `services.lidarr.package`.
2019-06-24 09:53:38 +01:00

48 lines
987 B
Nix

{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.lidarr;
in
{
options = {
services.lidarr = {
enable = mkEnableOption "Lidarr";
package = mkOption {
type = types.package;
default = pkgs.lidarr;
defaultText = "pkgs.lidarr";
description = "The Lidarr package to use";
};
};
};
config = mkIf cfg.enable {
systemd.services.lidarr = {
description = "Lidarr";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
User = "lidarr";
Group = "lidarr";
ExecStart = "${cfg.package}/bin/Lidarr";
Restart = "on-failure";
StateDirectory = "lidarr";
StateDirectoryMode = "0770";
};
};
users.users.lidarr = {
uid = config.ids.uids.lidarr;
home = "/var/lib/lidarr";
group = "lidarr";
};
users.groups.lidarr.gid = config.ids.gids.lidarr;
};
}