Compare commits

..

7 Commits

Author SHA1 Message Date
Alexander Heldt
7d6785f27e manatee: Remove calibre-web module 2026-03-07 12:10:30 +00:00
Alexander Heldt
f446706a9c manatee: nixfmt 2026-03-07 12:08:01 +00:00
Alexander Heldt
6ea5db6d37 manatee: Add komga-bookmanager service 2026-03-07 12:07:05 +00:00
Alexander Heldt
e46b5689a2 Add komga-bookmanager input 2026-03-07 12:05:41 +00:00
Alexander Heldt
8fa60a1b06 Update komga-comictracker input 2026-03-07 12:05:07 +00:00
Alexander Heldt
4f5de3b4cc manatee: Expose komga publicly via komga.ppp.pm 2026-03-02 21:41:41 +01:00
Alexander Heldt
65569f6b57 manatee: Add services homepage with auto-discovery
Add a homepage module that generates a static landing page served on
port 9999 via nginx. Each service module registers itself via the shared
mod.homepage.services option, so enabling a module automatically adds
it to the page.
2026-02-28 22:03:12 +01:00
16 changed files with 181 additions and 112 deletions

30
flake.lock generated
View File

@@ -573,6 +573,27 @@
"type": "github" "type": "github"
} }
}, },
"komga-bookmanager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1772572455,
"narHash": "sha256-B4KOdV2GQogU1XL9903qFkOFf/6H7UGa+dprNGctgMY=",
"ref": "main",
"rev": "002732d4ebc5b80c2b8522896427c9f6bee9e1d1",
"revCount": 6,
"type": "git",
"url": "ssh://gitea@git.ppp.pm:1122/alex/komga-bookmanager.git"
},
"original": {
"ref": "main",
"type": "git",
"url": "ssh://gitea@git.ppp.pm:1122/alex/komga-bookmanager.git"
}
},
"komga-comictracker": { "komga-comictracker": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -580,11 +601,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1771079752, "lastModified": 1772884418,
"narHash": "sha256-4Pw8MhQUVWcTH3fg31sP19k+qgHDxqSKtSoDU/CYf/Y=", "narHash": "sha256-2V/JnGsIhvQoAiH7iIQkOPX5OTZVwGTOEv+nFetd4I8=",
"ref": "main", "ref": "main",
"rev": "2b5cc59e3d4dba439a9a5f0d1fc2c30d9bdf45e1", "rev": "0b91385e8906ca40cc89381bf8394ed24a116c6b",
"revCount": 32, "revCount": 49,
"type": "git", "type": "git",
"url": "ssh://gitea@git.ppp.pm:1122/alex/komga-comictracker.git" "url": "ssh://gitea@git.ppp.pm:1122/alex/komga-comictracker.git"
}, },
@@ -786,6 +807,7 @@
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"hyprland": "hyprland", "hyprland": "hyprland",
"hyprland-contrib": "hyprland-contrib", "hyprland-contrib": "hyprland-contrib",
"komga-bookmanager": "komga-bookmanager",
"komga-comictracker": "komga-comictracker", "komga-comictracker": "komga-comictracker",
"naviterm": "naviterm", "naviterm": "naviterm",
"nh": "nh", "nh": "nh",

View File

@@ -74,6 +74,12 @@
# url = "path:/home/alex/code/own/komga-comictracker"; # url = "path:/home/alex/code/own/komga-comictracker";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
komga-bookmanager = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/komga-bookmanager.git?ref=main";
# url = "path:/home/alex/code/own/komga-comictracker";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =

View File

@@ -10,11 +10,13 @@ in
}; };
config = lib.mkIf enabled { config = lib.mkIf enabled {
mod.homepage.services = [{ mod.homepage.services = [
{
name = "Audiobookshelf"; name = "Audiobookshelf";
port = 8000; port = 8000;
description = "Audiobooks & podcasts"; description = "Audiobooks & podcasts";
}]; }
];
users.users.audiobookshelf = { users.users.audiobookshelf = {
isSystemUser = true; isSystemUser = true;

View File

@@ -1,40 +0,0 @@
{ lib, config, ... }:
let
enabled = config.mod.calibre-web.enable;
in
{
options = {
mod.calibre-web = {
enable = lib.mkEnableOption "add calibre-web module";
};
};
config = lib.mkIf enabled {
mod.homepage.services = [{
name = "Calibre-Web";
port = 8083;
description = "E-book library";
}];
services = {
calibre-web = {
enable = true;
user = "storage";
group = "storage";
listen = {
ip = "0.0.0.0";
port = 8083;
};
dataDir = "/mnt/media/public/books";
options = {
calibreLibrary = "/mnt/media/public/books";
enableBookUploading = true;
};
};
};
};
}

View File

@@ -20,6 +20,19 @@
"--http-timeout=60" "--http-timeout=60"
]; ];
}; };
"komga.ppp.pm" = {
dnsProvider = "hetzner";
environmentFile = config.age.secrets.hetzner-dns.path;
group = "nginx";
extraLegoFlags = [
"--dns.resolvers=1.1.1.1:53,8.8.8.8:53"
"--dns.propagation-wait=60s"
"--dns-timeout=60"
"--http-timeout=60"
];
};
}; };
}; };

View File

@@ -16,7 +16,6 @@ in
nginx.enable = true; nginx.enable = true;
syncthing.enable = true; syncthing.enable = true;
transmission.enable = true; transmission.enable = true;
calibre-web.enable = true;
audiobookshelf.enable = true; audiobookshelf.enable = true;
jellyfin.enable = true; jellyfin.enable = true;
immich.enable = true; immich.enable = true;

View File

@@ -62,6 +62,14 @@ let
''; '';
in in
{ {
mod.homepage.services = [
{
name = "Home Assistant";
port = 8123;
description = "Home automation";
}
];
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
virtualisation.oci-containers = { virtualisation.oci-containers = {
@@ -154,13 +162,13 @@ in
user = { user = {
timers = { timers = {
"update-hetzner-ha-dns" = { "update-hetzner-dns" = {
unitConfig = { unitConfig = {
Description = "updates Hetzner DNS for home-assistant"; Description = "updates Hetzner DNS records";
}; };
timerConfig = { timerConfig = {
Unit = "update-hetzner-ha-dns.service"; Unit = "update-hetzner-dns.service";
OnCalendar = "*-*-* *:00/30:00"; OnCalendar = "*-*-* *:00/30:00";
Persistent = true; Persistent = true;
}; };
@@ -170,9 +178,9 @@ in
}; };
services = { services = {
"update-hetzner-ha-dns" = { "update-hetzner-dns" = {
unitConfig = { unitConfig = {
Description = "updates Hetzner DNS for home-assistant"; Description = "updates Hetzner DNS records";
}; };
serviceConfig = { serviceConfig = {
@@ -182,26 +190,28 @@ in
path = [ path = [
pkgs.curl pkgs.curl
pkgs.coreutils # For `cat` pkgs.coreutils
pkgs.jq pkgs.jq
]; ];
script = '' script = ''
LAST_IP_FILE="/tmp/hetzner-dns-ha-ip" SUBDOMAINS="ha komga"
INTERFACE="enp3s0" INTERFACE="enp3s0"
CURRENT_IP=$(curl -s --fail --interface "$INTERFACE" ifconfig.me) CURRENT_IP=$(curl -s --fail --interface "$INTERFACE" ifconfig.me)
for SUBDOMAIN in $SUBDOMAINS; do
LAST_IP_FILE="/tmp/hetzner-dns-''${SUBDOMAIN}-ip"
LAST_IP="" LAST_IP=""
if [[ -f "$LAST_IP_FILE" ]]; then if [[ -f "$LAST_IP_FILE" ]]; then
LAST_IP=$(cat "$LAST_IP_FILE") LAST_IP=$(cat "$LAST_IP_FILE")
fi fi
if [[ "$CURRENT_IP" == "$LAST_IP" ]]; then if [[ "$CURRENT_IP" == "$LAST_IP" ]]; then
echo "IP unchanged, NOOP update." echo "$SUBDOMAIN: IP unchanged, NOOP update."
exit 0
else else
echo "Updating IP" echo "$SUBDOMAIN: Updating IP"
JSON_BODY=$(jq -n --arg ip "$CURRENT_IP" '{records: [{value: $ip}]}') JSON_BODY=$(jq -n --arg ip "$CURRENT_IP" '{records: [{value: $ip}]}')
@@ -211,9 +221,10 @@ in
-H "Authorization: Bearer $HETZNER_API_TOKEN" \ -H "Authorization: Bearer $HETZNER_API_TOKEN" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "$JSON_BODY" \ -d "$JSON_BODY" \
"https://api.hetzner.cloud/v1/zones/ppp.pm/rrsets/ha/A/actions/set_records" \ "https://api.hetzner.cloud/v1/zones/ppp.pm/rrsets/''${SUBDOMAIN}/A/actions/set_records" \
&& echo $CURRENT_IP > $LAST_IP_FILE && echo $CURRENT_IP > $LAST_IP_FILE
fi fi
done
''; '';
}; };
}; };

View File

@@ -77,13 +77,15 @@ in
mod.homepage = { mod.homepage = {
enable = lib.mkEnableOption "Enable homepage module"; enable = lib.mkEnableOption "Enable homepage module";
services = lib.mkOption { services = lib.mkOption {
type = lib.types.listOf (lib.types.submodule { type = lib.types.listOf (
lib.types.submodule {
options = { options = {
name = lib.mkOption { type = lib.types.str; }; name = lib.mkOption { type = lib.types.str; };
port = lib.mkOption { type = lib.types.port; }; port = lib.mkOption { type = lib.types.port; };
description = lib.mkOption { type = lib.types.str; }; description = lib.mkOption { type = lib.types.str; };
}; };
}); }
);
default = [ ]; default = [ ];
description = "Services to display on the homepage"; description = "Services to display on the homepage";
}; };
@@ -95,7 +97,7 @@ in
listen = [ listen = [
{ {
addr = "0.0.0.0"; addr = "0.0.0.0";
port = 80; port = 9999;
} }
]; ];
root = page; root = page;
@@ -104,6 +106,6 @@ in
}; };
}; };
networking.firewall.allowedTCPPorts = [ 80 ]; networking.firewall.allowedTCPPorts = [ 9999 ];
}; };
} }

View File

@@ -10,11 +10,13 @@ in
}; };
config = lib.mkIf enabled { config = lib.mkIf enabled {
mod.homepage.services = [{ mod.homepage.services = [
{
name = "Immich"; name = "Immich";
port = 2283; port = 2283;
description = "Photo library"; description = "Photo library";
}]; }
];
users.users.immich = { users.users.immich = {
isSystemUser = true; isSystemUser = true;

View File

@@ -47,11 +47,13 @@ in
}; };
}; };
mod.homepage.services = [{ mod.homepage.services = [
{
name = "Jellyfin"; name = "Jellyfin";
port = 8096; port = 8096;
description = "Media streaming"; description = "Media streaming";
}]; }
];
networking = { networking = {
firewall.allowedTCPPorts = [ 8096 ]; firewall.allowedTCPPorts = [ 8096 ];

View File

@@ -16,7 +16,10 @@ in
}; };
}; };
imports = [ inputs.komga-comictracker.nixosModules.default ]; imports = [
inputs.komga-comictracker.nixosModules.default
inputs.komga-bookmanager.nixosModules.default
];
config = lib.mkIf enabled { config = lib.mkIf enabled {
mod.homepage.services = [ mod.homepage.services = [
@@ -30,6 +33,11 @@ in
port = 8888; port = 8888;
description = "Comic reader"; description = "Comic reader";
} }
{
name = "Komga Book Manager";
port = 8686;
description = "Book manager";
}
]; ];
users.users.komga = { users.users.komga = {
@@ -47,6 +55,7 @@ in
server.port = 8002; server.port = 8002;
komga."cors.allowed-origins" = [ komga."cors.allowed-origins" = [
"http://manatee:8888" "http://manatee:8888"
"https://komga.ppp.pm"
]; ];
}; };
@@ -68,22 +77,49 @@ in
tryFiles = "$uri $uri/ /komga-reader.html"; tryFiles = "$uri $uri/ /komga-reader.html";
}; };
}; };
virtualHosts."komga.ppp.pm" = {
forceSSL = true;
useACMEHost = "komga.ppp.pm";
locations."/" = {
proxyPass = "http://127.0.0.1:8002";
proxyWebsockets = true;
};
};
}; };
networking.firewall.allowedTCPPorts = [ 8888 ]; networking.firewall.allowedTCPPorts = [ 8888 ];
programs.comictracker = { programs.comictracker = {
enable = true; enable = true;
komgaUrl = "http://manatee:8002"; komgaUrl = "http://127.0.0.1:8002";
komgaLibraryId = "0NVZH5AK3RPE1";
secretsFile = config.age.secrets.komga-comicbooktracker-credentials.path; secretsFile = config.age.secrets.komga-comicbooktracker-credentials.path;
}; };
services.komga-book-manager = {
enable = true;
port = 8686;
group = "storage";
komgaUrl = "http://127.0.0.1:8002";
credentialsFile = config.age.secrets.komga-bookmanager-credentials.path;
libraryRoot = "/mnt/media/public/books";
libraryId = "0PNE1NEPY6995";
};
age.secrets = { age.secrets = {
"komga-comicbooktracker-credentials" = { "komga-comicbooktracker-credentials" = {
file = ../../../../secrets/manatee/komga-comicbooktracker-credentials.age; file = ../../../../secrets/manatee/komga-comicbooktracker-credentials.age;
owner = "alex"; owner = "alex";
group = "users"; group = "users";
}; };
"komga-bookmanager-credentials" = {
file = ../../../../secrets/manatee/komga-bookmanager-credentials.age;
owner = "alex";
group = "users";
};
}; };
}; };
} }

View File

@@ -15,11 +15,13 @@ in
}; };
config = { config = {
mod.homepage.services = lib.mkIf navidromeEnabled [{ mod.homepage.services = lib.mkIf navidromeEnabled [
{
name = "Navidrome"; name = "Navidrome";
port = 4533; port = 4533;
description = "Music streaming"; description = "Music streaming";
}]; }
];
services = lib.mkIf navidromeEnabled { services = lib.mkIf navidromeEnabled {
navidrome = { navidrome = {

View File

@@ -10,11 +10,13 @@ in
}; };
config = lib.mkIf enabled { config = lib.mkIf enabled {
mod.homepage.services = [{ mod.homepage.services = [
{
name = "Syncthing"; name = "Syncthing";
port = 8384; port = 8384;
description = "File sync"; description = "File sync";
}]; }
];
services.syncthing = { services.syncthing = {
enable = true; enable = true;

View File

@@ -15,11 +15,13 @@ in
}; };
config = lib.mkIf enabled { config = lib.mkIf enabled {
mod.homepage.services = [{ mod.homepage.services = [
{
name = "Transmission"; name = "Transmission";
port = 9091; port = 9091;
description = "Torrent client"; description = "Torrent client";
}]; }
];
services = { services = {
transmission = { transmission = {

View File

@@ -0,0 +1,7 @@
age-encryption.org/v1
-> ssh-ed25519 wkRvNA GW8mvnaXpspxr78xV0fKhXwHVvReyjvDc0v7uPwhuBI
Rne8JZYVhrTTesSFpRQ/IOZlFIMoX9Wmv5n1Ed7Ehv8
-> ssh-ed25519 +oNaHQ d7utzodGQ7LsD2Uht1rbT8Qq9BZp3PkJS9EDhajCjnk
qd2Vj+1TQrjEKkSVAf0cXcCdkgeN/Jbp4UrBSp3cKYQ
--- JQr5UQlutONqnTeoT/mIVZL8ME7ipUDK8zDfNcN3uhU
ø5-VŸÌ²ÂòÀ-®ªÁÅ'^žô5kú.t(d1‡)É'<u%

View File

@@ -34,6 +34,7 @@ in {
"manatee/syncthing-key.age".publicKeys = [ manatee alex ]; "manatee/syncthing-key.age".publicKeys = [ manatee alex ];
"manatee/hetzner-dns.age".publicKeys = [ manatee alex ]; "manatee/hetzner-dns.age".publicKeys = [ manatee alex ];
"manatee/komga-comicbooktracker-credentials.age".publicKeys = [ manatee alex]; "manatee/komga-comicbooktracker-credentials.age".publicKeys = [ manatee alex];
"manatee/komga-bookmanager-credentials.age".publicKeys = [ manatee alex];
"backwards/root.backwards.age".publicKeys = [ backwards alex ]; "backwards/root.backwards.age".publicKeys = [ backwards alex ];
"backwards/root.backwards.pub.age".publicKeys = [ backwards alex ]; "backwards/root.backwards.pub.age".publicKeys = [ backwards alex ];