Commit 70b8ce6
Changed files (5)
hosts
chaser-pardofelis
homepage
modules
hosts
chaser-pardofelis
services
authelia
hosts/chaser-pardofelis/homepage/default.nix
@@ -1,137 +0,0 @@
-{lib, ...}: let
- mapHomepageConf = attrs: lib.mapAttrsToList (n: v: {${n} = v;}) attrs;
-in {
- services.homepage-dashboard = {
- enable = true;
- listenPort = 4982;
- openFirewall = false;
- allowedHosts = "home.hpcesia.com";
- settings = {
- # Basic Infomations
- title = "主页";
- subtitle = "HPCesia";
- description = "HPCesia 的导航板";
- favicon = "https://blog.hpcesia.com/favicon.svg";
- language = "zh-CN";
- startUrl = "https://home.hpcesia.com";
- base = "https://home.hpcesia.com";
-
- # Appearance
- background = {
- image = "https://bu.dusays.com/2024/11/18/673ac3b7d597c.webp";
- brightness = 75;
- opacity = 75;
- };
- theme = "dark";
- color = "lime";
- headerStyle = "clean";
- iconStyle = "flat";
- useEqualHeights = true;
- };
- widgets = mapHomepageConf {
- resources = {
- cpu = true;
- memory = true;
- disk = "/";
- uptime = true;
- };
- datetime = {
- text_size = "2xl";
- locale = "zh-CN";
- format = {
- dateStyle = "short";
- timeStyle = "short";
- };
- };
- };
- };
-
- services.homepage-dashboard.settings.layout = mapHomepageConf {
- "开发" = {
- style = "row";
- columns = 3;
- tab = "主页";
- };
- NestedGroup-1 = {
- header = false;
- style = "row";
- columns = 2;
- "工具" = {
- style = "column";
- tab = "主页";
- };
- "阅读" = {
- style = "column";
- tab = "主页";
- };
- };
- };
-
- services.homepage-dashboard.services = mapHomepageConf {
- "开发" = mapHomepageConf {
- GitHub = {
- href = "https://github.com/";
- icon = "github.svg";
- };
- Codeberg = {
- href = "https://codeberg.org/";
- icon = "codeberg.svg";
- };
- Forgejo = {
- href = "https://repo.hpcesia.com/";
- icon = "forgejo.svg";
- siteMonitor = "https://repo.hpcesia.com/";
- };
- Cloudflare = {
- href = "https://dash.cloudflare.com/";
- icon = "cloudflare.svg";
- };
- Netlify = {
- href = "https://app.netlify.com/";
- icon = "netlify.svg";
- };
- Grafana = {
- href = "https://grafana.hpcesia.com/";
- icon = "grafana.svg";
- siteMonitor = "https://grafana.hpcesia.com/";
- };
- };
- "工具" = mapHomepageConf {
- Gokapi = {
- href = "https://send.hpcesia.com/admin";
- icon = "sh-gokapi.png";
- siteMonitor = "https://send.hpcesia.com/";
- };
- Hoppscotch = {
- href = "https://hoppscotch.io/";
- icon = "hoppscotch.svg";
- };
- Squoosh = {
- href = "https://squoosh.app/";
- icon = "sh-squoosh.svg";
- };
- GoatCounter = {
- href = "https://goatcounter.hpcesia.com/";
- icon = "sh-goatcounter.svg";
- siteMonitor = "https://goatcounter.hpcesia.com/";
- };
- };
- "阅读" = mapHomepageConf {
- FreshRSS = {
- href = "https://rss.hpcesia.com/";
- icon = "freshrss.svg";
- siteMonitor = "https://rss.hpcesia.com/";
- };
- Trinnon = {
- href = "https://trin.one/";
- icon = "https://trin.one/fileserver/01H6611F79D6TD4PCS5YVHWFJZ/attachment/original/01JVQEQBVWB6EXGQ5WGR823C5Y.png";
- siteMonitor = "https://trin.one/livez";
- };
- Blog = {
- href = "https://blog.hpcesia.com/";
- icon = "https://blog.hpcesia.com/favicon.svg";
- siteMonitor = "https://blog.hpcesia.com/";
- };
- };
- };
-}
hosts/chaser-pardofelis/caddy.nix
@@ -19,7 +19,6 @@ in {
# Assuming address start with `tcp://`.
builtins.substring 6 (-1) config.services.authelia.instances.main.settings.server.address
}";
- homepage = "http://localhost:${builtins.toString config.services.homepage-dashboard.listenPort}";
prometheus = "http://${config.services.victoriametrics.listenAddress}";
};
in {
@@ -27,14 +26,6 @@ in {
encode zstd gzip
reverse_proxy ${localAddress.atuin}
'';
- "home.hpcesia.com".extraConfig = ''
- encode zstd gzip
- forward_auth ${localAddress.authelia} {
- uri /api/authz/forward-auth
- copy_headers Remote-User Remote-Groups Remote-Email Remote-Name
- }
- reverse_proxy ${localAddress.homepage}
- '';
"phanpy.trin.one".extraConfig = ''
encode zstd gzip
root * ${phanpy}/dist/
modules/hosts/chaser-pardofelis/default.nix
@@ -31,6 +31,7 @@
"goatcounter"
"gokapi"
"gotosocial"
+ "homepage"
"node-exporter"
"podman"
"restic"
modules/services/authelia/main.nix
@@ -161,6 +161,7 @@
reverse_proxy ${localAddress}
'');
services.caddy.virtualHosts."auth.trin.one".extraConfig =
+ lib.mkIf config.services.caddy.enable
config.services.caddy.virtualHosts."authelia.hpcesia.com".extraConfig;
vaultix.secrets = lib.mkMerge (
modules/services/homepage.nix
@@ -0,0 +1,199 @@
+{lib, ...}: {
+ flake.modules.nixos."services/homepage" = {config, ...}: {
+ services.homepage-dashboard = {
+ enable = true;
+ listenPort = 4982;
+ openFirewall = false;
+ allowedHosts = "home.hpcesia.com";
+ settings = {
+ # Basic Infomations
+ title = "主页";
+ subtitle = "HPCesia";
+ description = "HPCesia 的导航板";
+ favicon = "https://blog.hpcesia.com/favicon.svg";
+ language = "zh-CN";
+ startUrl = "https://home.hpcesia.com";
+ base = "https://home.hpcesia.com";
+
+ # Appearance
+ background = {
+ image = "https://bu.dusays.com/2024/11/18/673ac3b7d597c.webp";
+ brightness = 75;
+ opacity = 75;
+ };
+ cardBlur = "md";
+ theme = "dark";
+ color = "lime";
+ headerStyle = "clean";
+ iconStyle = "flat";
+ useEqualHeights = true;
+ };
+ };
+
+ services.homepage-dashboard.widgets = [
+ {
+ resources = {
+ cpu = true;
+ memory = true;
+ disk = "/";
+ uptime = true;
+ };
+ }
+ {
+ datetime = {
+ text_size = "2xl";
+ locale = "zh-CN";
+ format = {
+ dateStyle = "short";
+ timeStyle = "short";
+ };
+ };
+ }
+ ];
+
+ services.homepage-dashboard.settings.layout = [
+ {
+ "开发" = {
+ style = "row";
+ columns = 3;
+ tab = "主页";
+ };
+ }
+ {
+ NestedGroup-1 = {
+ header = false;
+ style = "row";
+ columns = 2;
+ "工具" = {
+ style = "column";
+ tab = "主页";
+ };
+ "阅读" = {
+ style = "column";
+ tab = "主页";
+ };
+ };
+ }
+ ];
+
+ services.homepage-dashboard.services = [
+ {
+ "开发" = [
+ {
+ GitHub = {
+ href = "https://github.com/";
+ icon = "github.svg";
+ };
+ }
+ {
+ Codeberg = {
+ href = "https://codeberg.org/";
+ icon = "codeberg.svg";
+ };
+ }
+ {
+ Forgejo = {
+ href = "https://repo.hpcesia.com/";
+ icon = "forgejo.svg";
+ siteMonitor = "https://repo.hpcesia.com/";
+ };
+ }
+ {
+ Cloudflare = {
+ href = "https://dash.cloudflare.com/";
+ icon = "cloudflare.svg";
+ };
+ }
+ {
+ Netlify = {
+ href = "https://app.netlify.com/";
+ icon = "netlify.svg";
+ };
+ }
+ {
+ Grafana = {
+ href = "https://grafana.hpcesia.com/";
+ icon = "grafana.svg";
+ siteMonitor = "https://grafana.hpcesia.com/";
+ };
+ }
+ ];
+ }
+ {
+ "工具" = [
+ {
+ Gokapi = {
+ href = "https://send.hpcesia.com/admin";
+ icon = "sh-gokapi.png";
+ siteMonitor = "https://send.hpcesia.com/";
+ };
+ }
+ {
+ GoatCounter = {
+ href = "https://goatcounter.hpcesia.com/";
+ icon = "sh-goatcounter.svg";
+ siteMonitor = "https://goatcounter.hpcesia.com/";
+ };
+ }
+ {
+ Hoppscotch = {
+ href = "https://hoppscotch.io/";
+ icon = "hoppscotch.svg";
+ };
+ }
+ {
+ Squoosh = {
+ href = "https://squoosh.app/";
+ icon = "sh-squoosh.svg";
+ };
+ }
+ ];
+ }
+ {
+ "阅读" = [
+ {
+ FreshRSS = {
+ href = "https://rss.hpcesia.com/";
+ icon = "freshrss.svg";
+ siteMonitor = "https://rss.hpcesia.com/";
+ };
+ }
+ {
+ Trinnon = {
+ href = "https://trin.one/";
+ icon = "https://trin.one/fileserver/01H6611F79D6TD4PCS5YVHWFJZ/attachment/original/01JVQEQBVWB6EXGQ5WGR823C5Y.png";
+ siteMonitor = "https://trin.one/livez";
+ };
+ }
+ {
+ Blog = {
+ href = "https://blog.hpcesia.com/";
+ icon = "https://blog.hpcesia.com/favicon.svg";
+ siteMonitor = "https://blog.hpcesia.com/";
+ };
+ }
+ ];
+ }
+ ];
+
+ services.caddy.virtualHosts."home.hpcesia.com".extraConfig =
+ lib.mkIf config.services.caddy.enable
+ (let
+ localAddress = "http://localhost:${builtins.toString config.services.homepage-dashboard.listenPort}";
+ autheliaAddress =
+ if config.services.authelia.instances.main.enable
+ then "http://${
+ # Assuming address start with `tcp://`.
+ builtins.substring 6 (-1) config.services.authelia.instances.main.settings.server.address
+ }"
+ else "https://authelia.hpcesia.com";
+ in ''
+ encode zstd gzip
+ forward_auth ${autheliaAddress} {
+ uri /api/authz/forward-auth
+ copy_headers Remote-User Remote-Groups Remote-Email Remote-Name
+ }
+ reverse_proxy ${localAddress}
+ '');
+ };
+}