After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build a08b3a4d19.tar.gz \
--argstr baseRev 78e9caf153f5a339bf1d4c000ff6f0a503a369c8
result/bin/apply-formatting $NIXPKGS_PATH
87 lines
1.9 KiB
Nix
87 lines
1.9 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.services.readarr;
|
|
in
|
|
{
|
|
options = {
|
|
services.readarr = {
|
|
enable = lib.mkEnableOption "Readarr, a Usenet/BitTorrent ebook downloader";
|
|
|
|
dataDir = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "/var/lib/readarr/";
|
|
description = "The directory where Readarr stores its data files.";
|
|
};
|
|
|
|
package = lib.mkPackageOption pkgs "readarr" { };
|
|
|
|
openFirewall = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = ''
|
|
Open ports in the firewall for Readarr
|
|
'';
|
|
};
|
|
|
|
user = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "readarr";
|
|
description = ''
|
|
User account under which Readarr runs.
|
|
'';
|
|
};
|
|
|
|
group = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "readarr";
|
|
description = ''
|
|
Group under which Readarr runs.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
systemd.tmpfiles.settings."10-readarr".${cfg.dataDir}.d = {
|
|
inherit (cfg) user group;
|
|
mode = "0700";
|
|
};
|
|
|
|
systemd.services.readarr = {
|
|
description = "Readarr";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
User = cfg.user;
|
|
Group = cfg.group;
|
|
ExecStart = "${cfg.package}/bin/Readarr -nobrowser -data='${cfg.dataDir}'";
|
|
Restart = "on-failure";
|
|
};
|
|
};
|
|
|
|
networking.firewall = lib.mkIf cfg.openFirewall {
|
|
allowedTCPPorts = [ 8787 ];
|
|
};
|
|
|
|
users.users = lib.mkIf (cfg.user == "readarr") {
|
|
readarr = {
|
|
description = "Readarr service";
|
|
home = cfg.dataDir;
|
|
group = cfg.group;
|
|
isSystemUser = true;
|
|
};
|
|
};
|
|
|
|
users.groups = lib.mkIf (cfg.group == "readarr") {
|
|
readarr = { };
|
|
};
|
|
};
|
|
}
|