arrs
This commit is contained in:
1 parent
1fe4cbb045
commit
587c0d7b59
7 files changed
+144
-89
No files matched your search
@@ -21,7 +21,7 @@ in
|
|||||||
xclip
|
xclip
|
||||||
|
|
||||||
# socials
|
# socials
|
||||||
slack
|
#slack
|
||||||
zoom-us
|
zoom-us
|
||||||
betterdiscordctl
|
betterdiscordctl
|
||||||
discord
|
discord
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.skyg.server.arrs;
|
||||||
|
ifAdd = cond: add: if cond then [ add ] else [ ];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
services.postgresql = {
|
||||||
|
enable = true;
|
||||||
|
settings.port = cfg.database.port;
|
||||||
|
dataDir = cfg.database.dataDir;
|
||||||
|
ensureDatabases =
|
||||||
|
(ifAdd cfg.prowlarr cfg.prowlarr.user) ++
|
||||||
|
(ifAdd cfg.radarr cfg.radarr.user) ++
|
||||||
|
(ifAdd cfg.sonarr cfg.sonarr.user)
|
||||||
|
;
|
||||||
|
ensureUsers =
|
||||||
|
(ifAdd cfg.prowlarr cfg.prowlarr.user) ++
|
||||||
|
(ifAdd cfg.radarr cfg.radarr.user) ++
|
||||||
|
(ifAdd cfg.sonarr cfg.sonarr.user)
|
||||||
|
;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.skyg.server.arrs;
|
||||||
|
dbPort = 5432;
|
||||||
|
makeConfig = { port, name, uid, gid }: {
|
||||||
|
enable = lib.mkEnableOption "Enable ${name}";
|
||||||
|
|
||||||
|
package = lib.mkPackageOption pkgs name { };
|
||||||
|
|
||||||
|
dataDir = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "/var/lib/arrs/${name}";
|
||||||
|
description = "data directory for ${name}";
|
||||||
|
};
|
||||||
|
user = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = name;
|
||||||
|
};
|
||||||
|
group = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = name;
|
||||||
|
};
|
||||||
|
uid = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = uid;
|
||||||
|
};
|
||||||
|
gid = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = gid;
|
||||||
|
};
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = port;
|
||||||
|
description = "Port for ${name}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./db.nix
|
||||||
|
./prowlarr.nix
|
||||||
|
];
|
||||||
|
options = {
|
||||||
|
skyg.server.arrs = {
|
||||||
|
enable = lib.mkEnableOption
|
||||||
|
"Enable Arr Stack Store";
|
||||||
|
openFirewall = lib.mkEnableOption
|
||||||
|
"Open Firewall ports for services";
|
||||||
|
};
|
||||||
|
skyg.server.arrs.database = {
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = dbPort;
|
||||||
|
};
|
||||||
|
dataDir = lib.mkOption {
|
||||||
|
description = "Data folder for db";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "/var/lib/postgresql/arrs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
skyg.server.arrs.prowlarr = makeConfig {
|
||||||
|
name = "prowlarr";
|
||||||
|
port = 9096;
|
||||||
|
uid = 9000;
|
||||||
|
gid = 9000;
|
||||||
|
};
|
||||||
|
skyg.server.arrs.sonarr = makeConfig {
|
||||||
|
name = "sonarr";
|
||||||
|
port = 8989;
|
||||||
|
uid = 9001;
|
||||||
|
gid = 9001;
|
||||||
|
};
|
||||||
|
skyg.server.arrs.radarr = makeConfig {
|
||||||
|
name = "radarr";
|
||||||
|
port = 7878;
|
||||||
|
uid = 9002;
|
||||||
|
gid = 9002;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
networking.firewall.allowedUDPPorts = lib.mkIf cfg.openFirewall [
|
||||||
|
|
||||||
|
];
|
||||||
|
networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [
|
||||||
|
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.skyg.server.arrs.prowlarr;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd.services.prowlarr = {
|
||||||
|
description = "Prowlarr";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
User = cfg.user;
|
||||||
|
Group = cfg.group;
|
||||||
|
WorkingDirectory = cfg.dataDir;
|
||||||
|
Type = "simple";
|
||||||
|
DynamicUser = true;
|
||||||
|
StateDirectory = "prowlarr";
|
||||||
|
ExecStart = "${lib.getExe cfg.package} -nobrowser -data=${cfg.dataDir}";
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
environment.HOME = "/var/empty";
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||||
|
allowedTCPPorts = [ cfg.port ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{ config, lib, ... }:
|
|
||||||
let
|
|
||||||
cfg = config.skyg.server.db;
|
|
||||||
dbPort = 5432;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
skyg.server.db = {
|
|
||||||
enable = lib.mkEnableOption
|
|
||||||
"Enable DB Store";
|
|
||||||
openFirewall = lib.mkEnableOption
|
|
||||||
"Open Firewall ports for db port";lib.mkIf cfg.openFirewall
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
networking.firewall.allowedUDPPorts = lib.mkIf cfg.openFirewall [ dbPort ];
|
|
||||||
networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [ dbPort ];
|
|
||||||
services.postgresql = {
|
|
||||||
enable = true;
|
|
||||||
settings.port = dbPort;
|
|
||||||
dataDir = "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -7,6 +7,6 @@
|
|||||||
./ai-services.nix
|
./ai-services.nix
|
||||||
./jellyfin.nix
|
./jellyfin.nix
|
||||||
./admin.nix
|
./admin.nix
|
||||||
./prowlarr.nix
|
./arrs
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.skg.nixos.server.services.prowlarr;
|
|
||||||
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
skg.nixos.server.services.prowlarr = {
|
|
||||||
enable = lib.mkEnableOption "Prowlarr, an indexer manager/proxy for Torrent trackers and Usenet indexers";
|
|
||||||
|
|
||||||
package = lib.mkPackageOption pkgs "prowlarr" { };
|
|
||||||
|
|
||||||
openFirewall = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
default = false;
|
|
||||||
description = "Open ports in the firewall for the Prowlarr web interface.";
|
|
||||||
};
|
|
||||||
dataDir = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "/var/lib/prowlarr";
|
|
||||||
description = "data directory for prowlarr";
|
|
||||||
};
|
|
||||||
user = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "prowlarr";
|
|
||||||
};
|
|
||||||
group = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "prowlarr";
|
|
||||||
};
|
|
||||||
port = lib.mkOption {
|
|
||||||
type = lib.types.int;
|
|
||||||
default = 9096;
|
|
||||||
description = "Port for prowlarr";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
systemd.services.prowlarr = {
|
|
||||||
description = "Prowlarr";
|
|
||||||
after = [ "network.target" ];
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
|
|
||||||
serviceConfig = {
|
|
||||||
User = cfg.user;
|
|
||||||
Group = cfg.group;
|
|
||||||
WorkingDirectory = cfg.dataDir;
|
|
||||||
Type = "simple";
|
|
||||||
DynamicUser = true;
|
|
||||||
StateDirectory = "prowlarr";
|
|
||||||
ExecStart = "${lib.getExe cfg.package} -nobrowser -data=${cfg.dataDir}";
|
|
||||||
Restart = "on-failure";
|
|
||||||
};
|
|
||||||
environment.HOME = "/var/empty";
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.firewall = lib.mkIf cfg.openFirewall {
|
|
||||||
allowedTCPPorts = [ cfg.port ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user