mirror of
https://github.com/nmasur/dotfiles
synced 2024-12-25 17:04:54 +00:00
audiobookshelf
This commit is contained in:
parent
5f71437e57
commit
120b97f970
@ -235,6 +235,7 @@
|
||||
mail.smtpHost = "smtp.purelymail.com";
|
||||
dotfilesRepo = "https://github.com/nmasur/dotfiles";
|
||||
hostnames = {
|
||||
audiobooks = "read.${baseName}";
|
||||
files = "files.${baseName}";
|
||||
git = "git.${baseName}";
|
||||
influxdb = "influxdb.${baseName}";
|
||||
|
@ -67,6 +67,14 @@ inputs.nixpkgs.lib.nixosSystem rec {
|
||||
devices = (import ../../disks/root.nix { disk = "/dev/nvme0n1"; });
|
||||
};
|
||||
|
||||
zramSwap.enable = true;
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/swapfile";
|
||||
size = 4 * 1024; # 4 GB
|
||||
}
|
||||
];
|
||||
|
||||
boot.zfs = {
|
||||
# Automatically load the ZFS pool on boot
|
||||
extraPools = [ "tank" ];
|
||||
@ -98,6 +106,7 @@ inputs.nixpkgs.lib.nixosSystem rec {
|
||||
dotfiles.enable = true;
|
||||
arrs.enable = true;
|
||||
filebrowser.enable = true;
|
||||
services.audiobookshelf.enable = true;
|
||||
services.bind.enable = true;
|
||||
services.caddy.enable = true;
|
||||
services.jellyfin.enable = true;
|
||||
|
@ -14,6 +14,11 @@ let
|
||||
url = "localhost:7878";
|
||||
apiKey = config.secrets.radarrApiKey.dest;
|
||||
};
|
||||
readarr = {
|
||||
exportarrPort = "9711";
|
||||
url = "localhost:8787";
|
||||
apiKey = config.secrets.readarrApiKey.dest;
|
||||
};
|
||||
sonarr = {
|
||||
exportarrPort = "9708";
|
||||
url = "localhost:8989";
|
||||
@ -61,6 +66,10 @@ in
|
||||
enable = true;
|
||||
group = "media";
|
||||
};
|
||||
readarr = {
|
||||
enable = true;
|
||||
group = "media";
|
||||
};
|
||||
};
|
||||
|
||||
# Create a media group to be shared between services
|
||||
@ -110,6 +119,21 @@ in
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
group = "download";
|
||||
match = [
|
||||
{
|
||||
host = [ config.hostnames.download ];
|
||||
path = [ "/readarr*" ];
|
||||
}
|
||||
];
|
||||
handle = [
|
||||
{
|
||||
handler = "reverse_proxy";
|
||||
upstreams = [ { dial = arrConfig.readarr.url; } ];
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
group = "download";
|
||||
match = [
|
||||
@ -223,6 +247,11 @@ in
|
||||
dest = "/var/private/radarr-api";
|
||||
prefix = "API_KEY=";
|
||||
};
|
||||
secrets.readarrApiKey = {
|
||||
source = ../../../private/radarr-api-key.age;
|
||||
dest = "/var/private/readarr-api";
|
||||
prefix = "API_KEY=";
|
||||
};
|
||||
secrets.sonarrApiKey = {
|
||||
source = ../../../private/sonarr-api-key.age;
|
||||
dest = "/var/private/sonarr-api";
|
||||
|
44
modules/nixos/services/audiobookshelf.nix
Normal file
44
modules/nixos/services/audiobookshelf.nix
Normal file
@ -0,0 +1,44 @@
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
|
||||
options = {
|
||||
hostnames.audiobooks = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Hostname for audiobook server (Audiobookshelf).";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.services.audiobookshelf.enable {
|
||||
|
||||
services.audiobookshelf = {
|
||||
dataDir = "audiobookshelf";
|
||||
};
|
||||
|
||||
# Allow web traffic to Caddy
|
||||
caddy.routes = [
|
||||
{
|
||||
match = [ { host = [ config.hostnames.audiobooks ]; } ];
|
||||
handle = [
|
||||
{
|
||||
handler = "reverse_proxy";
|
||||
upstreams = [ { dial = "localhost:${builtins.toString config.services.audiobookshelf.port}"; } ];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
# Configure Cloudflare DNS to point to this machine
|
||||
services.cloudflare-dyndns.domains = [ config.hostnames.audiobooks ];
|
||||
|
||||
# Grant user access to Audiobookshelf directories
|
||||
users.users.${config.user}.extraGroups = [ config.services.audiobookshelf.group ];
|
||||
|
||||
# Grant audiobookshelf access to media and Calibre directories
|
||||
users.users.${config.services.audiobookshelf.user}.extraGroups = [
|
||||
"media"
|
||||
"calibre-web"
|
||||
];
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
{
|
||||
|
||||
imports = [
|
||||
./audiobookshelf.nix
|
||||
./arr.nix
|
||||
./backups.nix
|
||||
./bind.nix
|
||||
|
@ -53,6 +53,7 @@ in
|
||||
uid = promUid;
|
||||
}
|
||||
];
|
||||
# TODO: Add option to pull services from a list like Caddy does
|
||||
dashboards.settings.providers = [
|
||||
{
|
||||
name = "test";
|
||||
@ -368,6 +369,18 @@ in
|
||||
range = true;
|
||||
refId = "C";
|
||||
}
|
||||
{
|
||||
datasource = {
|
||||
type = "prometheus";
|
||||
uid = promUid;
|
||||
};
|
||||
editorMode = "code";
|
||||
expr = "readarr_system_status";
|
||||
hide = false;
|
||||
legendFormat = "Readarr";
|
||||
range = true;
|
||||
refId = "F";
|
||||
}
|
||||
{
|
||||
datasource = {
|
||||
type = "prometheus";
|
||||
@ -819,6 +832,28 @@ in
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
matcher = {
|
||||
id = "byName";
|
||||
options = "localhost:8787";
|
||||
};
|
||||
properties = [
|
||||
{
|
||||
id = "displayName";
|
||||
value = "Readarr";
|
||||
}
|
||||
{
|
||||
id = "links";
|
||||
value = [
|
||||
{
|
||||
targetBlank = true;
|
||||
title = "";
|
||||
url = "https://${config.hostnames.download}/readarr";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
matcher = {
|
||||
id = "byName";
|
||||
@ -1105,6 +1140,28 @@ in
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
matcher = {
|
||||
id = "byName";
|
||||
options = "localhost:${builtins.toString config.services.audiobookshelf.port}";
|
||||
};
|
||||
properties = [
|
||||
{
|
||||
id = "displayName";
|
||||
value = "Audiobookshelf";
|
||||
}
|
||||
{
|
||||
id = "links";
|
||||
value = [
|
||||
{
|
||||
targetBlank = true;
|
||||
title = "";
|
||||
url = "https://${config.hostnames.audiobooks}";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
gridPos = {
|
||||
|
Loading…
Reference in New Issue
Block a user