diff --git a/flake.nix b/flake.nix index 49055ed..62d5e7e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ # flake for blakes nixos config # define new devices in outputs -# generation: 365, timestamp: 2025-10-12 15:04:31 +# generation: 366, timestamp: 2025-10-12 15:30:09 { description = "blakes nix config"; inputs = { diff --git a/hosts/snowbelle/configuration.nix b/hosts/snowbelle/configuration.nix index 6cd13bc..e757b87 100644 --- a/hosts/snowbelle/configuration.nix +++ b/hosts/snowbelle/configuration.nix @@ -111,6 +111,7 @@ in curl fzf fd + alejandra tree vim lf diff --git a/modules/homelab/services/glance/default.nix b/modules/homelab/services/glance/default.nix index 4fc5d8c..ebb457b 100644 --- a/modules/homelab/services/glance/default.nix +++ b/modules/homelab/services/glance/default.nix @@ -105,7 +105,7 @@ in size = "small"; widgets = [ { type = "calendar"; first-day-of-week = "monday"; } - { type = "server-stats"; servers = [ { type = "local"; name = "violet"; } ]; } + { type = "server-stats"; servers = [ { type = "local"; name = "snowbelle"; } ]; } { type = "clock"; hour-format = "24h"; @@ -162,6 +162,15 @@ in size = "small"; widgets = [ { type = "weather"; location = "Pearland, Texas, United States"; units = "imperial"; hour-format = "24h"; } + { + type = "custom-api"; + title = "uptime"; + title-url = "127.0.0.1:7901"; + url = "127.0.0.1:7901/api/status-page/glance"; + subrequests = {heartbeats = {url = "127.0.0.1:7901/api/status-page/heartbeat/glance";};}; + cache = "10m"; + template = "{{ $hb := .Subrequest \"heartbeats\" }}\n\n{{ if not (.JSON.Exists \"publicGroupList\") }}\n

Error reading response

\n{{ else if eq (len (.JSON.Array \"publicGroupList\")) 0 }}\n

No monitors found

\n{{ else }}\n\n\n{{ end }}\n"; + } { type = "markets"; markets = [ diff --git a/modules/homelab/services/glance/test.nix b/modules/homelab/services/glance/test.nix index 4089563..fc2d7a5 100644 --- a/modules/homelab/services/glance/test.nix +++ b/modules/homelab/services/glance/test.nix @@ -1,9 +1,11 @@ [ { type = "custom-api"; - title = "Minecraft"; - url = "https://api.mcstatus.io/v2/status/java/\${MC_SERVER_URL}"; - cache = "30s"; - template = "
\n
\n {{ if .JSON.Bool \"online\" }}\n \n {{ else }}\n \n \n \n {{ end }}\n
\n\n
\n \n {{ .JSON.String \"host\" }}\n {{ if .JSON.Bool \"online\" }}\n \n {{ else }}\n \n {{ end }}\n \n\n \n
\n
"; + title = "Uptime Kumas"; + title-url = "\${UPTIME_KUMA_URL}"; + url = "\${UPTIME_KUMA_URL}/api/status-page/\${UPTIME_KUMA_STATUS_SLUG}"; + subrequests = {heartbeats = {url = "\${UPTIME_KUMA_URL}/api/status-page/heartbeat/\${UPTIME_KUMA_STATUS_SLUG}";};}; + cache = "10m"; + template = "{{ $hb := .Subrequest \"heartbeats\" }}\n\n{{ if not (.JSON.Exists \"publicGroupList\") }}\n

Error reading response

\n{{ else if eq (len (.JSON.Array \"publicGroupList\")) 0 }}\n

No monitors found

\n{{ else }}\n\n\n{{ end }}\n"; } ] diff --git a/modules/homelab/services/glance/yml.yaml b/modules/homelab/services/glance/yml.yaml index 0f625ab..2ce7bf8 100644 --- a/modules/homelab/services/glance/yml.yaml +++ b/modules/homelab/services/glance/yml.yaml @@ -1,67 +1,63 @@ - type: custom-api - title: Minecraft - url: https://api.mcstatus.io/v2/status/java/${MC_SERVER_URL} - cache: 30s + title: Uptime Kumas + title-url: ${UPTIME_KUMA_URL} + url: ${UPTIME_KUMA_URL}/api/status-page/${UPTIME_KUMA_STATUS_SLUG} + subrequests: + heartbeats: + url: ${UPTIME_KUMA_URL}/api/status-page/heartbeat/${UPTIME_KUMA_STATUS_SLUG} + cache: 10m template: | -
-
- {{ if .JSON.Bool "online" }} - + {{ $hb := .Subrequest "heartbeats" }} + + {{ if not (.JSON.Exists "publicGroupList") }} +

Error reading response

+ {{ else if eq (len (.JSON.Array "publicGroupList")) 0 }} +

No monitors found

+ {{ else }} + + + {{ end }} -
- - {{ .JSON.String "host" }} - {{ if .JSON.Bool "online" }} - - {{ else }} - - {{ end }} - - -
    -
  • - {{ if .JSON.Bool "online" }} - {{ .JSON.String "version.name_clean" }} - {{ else }} - Offline - {{ end }} -
  • - {{ if .JSON.Bool "online" }} -
  • -
    - {{ range .JSON.Array "players.list" }}{{ .String "name_clean" }}
    {{ end }} -
    -

    - - - - {{ .JSON.Int "players.online" | formatNumber }}/{{ .JSON.Int "players.max" | formatNumber }} players -

    -
  • - {{ else }} -
  • -

    - - - - 0 players -

    -
  • - {{ end }} -
-
-