Update modules/server/containers/apps/homepage.nix

This commit is contained in:
2026-06-08 12:02:27 +02:00
parent a899fe4c6f
commit 59dd62b9c9

View File

@@ -3,9 +3,20 @@ let
version = "latest";
serverCfg = config.syscfg.server;
mediaCfg = config.syscfg.media;
homepageExtra = containerCfg.extra or {};
backgroundImage = if mediaCfg.banner.png != null then mediaCfg.banner.png else mediaCfg.bg;
backgroundFileName = builtins.baseNameOf (toString backgroundImage);
backgroundMount = "/app/public/media/${backgroundFileName}";
latitude =
if homepageExtra ? latitude then homepageExtra.latitude
else if homepageExtra ? lat then homepageExtra.lat
else 47.3769;
longitude =
if homepageExtra ? longitude then homepageExtra.longitude
else if homepageExtra ? lon then homepageExtra.lon
else 8.5417;
extraBookmarks = homepageExtra.bookmarks or [];
extraServices = homepageExtra.services or [];
settings = pkgs.writers.writeYAML "settings.yaml" {
title = "Home";
@@ -13,20 +24,15 @@ let
startUrl = "https://${containerCfg.subdomain}.${serverCfg.domain}";
background = {
image = "/media/${backgroundFileName}";
blur = "xs"; # "", sm, md, xl,...
# saturate = "";
brightness = 50;
# opacity = 40;
};
cardBlur = "md";
# favicon = "";
favicon = config.syscfg.media.logo.ico;
theme = "dark";
color = "slate";
fullWidth = true;
useEqualHeights = true;
pwa = {
};
pwa = { };
layout = {
Admin = {
style = "row";
@@ -43,14 +49,16 @@ let
statusStyle = "dot";
hideErrors = true;
};
widgets = pkgs.writers.writeYAML "widgets.yaml" [
{ openmeteo = {
latitude = "47.3769";
longitude = "8.5417";
timezone = "Europe/Zurich";
latitude = toString latitude;
longitude = toString longitude;
timezone = config.time.timeZone;
units = "metric";
cache = "15";
};}
};
}
{ search = {
provider = "custom";
focus = true;
@@ -65,15 +73,14 @@ let
provider = "finnhub";
color = true;
cache = 15;
watchlist = containerCfg.extra.stocks or [];
};}
watchlist = homepageExtra.stocks or [];
};
}
];
bookmarks = pkgs.writers.writeYAML "bookmarks.yaml" [
bookmarks = pkgs.writers.writeYAML "bookmarks.yaml" (extraBookmarks);
];
services = pkgs.writers.writeYAML "services.yaml" [
services = pkgs.writers.writeYAML "services.yaml" ([
{ Media = lib.flatten [
(lib.optional (serverCfg.containers ? jellyfin) {
Jellyfin = {
@@ -92,6 +99,18 @@ let
href = "https://${serverCfg.containers.invidious.subdomain}.${serverCfg.domain}";
};
})
(lib.optional (serverCfg.containers ? calibre) {
Calibre = {
icon = "calibre.png";
href = "https://${serverCfg.containers.calibre.subdomain}.${serverCfg.domain}";
};
})
(lib.optional (serverCfg.containers ? freshrss) {
FreshRSS = {
icon = "freshrss.png";
href = "https://${serverCfg.containers.freshrss.subdomain}.${serverCfg.domain}";
};
})
(lib.optional (serverCfg.containers ? miniflux) {
Miniflux = {
icon = "miniflux.png";
@@ -103,7 +122,14 @@ let
};
};
})
];}
(lib.optional (serverCfg.containers ? suwayomi) {
Suwayomi = {
icon = "suwayomi.png";
href = "https://${serverCfg.containers.suwayomi.subdomain}.${serverCfg.domain}";
};
})
];
}
{ Cloud = lib.flatten [
(lib.optional (serverCfg.containers ? nextcloud) {
Nextcloud = {
@@ -128,8 +154,14 @@ let
href = "https://${serverCfg.containers.etherpad.subdomain}.${serverCfg.domain}";
};
})
(lib.optional (serverCfg.containers ? collabora && false) {
Collabora = {
icon = "microsoft-office.png";
href = "https://${serverCfg.containers.collabora.subdomain}.${serverCfg.domain}";
};
})
(lib.optional (serverCfg.containers ? immich) {
immich={
Immich = {
icon = "immich.png";
href = "https://${serverCfg.containers.immich.subdomain}.${serverCfg.domain}";
widget = {
@@ -140,24 +172,45 @@ let
};
};
})
];}
];
}
{ Home = lib.flatten [
(lib.optional (serverCfg.containers ? homeassistant) {
"Home Assistant" = {
icon = "home-assistant.png";
href = "https://${serverCfg.containers.homeassistant.subdomain}.${serverCfg.domain}";
};
})
(lib.optional (serverCfg.containers ? openhab) {
openHAB = {
icon = "openhab.png";
href = "https://${serverCfg.containers.openhab.subdomain}.${serverCfg.domain}";
};
})
(lib.optional (serverCfg.containers ? frigate) {
Frigate = {
icon = "frigate.png";
href = "https://${serverCfg.containers.frigate.subdomain}.${serverCfg.domain}";
};
})
];
}
{ Dev = lib.flatten [
(lib.optional (serverCfg.containers ? gitea) {
Gitea = {
icon = "gitea.png";
href = "https://${serverCfg.containers.gitea.subdomain}.${serverCfg.domain}";
# widget = {
# type="gitea";
# url = "http://gitea-server:8080";
# key = "{{HOMEPAGE_VAR_GITEA_API}}";
# };
};
})
];}
{Admin = #lib.flatten [
#({permissions.groups = ["admin"];})
#({services =
lib.flatten [
(lib.optional (serverCfg.containers ? trmnl) {
TRMNL = {
icon = "terminal.png";
href = "https://${serverCfg.containers.trmnl.subdomain}.${serverCfg.domain}";
};
})
];
}
{ Admin = lib.flatten [
(lib.optional (serverCfg.containers ? traefik) {
Traefik = {
icon = "traefik.png";
@@ -209,6 +262,12 @@ let
};
};
})
(lib.optional (serverCfg.containers ? selfmark) {
Selfmark = {
icon = "link.png";
href = "https://${serverCfg.containers.selfmark.subdomain}.${serverCfg.domain}";
};
})
(lib.optional (serverCfg.containers ? servarr) (
let
modules = serverCfg.containers.servarr.extra.modules or [ "prowlarr" "sonarr" "radarr" "flaresolverr" ];
@@ -221,10 +280,10 @@ let
type = "sonarr";
url = "http://servarr-sonarr:8989";
key = "{{HOMEPAGE_VAR_SONARR_API}}";
};
};
}) ++ (lib.optional (builtins.elem "radarr" modules) {
})
++ (lib.optional (builtins.elem "radarr" modules) {
Radarr = {
icon = "radarr.png";
href = "https://${serverCfg.containers.servarr.subdomain}.${serverCfg.domain}/radarr";
@@ -232,10 +291,10 @@ let
type = "radarr";
url = "http://servarr-radarr:8989";
key = "{{HOMEPAGE_VAR_RADARR_API}}";
};
};
}) ++ (lib.optional (builtins.elem "lidarr" modules) {
})
++ (lib.optional (builtins.elem "lidarr" modules) {
Lidarr = {
icon = "lidarr.png";
href = "https://${serverCfg.containers.servarr.subdomain}.${serverCfg.domain}/lidarr";
@@ -243,10 +302,10 @@ let
type = "lidarr";
url = "http://servarr-lidarr:8989";
key = "{{HOMEPAGE_VAR_LIDARR_API}}";
};
};
}) ++ (lib.optional (builtins.elem "prowlarr" modules) {
})
++ (lib.optional (builtins.elem "prowlarr" modules) {
Prowlarr = {
icon = "prowlarr.png";
href = "https://${serverCfg.containers.servarr.subdomain}.${serverCfg.domain}/prowlarr";
@@ -254,15 +313,13 @@ let
type = "prowlarr";
url = "http://servarr-prowlarr:8989";
key = "{{HOMEPAGE_VAR_PROWLARR_API}}";
};
};
})
# Bazarr
))
];}#)];}
];
}
] ++ extraServices);
in {
runtime = {
containers = {