245 lines
9.4 KiB
Nix
245 lines
9.4 KiB
Nix
{ config, containerCfg, pkgs, lib, builder, name,... }:
|
|
let
|
|
version = "latest";
|
|
serverCfg = config.syscfg.server;
|
|
|
|
settings = pkgs.writers.writeYAML "settings.yaml" {
|
|
title = "My Self-Hosted Dashboard";
|
|
base = "";
|
|
theme = "dark";
|
|
# layout = {
|
|
# Infrastructure = {
|
|
# style = "grid";
|
|
# columns = 3;
|
|
# };
|
|
# };
|
|
auth = {
|
|
oidc = {
|
|
enabled = true;
|
|
provider = "authentik";
|
|
issuerUrl = "https://${serverCfg.containers.authentik.subdomain}.${serverCfg.domain}";
|
|
clientId = "homepage";
|
|
clientSecret = "{{HOMEPAGE_VAR_OAUTH_SECRET}}";
|
|
groupsProperty = "groups";
|
|
|
|
};
|
|
};
|
|
};
|
|
|
|
services = pkgs.writers.writeYAML "services.yaml" [
|
|
{Media = lib.flatten [
|
|
(lib.optional (serverCfg.containers?jellyfin) {
|
|
Jellyfin={
|
|
icon = "jellyfin.png";
|
|
href = "https://${serverCfg.containers.jellyfin.subdomain}.${serverCfg.domain}";
|
|
widget = {
|
|
type="jellyfin";
|
|
url = "http://jellyfin-server:8096";
|
|
key = "{{HOMEPAGE_VAR_JELLYFIN_API}}";
|
|
};
|
|
};
|
|
})
|
|
(lib.optional (serverCfg.containers?invidious) {
|
|
Invidious={
|
|
icon = "invidious.png";
|
|
href = "https://${serverCfg.containers.invidious.subdomain}.${serverCfg.domain}";
|
|
};
|
|
})
|
|
(lib.optional (serverCfg.containers?miniflux) {
|
|
Miniflux={
|
|
icon = "miniflux.png";
|
|
href = "https://${serverCfg.containers.miniflux.subdomain}.${serverCfg.domain}";
|
|
widget = {
|
|
type="miniflux";
|
|
url = "http://miniflux-server";
|
|
key = "{{HOMEPAGE_VAR_MINIFLUX_API}}";
|
|
};
|
|
};
|
|
})
|
|
];}
|
|
{Cloud = lib.flatten [
|
|
(lib.optional (serverCfg.containers?nextcloud) {
|
|
Nextcloud={
|
|
icon = "nextcloud.png";
|
|
href = "https://${serverCfg.containers.nextcloud.subdomain}.${serverCfg.domain}";
|
|
widget = {
|
|
type="nextcloud";
|
|
url = "http://nextcloud-server:80";
|
|
key = "{{HOMEPAGE_VAR_NEXTCLOUD_API}}";
|
|
};
|
|
};
|
|
})
|
|
(lib.optional (serverCfg.containers?ethercalc) {
|
|
Ethercalc={
|
|
icon = "ethercalc.png";
|
|
href = "https://${serverCfg.containers.ethercalc.subdomain}.${serverCfg.domain}";
|
|
};
|
|
})
|
|
(lib.optional (serverCfg.containers?etherpad) {
|
|
Etherpad={
|
|
icon = "etherpad.png";
|
|
href = "https://${serverCfg.containers.etherpad.subdomain}.${serverCfg.domain}";
|
|
};
|
|
})
|
|
(lib.optional (serverCfg.containers?immich) {
|
|
immich={
|
|
icon = "immich.png";
|
|
href = "https://${serverCfg.containers.immich.subdomain}.${serverCfg.domain}";
|
|
widget = {
|
|
type="immich";
|
|
url = "http://immich-server:80";
|
|
key = "{{HOMEPAGE_VAR_IMMICH_API}}";
|
|
version = "2";
|
|
};
|
|
};
|
|
})
|
|
];}
|
|
{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?traefik) {
|
|
Traefik={
|
|
icon = "traefik.png";
|
|
href = "https://${serverCfg.containers.traefik.subdomain}.${serverCfg.domain}";
|
|
widget = {
|
|
type = "traefik";
|
|
url = "http://traefik-server:8080";
|
|
};
|
|
};
|
|
})
|
|
(lib.optional (serverCfg.containers?authentik) {
|
|
Authentik={
|
|
icon = "authentik.png";
|
|
href = "https://${serverCfg.containers.authentik.subdomain}.${serverCfg.domain}";
|
|
widget = {
|
|
type = "authentik";
|
|
url = "http://authentik-server:9000";
|
|
key = "{{HOMEPAGE_VAR_AUTHENTIK_API}}";
|
|
version = "2";
|
|
};
|
|
};
|
|
})
|
|
(lib.optional (serverCfg.containers?umami) {
|
|
Umami={
|
|
icon = "umami.png";
|
|
href = "https://${serverCfg.containers.umami.subdomain}.${serverCfg.domain}";
|
|
};
|
|
})
|
|
(lib.optional (serverCfg.containers?influx) {
|
|
Influx={
|
|
icon = "influx.png";
|
|
href = "https://${serverCfg.containers.influx.subdomain}.${serverCfg.domain}";
|
|
};
|
|
})
|
|
(lib.optional (serverCfg.containers?handbrake) {
|
|
Handbrake={
|
|
icon = "handbrake.png";
|
|
href = "https://${serverCfg.containers.handbrake.subdomain}.${serverCfg.domain}";
|
|
};
|
|
})
|
|
(lib.optional (serverCfg.containers?transmission) {
|
|
Transmission={
|
|
icon = "transmission.png";
|
|
href = "https://${serverCfg.containers.transmission.subdomain}.${serverCfg.domain}/transmission";
|
|
widget = {
|
|
type = "transmission";
|
|
url = "http://transmission-server:9091";
|
|
rpcUrl = "/transmission/";
|
|
};
|
|
};
|
|
})
|
|
(lib.optional (serverCfg.containers?servarr) (
|
|
let
|
|
modules = serverCfg.containers.servarr.extra.modules or ["prowlarr" "sonarr" "radarr" "flaresolverr" ];
|
|
in
|
|
(lib.optional (builtins.elem "sonarr" modules) {
|
|
Sonarr={
|
|
icon = "sonarr.png";
|
|
href = "https://${serverCfg.containers.servarr.subdomain}.${serverCfg.domain}/sonarr";
|
|
widget = {
|
|
type = "sonarr";
|
|
url = "http://servarr-sonarr:8989";
|
|
key = "{{HOMEPAGE_VAR_SONARR_API}}";
|
|
|
|
};
|
|
};
|
|
}) ++ (lib.optional (builtins.elem "radarr" modules) {
|
|
Radarr={
|
|
icon = "radarr.png";
|
|
href = "https://${serverCfg.containers.servarr.subdomain}.${serverCfg.domain}/radarr";
|
|
widget = {
|
|
type = "radarr";
|
|
url = "http://servarr-radarr:8989";
|
|
key = "{{HOMEPAGE_VAR_RADARR_API}}";
|
|
|
|
};
|
|
};
|
|
}) ++ (lib.optional (builtins.elem "lidarr" modules) {
|
|
Lidarr={
|
|
icon = "lidarr.png";
|
|
href = "https://${serverCfg.containers.servarr.subdomain}.${serverCfg.domain}/lidarr";
|
|
widget = {
|
|
type = "lidarr";
|
|
url = "http://servarr-lidarr:8989";
|
|
key = "{{HOMEPAGE_VAR_LIDARR_API}}";
|
|
|
|
};
|
|
};
|
|
}) ++ (lib.optional (builtins.elem "prowlarr" modules) {
|
|
Prowlarr={
|
|
icon = "prowlarr.png";
|
|
href = "https://${serverCfg.containers.servarr.subdomain}.${serverCfg.domain}/prowlarr";
|
|
widget = {
|
|
type = "prowlarr";
|
|
url = "http://servarr-prowlarr:8989";
|
|
key = "{{HOMEPAGE_VAR_PROWLARR_API}}";
|
|
|
|
};
|
|
};
|
|
})
|
|
# Bazarr
|
|
|
|
))
|
|
];}#)];}
|
|
];
|
|
in {
|
|
sops = false;
|
|
db = false;
|
|
|
|
containers = {
|
|
server = builder.mkContainer {
|
|
subdomain = containerCfg.subdomain;
|
|
image = "ghcr.io/gethomepage/homepage:${version}";
|
|
port = 3000;
|
|
extraEnv = {
|
|
HOMEPAGE_VAR_TITLE="${serverCfg.domain}";
|
|
HOMEPAGE_ALLOWED_HOSTS = "${containerCfg.subdomain}.${serverCfg.domain},${builder.host}";
|
|
};
|
|
extraLabels = {
|
|
"traefik.http.routers.${containerCfg.subdomain}.service" = "${containerCfg.subdomain}";
|
|
};
|
|
overrides = {
|
|
environmentFiles = [ config.sops.secrets."CUSTOM".path ];
|
|
volumes = [
|
|
"${settings}:/app/config/settings.yaml:ro"
|
|
"${services}:/app/config/services.yaml:ro"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
|
|
} |