nixos/services.readarr: remove with lib;
This commit is contained in:
parent
39d9937d05
commit
ba6e7e10bb
@ -1,41 +1,38 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.readarr;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.readarr = {
|
||||
enable = mkEnableOption "Readarr, a Usenet/BitTorrent ebook downloader";
|
||||
enable = lib.mkEnableOption "Readarr, a Usenet/BitTorrent ebook downloader";
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.str;
|
||||
dataDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "/var/lib/readarr/";
|
||||
description = "The directory where Readarr stores its data files.";
|
||||
};
|
||||
|
||||
package = mkPackageOption pkgs "readarr" { };
|
||||
package = lib.mkPackageOption pkgs "readarr" { };
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
openFirewall = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Open ports in the firewall for Readarr
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "readarr";
|
||||
description = ''
|
||||
User account under which Readarr runs.
|
||||
'';
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "readarr";
|
||||
description = ''
|
||||
Group under which Readarr runs.
|
||||
@ -44,7 +41,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.tmpfiles.settings."10-readarr".${cfg.dataDir}.d = {
|
||||
inherit (cfg) user group;
|
||||
mode = "0700";
|
||||
@ -64,11 +61,11 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall = mkIf cfg.openFirewall {
|
||||
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [ 8787 ];
|
||||
};
|
||||
|
||||
users.users = mkIf (cfg.user == "readarr") {
|
||||
users.users = lib.mkIf (cfg.user == "readarr") {
|
||||
readarr = {
|
||||
description = "Readarr service";
|
||||
home = cfg.dataDir;
|
||||
@ -77,7 +74,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
users.groups = mkIf (cfg.group == "readarr") {
|
||||
users.groups = lib.mkIf (cfg.group == "readarr") {
|
||||
readarr = { };
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user