diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a6ed8a..b739108 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -145,30 +145,30 @@ jobs: - name: Notify success if: needs.await-deploy.result == 'success' env: - BODY: |- - Commit `${{ github.sha }}` deployed successfully. - > ${{ github.event.head_commit.message }} + SHA: ${{ github.sha }} + COMMIT_MSG: ${{ github.event.head_commit.message }} run: | + body=$(printf 'Commit `%s` deployed successfully.\n> %s' "${SHA::7}" "$COMMIT_MSG") curl -s \ -H "Title: CI: Deployment succeeded" \ -H "Priority: low" \ -H "Tags: white_check_mark" \ -H "Actions: view, Open workflow run, ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ -H "Markdown: yes" \ - -d "$BODY" \ + -d "$body" \ https://ntfy.sh/splitleaf - name: Notify failure if: needs.await-deploy.result == 'failure' env: - BODY: |- - Commit `${{ github.sha }}` failed to deploy. - > ${{ github.event.head_commit.message }} + SHA: ${{ github.sha }} + COMMIT_MSG: ${{ github.event.head_commit.message }} run: | + body=$(printf 'Commit `%s` failed to deploy.\n> %s' "${SHA::7}" "$COMMIT_MSG") curl -s \ -H "Title: CI: Deployment failed" \ -H "Priority: default" \ -H "Tags: rotating_light" \ -H "Actions: view, Open workflow run, ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ -H "Markdown: yes" \ - -d "$BODY" \ + -d "$body" \ https://ntfy.sh/splitleaf diff --git a/hosts/srv-core/configuration.nix b/hosts/srv-core/configuration.nix index 962334b..80844ff 100644 --- a/hosts/srv-core/configuration.nix +++ b/hosts/srv-core/configuration.nix @@ -72,6 +72,11 @@ domain = "status.${config.custom.networking.overlay.domain}"; generateDefaultEndpoints = true; }; + + glance = { + enable = true; + domain = "home.${config.custom.networking.overlay.domain}"; + }; }; }; } diff --git a/modules/nixos/web-services/glance.nix b/modules/nixos/web-services/glance.nix new file mode 100644 index 0000000..22c4328 --- /dev/null +++ b/modules/nixos/web-services/glance.nix @@ -0,0 +1,61 @@ +{ + config, + lib, + allHosts, + ... +}: +let + cfg = config.custom.web-services.glance; +in +{ + options.custom.web-services.glance = { + enable = lib.mkEnableOption ""; + domain = lib.mkOption { + type = lib.types.nonEmptyStr; + default = ""; + }; + port = lib.mkOption { + type = lib.types.port; + default = 63958; + }; + }; + + config = lib.mkIf cfg.enable { + services.glance = { + enable = true; + settings = { + server.port = cfg.port; + + pages = lib.singleton { + name = "Services"; + columns = [ + { + size = "full"; + widgets = [ + { + type = "monitor"; + cache = "1m"; + title = "Services"; + sites = + allHosts + |> lib.attrValues + |> lib.map ( + host: + host.config.custom.services.caddy.virtualHosts |> lib.attrValues |> lib.map (vHost: vHost.domain) + ) + |> lib.concatLists + |> lib.map (domain: { + title = domain; + url = "https://${domain}"; + }); + } + ]; + } + ]; + }; + }; + }; + + custom.services.caddy.virtualHosts.${cfg.domain}.port = cfg.port; + }; +}