From 3f665eec859bf4dae5655c310808061f6d8927b2 Mon Sep 17 00:00:00 2001 From: drew Date: Mon, 11 May 2026 13:38:30 +0400 Subject: [PATCH] feat: nix support + new site URL Signed-off-by: drew --- .github/workflows/nightly.yml | 96 +++++++++++++++- .github/workflows/nixpkgs-bump.yml | 174 +++++++++++++++++++++++++++++ .goreleaser.yml | 36 ++++-- README.md | 10 +- docs/docs/Features/CLI.md | 2 +- docs/docs/installation.md | 2 +- docs/docusaurus.config.ts | 2 +- i18n/README.md | 2 +- nix/maintainer-entry.nix | 13 +++ nix/nixpkgs-package.nix | 61 ++++++++++ plugins/README.md | 4 +- public/components/site.jsx | 24 ++-- public/matcha.flatpakref | 2 +- 13 files changed, 391 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/nixpkgs-bump.yml create mode 100644 nix/maintainer-entry.nix create mode 100644 nix/nixpkgs-package.nix diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 21c6c7ed..55c848ce 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -159,7 +159,7 @@ jobs: cat > /tmp/matcha-nightly.rb << EOF class MatchaNightly < Formula desc "A beautiful and functional email client for your terminal (nightly)" - homepage "https://matcha.floatpane.com" + homepage "https://matcha.email" version "$VERSION" on_macos do @@ -196,11 +196,101 @@ jobs: git clone "https://x-access-token:${GH_TOKEN}@github.com/floatpane/homebrew-matcha.git" /tmp/homebrew-matcha cp /tmp/matcha-nightly.rb /tmp/homebrew-matcha/matcha-nightly.rb cd /tmp/homebrew-matcha - git config user.name "goreleaserbot" - git config user.email "bot@goreleaser.com" + git config user.name "Floatpane Bot" + git config user.email "us@floatpane.com" git add matcha-nightly.rb git diff --cached --quiet || (git commit -m "Update matcha-nightly to $VERSION" && git push) + - name: Update Nix flake tap + env: + GH_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} + run: | + VERSION="nightly-$(git rev-parse --short HEAD)" + DARWIN_AMD64_SHA=$(shasum -a 256 dist/matcha_nightly_darwin_amd64.tar.gz | cut -d ' ' -f 1) + DARWIN_ARM64_SHA=$(shasum -a 256 dist/matcha_nightly_darwin_arm64.tar.gz | cut -d ' ' -f 1) + LINUX_AMD64_SHA=$(shasum -a 256 dist/matcha_nightly_linux_amd64.tar.gz | cut -d ' ' -f 1) + LINUX_ARM64_SHA=$(shasum -a 256 dist/matcha_nightly_linux_arm64.tar.gz | cut -d ' ' -f 1) + BASE_URL="https://github.com/floatpane/matcha/releases/download/nightlyv0" + + # Convert hex sha256 to nix SRI base64 form + to_sri() { printf 'sha256-%s' "$(printf '%s' "$1" | xxd -r -p | base64)"; } + DARWIN_AMD64_SRI=$(to_sri "$DARWIN_AMD64_SHA") + DARWIN_ARM64_SRI=$(to_sri "$DARWIN_ARM64_SHA") + LINUX_AMD64_SRI=$(to_sri "$LINUX_AMD64_SHA") + LINUX_ARM64_SRI=$(to_sri "$LINUX_ARM64_SHA") + + mkdir -p /tmp/nix-pkg + cat > /tmp/nix-pkg/default.nix << EOF + { stdenvNoCC, fetchurl, lib }: + let + sources = { + x86_64-darwin = { + url = "$BASE_URL/matcha_nightly_darwin_amd64.tar.gz"; + hash = "$DARWIN_AMD64_SRI"; + }; + aarch64-darwin = { + url = "$BASE_URL/matcha_nightly_darwin_arm64.tar.gz"; + hash = "$DARWIN_ARM64_SRI"; + }; + x86_64-linux = { + url = "$BASE_URL/matcha_nightly_linux_amd64.tar.gz"; + hash = "$LINUX_AMD64_SRI"; + }; + aarch64-linux = { + url = "$BASE_URL/matcha_nightly_linux_arm64.tar.gz"; + hash = "$LINUX_ARM64_SRI"; + }; + }; + src = sources.\${stdenvNoCC.hostPlatform.system} + or (throw "matcha-nightly: unsupported system \${stdenvNoCC.hostPlatform.system}"); + in + stdenvNoCC.mkDerivation { + pname = "matcha-nightly"; + version = "$VERSION"; + src = fetchurl src; + sourceRoot = "."; + installPhase = '' + runHook preInstall + install -Dm755 matcha \$out/bin/matcha + runHook postInstall + ''; + meta = { + description = "Beautiful and functional email client for the terminal (nightly)"; + homepage = "https://matcha.email"; + license = lib.licenses.mit; + mainProgram = "matcha"; + platforms = builtins.attrNames sources; + }; + } + EOF + + cat > /tmp/nix-pkg/flake.nix << 'EOF' + { + description = "matcha email client — nightly"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + outputs = { self, nixpkgs }: + let + systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forAll = nixpkgs.lib.genAttrs systems; + in { + packages = forAll (system: { + default = nixpkgs.legacyPackages.${system}.callPackage ./default.nix { }; + }); + }; + } + EOF + + git clone "https://x-access-token:${GH_TOKEN}@github.com/floatpane/nix-matcha.git" /tmp/nix-matcha + cd /tmp/nix-matcha + git checkout nightly 2>/dev/null || git checkout -b nightly + mkdir -p nightly + cp /tmp/nix-pkg/default.nix nightly/default.nix + cp /tmp/nix-pkg/flake.nix nightly/flake.nix + git config user.name "Floatpane Bot" + git config user.email "us@floatpane.com" + git add nightly/default.nix nightly/flake.nix + git diff --cached --quiet || (git commit -m "matcha-nightly: bump to $VERSION" && git push -u origin nightly) + snapcraft: runs-on: ${{ matrix.runner }} needs: nightly diff --git a/.github/workflows/nixpkgs-bump.yml b/.github/workflows/nixpkgs-bump.yml new file mode 100644 index 00000000..3ef38d7f --- /dev/null +++ b/.github/workflows/nixpkgs-bump.yml @@ -0,0 +1,174 @@ +name: Nixpkgs Bump PR + +# Triggers on stable release publish. Opens PR against NixOS/nixpkgs +# bumping pkgs/by-name/ma/matcha/package.nix to the new version. +# Requires: +# - Fork floatpane/nixpkgs to exist +# - NIXPKGS_BUMP_TOKEN secret: PAT with `repo` scope on floatpane/nixpkgs +# and permission to open PRs against NixOS/nixpkgs +# - Initial matcha package already merged into nixpkgs (this workflow updates, not inits) + +on: + release: + types: [published] + workflow_dispatch: + inputs: + version: + description: "Version to bump to (without v prefix)" + required: true + +permissions: + contents: read + +jobs: + bump: + runs-on: ubuntu-latest + steps: + - name: Determine version + id: ver + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + VERSION="${{ inputs.version }}" + else + TAG="${{ github.event.release.tag_name }}" + VERSION="${TAG#v}" + fi + # Skip nightly / preview tags + if [[ "$VERSION" == nightly* || "$VERSION" == preview* ]]; then + echo "Skipping non-stable release: $VERSION" + echo "skip=true" >> $GITHUB_OUTPUT + else + echo "skip=false" >> $GITHUB_OUTPUT + fi + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Install Nix + if: steps.ver.outputs.skip != 'true' + uses: cachix/install-nix-action@v30 + with: + extra_nix_config: | + experimental-features = nix-command flakes + + - name: Checkout nixpkgs fork + if: steps.ver.outputs.skip != 'true' + uses: actions/checkout@v6 + with: + repository: floatpane/nixpkgs + token: ${{ secrets.NIXPKGS_BUMP_TOKEN }} + path: nixpkgs + fetch-depth: 0 + + - name: Sync fork with upstream master + if: steps.ver.outputs.skip != 'true' + working-directory: nixpkgs + run: | + git config user.name "Floatpane Bot" + git config user.email "us@floatpane.com" + git remote add upstream https://github.com/NixOS/nixpkgs.git + git fetch upstream master + git checkout master + git reset --hard upstream/master + git push origin master --force-with-lease + + - name: Create bump branch + if: steps.ver.outputs.skip != 'true' + working-directory: nixpkgs + run: | + BRANCH="matcha-${{ steps.ver.outputs.version }}" + git checkout -b "$BRANCH" + echo "BRANCH=$BRANCH" >> $GITHUB_ENV + + - name: Get current version + if: steps.ver.outputs.skip != 'true' + id: current + working-directory: nixpkgs + run: | + PKG=pkgs/by-name/ma/matcha/package.nix + OLD=$(grep -E '^\s*version\s*=\s*"' "$PKG" | head -1 | sed -E 's/.*"([^"]+)".*/\1/') + echo "old=$OLD" >> $GITHUB_OUTPUT + + - name: Bump version and reset hashes + if: steps.ver.outputs.skip != 'true' + working-directory: nixpkgs + run: | + PKG=pkgs/by-name/ma/matcha/package.nix + NEW="${{ steps.ver.outputs.version }}" + # Replace version line + sed -i -E "s/(version\s*=\s*\")[^\"]+(\")/\1$NEW\2/" "$PKG" + # Reset src hash + vendorHash to fakeHash so nix build prints real ones + sed -i -E 's|hash = "sha256-[A-Za-z0-9+/=]+"|hash = lib.fakeHash|' "$PKG" + sed -i -E 's|vendorHash = "sha256-[A-Za-z0-9+/=]+"|vendorHash = lib.fakeHash|' "$PKG" + + - name: Build to extract src hash + if: steps.ver.outputs.skip != 'true' + id: src_hash + working-directory: nixpkgs + run: | + set +e + OUT=$(nix-build -A matcha --no-out-link 2>&1) + RC=$? + echo "$OUT" + HASH=$(echo "$OUT" | grep -A1 "got:" | tail -1 | tr -d ' ') + if [ -z "$HASH" ]; then + echo "Failed to extract src hash"; exit 1 + fi + echo "hash=$HASH" >> $GITHUB_OUTPUT + sed -i -E "s|hash = lib.fakeHash|hash = \"$HASH\"|" pkgs/by-name/ma/matcha/package.nix + + - name: Build to extract vendorHash + if: steps.ver.outputs.skip != 'true' + working-directory: nixpkgs + run: | + set +e + OUT=$(nix-build -A matcha --no-out-link 2>&1) + RC=$? + echo "$OUT" + HASH=$(echo "$OUT" | grep -A1 "got:" | tail -1 | tr -d ' ') + if [ -z "$HASH" ]; then + echo "Failed to extract vendorHash"; exit 1 + fi + sed -i -E "s|vendorHash = lib.fakeHash|vendorHash = \"$HASH\"|" pkgs/by-name/ma/matcha/package.nix + + - name: Final build (sanity check) + if: steps.ver.outputs.skip != 'true' + working-directory: nixpkgs + run: nix-build -A matcha --no-out-link + + - name: Commit and push + if: steps.ver.outputs.skip != 'true' + working-directory: nixpkgs + run: | + git add pkgs/by-name/ma/matcha/package.nix + git commit -m "matcha: ${{ steps.current.outputs.old }} -> ${{ steps.ver.outputs.version }}" + git push -u origin "$BRANCH" --force-with-lease + + - name: Open PR against NixOS/nixpkgs + if: steps.ver.outputs.skip != 'true' + env: + GH_TOKEN: ${{ secrets.NIXPKGS_BUMP_TOKEN }} + working-directory: nixpkgs + run: | + BODY=$(cat < ${{ steps.ver.outputs.version }}" \ + --body "$BODY" diff --git a/.goreleaser.yml b/.goreleaser.yml index 0933d874..8d8ee391 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -100,9 +100,31 @@ release: # Add a footer to the release notes featuring full changelog. footer: | --- - This version is also available on **[Snapcraft](https://snapcraft.io/matcha)**, **Homebrew**, **[Flatpak](https://matcha.floatpane.com/matcha.flatpakref)**! + This version is also available on **[Snapcraft](https://snapcraft.io/matcha)**, **Homebrew**, **[Flatpak](https://matcha.email/matcha.flatpakref)**! - View the [installation instructions](https://docs.matcha.floatpane.com/installation) for more details. + View the [installation instructions](https://docs.matcha.email/installation) for more details. + +# 'nix' configures the Nix flake publication. +# Generates a default.nix per release fetching prebuilt tarballs, +# pushes to floatpane/nix-matcha. Users install with: +# nix profile install github:floatpane/nix-matcha +nix: + - name: matcha + repository: + owner: floatpane + name: nix-matcha + branch: main + token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" + commit_author: + name: Floatpane Bot + email: us@floatpane.com + commit_msg_template: "matcha: bump to {{ .Tag }}" + homepage: "https://matcha.email" + description: "Beautiful and functional email client for the terminal" + license: "mit" + install: | + mkdir -p $out/bin + cp -vr ./matcha $out/bin/matcha # 'brews' configures the Homebrew tap integration. brews: @@ -119,13 +141,13 @@ brews: # The commit author for the tap update. commit_author: - name: goreleaserbot - email: bot@goreleaser.com + name: Floatpane Bot + email: us@floatpane.com # A description for your formula. description: "A beautiful and functional email client for your terminal." # The homepage URL for your formula. - homepage: "https://matcha.floatpane.com" + homepage: "https://matcha.email" # The dependencies for your formula. # Since it's a pre-compiled binary, there are no runtime dependencies. @@ -148,7 +170,7 @@ winget: package_identifier: floatpane.matcha # WinGet publisher metadata. publisher: floatpane - publisher_url: "https://matcha.floatpane.com" + publisher_url: "https://matcha.email" publisher_support_url: "https://github.com/floatpane/matcha/issues" # Package metadata. @@ -156,7 +178,7 @@ winget: description: | A beautiful and functional email client for your terminal, built with Go and the charming Bubble Tea TUI library. Never leave your command line to check your inbox or send an email again! - homepage: "https://matcha.floatpane.com" + homepage: "https://matcha.email" license: MIT tags: - email diff --git a/README.md b/README.md index 468ac053..0a276abf 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ ### Plugin Marketplace -Matcha has a built-in plugin system with 35+ community plugins. Browse and install them from the terminal or the [online marketplace](https://docs.matcha.floatpane.com/marketplace). +Matcha has a built-in plugin system with 35+ community plugins. Browse and install them from the terminal or the [online marketplace](https://docs.matcha.email/marketplace). ```bash matcha marketplace # browse plugins in the TUI @@ -36,7 +36,7 @@ matcha install # install a plugin matcha config # configure an installed plugin ``` -Anyone can submit their own plugin — just add an entry to `plugins/registry.json` and open a PR. [Learn more](https://docs.matcha.floatpane.com/Features/Plugins#submit-your-plugin) +Anyone can submit their own plugin — just add an entry to `plugins/registry.json` and open a PR. [Learn more](https://docs.matcha.email/Features/Plugins#submit-your-plugin) ### AI Integration @@ -46,15 +46,15 @@ Anyone can submit their own plugin — just add an entry to `plugins/registry.js matcha send --to alice@example.com --subject "Hello" --body "Sent by my AI agent" ``` -[Learn more](https://docs.matcha.floatpane.com/Features/AI_AGENTS) +[Learn more](https://docs.matcha.email/Features/AI_AGENTS) **AI Rewrite Plugin:** Matcha includes an AI rewrite plugin that allows you to rewrite your email drafts using OpenAI, Ollama, Gemini, or Claude. -[Setup Guide](https://docs.matcha.floatpane.com/setup-guides/ai-rewrite) +[Setup Guide](https://docs.matcha.email/setup-guides/ai-rewrite) ## Documentation -Matcha Documention is available on [our website](https://docs.matcha.floatpane.com) +Matcha Documention is available on [our website](https://docs.matcha.email) ## Star History diff --git a/docs/docs/Features/CLI.md b/docs/docs/Features/CLI.md index bfc29445..047026fa 100644 --- a/docs/docs/Features/CLI.md +++ b/docs/docs/Features/CLI.md @@ -98,7 +98,7 @@ matcha marketplace Use `j/k` or arrow keys to navigate, `Enter` to install a plugin, and `q` to quit. Installed plugins are marked with an `[installed]` badge. -You can also access the marketplace from Matcha's main menu, or browse the [online marketplace](https://docs.matcha.floatpane.com/marketplace). +You can also access the marketplace from Matcha's main menu, or browse the [online marketplace](https://docs.matcha.email/marketplace). ## matcha install diff --git a/docs/docs/installation.md b/docs/docs/installation.md index f550fd7d..e3e7b658 100644 --- a/docs/docs/installation.md +++ b/docs/docs/installation.md @@ -68,7 +68,7 @@ sudo snap install matcha You can install Matcha via Flatpak using the following command: ```bash -flatpak install https://matcha.floatpane.com/matcha.flatpakref +flatpak install https://matcha.email/matcha.flatpakref ``` ### AUR (Arch Linux) (unofficial) diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index 5384991e..008141c8 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -8,7 +8,7 @@ const config: Config = { "A modern, beautiful, and feature-rich email client for the terminal.", favicon: "img/favicon.ico", - url: "https://docs.matcha.floatpane.com", + url: "https://docs.matcha.email", baseUrl: "/", organizationName: "floatpane", diff --git a/i18n/README.md b/i18n/README.md index 44578744..aa239b19 100644 --- a/i18n/README.md +++ b/i18n/README.md @@ -606,4 +606,4 @@ Always keep variables unchanged: --- -**For more details on using translations in code, see:** [Documentation](https://docs.matcha.floatpane.com/localization). +**For more details on using translations in code, see:** [Documentation](https://docs.matcha.email/localization). diff --git a/nix/maintainer-entry.nix b/nix/maintainer-entry.nix new file mode 100644 index 00000000..edf9f517 --- /dev/null +++ b/nix/maintainer-entry.nix @@ -0,0 +1,13 @@ + # Paste this block into nixpkgs/maintainers/maintainer-list.nix + # at the correct alphabetical position (between `andresilva` and `andrew-d` + # or wherever `andr*` lands when you check the file). + # + # The key (`andrinoff`) must match `meta.maintainers = [ andrinoff ];` + # in pkgs/by-name/ma/matcha/package.nix. + + andrinoff = { + name = "Drew Smirnoff"; + email = "me@andrinoff.com"; + github = "andrinoff"; + githubId = 175145001; + }; diff --git a/nix/nixpkgs-package.nix b/nix/nixpkgs-package.nix new file mode 100644 index 00000000..dd9b47c0 --- /dev/null +++ b/nix/nixpkgs-package.nix @@ -0,0 +1,61 @@ +{ + lib, + buildGoModule, + fetchFromGitHub, + pkg-config, + pcsclite, + stdenv, + apple-sdk_15, + nix-update-script, + versionCheckHook, +}: + +buildGoModule (finalAttrs: { + __structuredAttrs = true; + + pname = "matcha"; + version = "0.37.0"; + + src = fetchFromGitHub { + owner = "floatpane"; + repo = "matcha"; + tag = "v${finalAttrs.version}"; + hash = lib.fakeHash; + }; + + vendorHash = lib.fakeHash; + proxyVendor = true; + + nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ + pkg-config + ]; + + buildInputs = + lib.optionals stdenv.hostPlatform.isLinux [ pcsclite ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_15 ]; + + env.CGO_ENABLED = 1; + + ldflags = [ + "-s" + "-w" + "-X main.version=${finalAttrs.version}" + "-X main.date=1970-01-01T00:00:00Z" + ]; + + nativeInstallCheckInputs = [ versionCheckHook ]; + doInstallCheck = true; + versionCheckProgramArg = "--version"; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Beautiful and functional email client for the terminal"; + homepage = "https://matcha.email"; + changelog = "https://github.com/floatpane/matcha/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.mit; + mainProgram = "matcha"; + maintainers = with lib.maintainers; [ andrinoff ]; + platforms = lib.platforms.darwin ++ lib.platforms.linux; + }; +}) diff --git a/plugins/README.md b/plugins/README.md index 687f59d9..b29e5db4 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -50,7 +50,7 @@ Anyone can add their plugin to the marketplace by submitting a PR to this reposi ### Steps -1. **Write your plugin** as a `.lua` file following the [Plugin API docs](https://docs.matcha.floatpane.com/Features/Plugins). +1. **Write your plugin** as a `.lua` file following the [Plugin API docs](https://docs.matcha.email/Features/Plugins). 2. **Add an entry to `registry.json`** in this directory: @@ -90,4 +90,4 @@ Anyone can add their plugin to the marketplace by submitting a PR to this reposi ## Browsing Online -Visit the [Plugin Marketplace](https://docs.matcha.floatpane.com/marketplace) on the Matcha documentation site to browse all available plugins with one-line install commands. +Visit the [Plugin Marketplace](https://docs.matcha.email/marketplace) on the Matcha documentation site to browse all available plugins with one-line install commands. diff --git a/public/components/site.jsx b/public/components/site.jsx index 6191c21e..398462e6 100644 --- a/public/components/site.jsx +++ b/public/components/site.jsx @@ -63,7 +63,7 @@ function TopNav() { Features Keybinds Install - Docs ↗ + Docs ↗ GitHub {stars && ★ {stars}} @@ -103,7 +103,7 @@ function Hero({ datasetKey, setDatasetKey }) { Install - + Read the docs @@ -336,11 +336,8 @@ function Keybinds() {

Every binding is documented at{" "} - - docs.matcha.floatpane.com + + docs.matcha.email . Muscle-memory for vimmers, learnable for everyone else.

@@ -377,7 +374,7 @@ const INSTALL_TABS = { snap: { plat: "Ubuntu · Linux", cmd: "$ sudo snap install matcha\n$ matcha" }, flatpak: { plat: "Linux", - cmd: "$ flatpak install https://matcha.floatpane.com/matcha.flatpakref\n$ matcha", + cmd: "$ flatpak install https://matcha.email/matcha.flatpakref\n$ matcha", }, aur: { plat: "Arch Linux", cmd: "$ yay -S matcha-client-bin\n$ matcha" }, nix: { @@ -482,10 +479,7 @@ function CTA() { make your emails secure - + read the docs → @@ -516,9 +510,9 @@ function Footer() {
resources
- docs - config - cli + docs + config + cli security diff --git a/public/matcha.flatpakref b/public/matcha.flatpakref index c9ba36f7..2c9f1225 100644 --- a/public/matcha.flatpakref +++ b/public/matcha.flatpakref @@ -3,5 +3,5 @@ Name=com.floatpane.matcha Branch=master Title=Matcha IsRuntime=False -Url=https://matcha.floatpane.com/repo/ +Url=https://matcha.email/repo/ SuggestRemoteName=matcha