diff options
| author | 2026-05-29 11:18:16 +0100 | |
|---|---|---|
| committer | 2026-05-29 11:18:16 +0100 | |
| commit | be3c6fda881bc11d5123d6b3a09ce9d250199b32 (patch) | |
| tree | 9a74f50304acaf4173bfb32dcf126bca7fc852d5 | |
| parent | cd1c92b746a51a6994281f34a5f773c37d1d2dfe (diff) | |
| download | dotfiles-be3c6fda881bc11d5123d6b3a09ce9d250199b32.tar.gz dotfiles-be3c6fda881bc11d5123d6b3a09ce9d250199b32.tar.bz2 dotfiles-be3c6fda881bc11d5123d6b3a09ce9d250199b32.zip | |
refactor(eer): install external-editor-revived via nix on the host
The AUR `external-editor-revived` PKGBUILD declares a hard `thunderbird`
dependency, which blocks removing the unused system Thunderbird binary
alongside the org.mozilla.thunderbird flatpak (and pacman's
`AssumeInstalled` is a CLI flag, not a pacman.conf directive, so the
previous workaround was nonfunctional).
Nixpkgs' `external-editor-revived` is just `rustPlatform.buildRustPackage`
plus a relocatable native-messaging manifest — zero mailer dep — so the
host gets it from nix instead.
* nix/host.nix: add `external-editor-revived` to `home.packages`. Kept
out of `common.nix` so the remote-dev VM (which has no Thunderbird)
doesn't carry the build closure.
* run_onchange_after_deploy-tb-eer.sh.tmpl: search
`~/.nix-profile/{bin,lib/mozilla/native-messaging-hosts}` first and
fall through to the legacy pacman paths. The chezmoi manifest-hash
probe now checks the nix path too, so the hook re-runs cleanly when
nix bumps the EER version.
* meta/base.txt: drop the `external-editor-revived` AUR entry and
rewrite the comment to point at the nix declaration.
* etc/pacman.conf: revert the bogus `AssumeInstalled` directive
(CLI-only, not pacman.conf).
On-host migration:
home-manager switch --flake ~/dotfiles/nix#host # picks up EER
sudo pacman -Rns external-editor-revived thunderbird mpv
chezmoi apply -v # re-runs tb-eer hook
| -rw-r--r-- | etc/pacman.conf | 6 | ||||
| -rw-r--r-- | meta/base.txt | 10 | ||||
| -rw-r--r-- | nix/host.nix | 13 | ||||
| -rw-r--r-- | run_onchange_after_deploy-tb-eer.sh.tmpl | 28 |
4 files changed, 38 insertions, 19 deletions
diff --git a/etc/pacman.conf b/etc/pacman.conf index a2cba6c..7097940 100644 --- a/etc/pacman.conf +++ b/etc/pacman.conf @@ -27,12 +27,6 @@ Architecture = auto IgnorePkg = llama.cpp-vulkan #IgnoreGroup = -# external-editor-revived (AUR) hard-depends on `thunderbird`, but we run -# Thunderbird as the org.mozilla.thunderbird flatpak instead. Tell pacman to -# pretend the system thunderbird package is installed so the dep is satisfied -# without pulling in the binary. Version is arbitrary — only the name matches. -AssumeInstalled = thunderbird=999.0-1 - #NoUpgrade = #NoExtract = diff --git a/meta/base.txt b/meta/base.txt index a226674..f77b85b 100644 --- a/meta/base.txt +++ b/meta/base.txt @@ -195,12 +195,10 @@ protonmail-bridge-core perl-authen-sasl perl-mime-tools perl-net-smtp-ssl -# Native messaging host binary for External Editor Revived; bridged into -# the TB flatpak by run_onchange_after_deploy-tb-eer.sh.tmpl. -# Pulls `thunderbird` as a hard dep, which we don't want (we use the -# org.mozilla.thunderbird flatpak); pacman.conf's AssumeInstalled rule -# pretends thunderbird is installed so this resolves without the package. -external-editor-revived +# (External Editor Revived's native-messaging host is installed via nix +# on the host — see nix/host.nix — so we don't pay the AUR variant's +# hard `thunderbird` dependency. The bridge into the TB flatpak is +# wired up by run_onchange_after_deploy-tb-eer.sh.tmpl.) # --- media (mpv is the io.mpv.Mpv flatpak in meta/flatpak.txt; streamlink # and yt-dlp run on the host and pipe/launch into the flatpak mpv via diff --git a/nix/host.nix b/nix/host.nix index eac2a20..96adfba 100644 --- a/nix/host.nix +++ b/nix/host.nix @@ -13,6 +13,19 @@ home.username = builtins.getEnv "USER"; home.homeDirectory = builtins.getEnv "HOME"; + # ── Thunderbird helpers (host only) ──────────────────────────────────────── + # external-editor-revived is the native-messaging host that lets the + # Thunderbird addon hand a composing draft to $EDITOR. We run TB as the + # org.mozilla.thunderbird flatpak; the AUR package would drag in system + # `thunderbird` as a hard dep, so we take it from nixpkgs here instead + # (the nix derivation has no mailer dep). The bridge wiring lives in + # run_onchange_after_deploy-tb-eer.sh.tmpl; it auto-detects the binary + # under ~/.nix-profile and the manifest gets relocated into the TB + # flatpak sandbox. + home.packages = with pkgs; [ + external-editor-revived + ]; + # ── Smartcard (Yubikey) ──────────────────────────────────────────────────── # Nix's gnupg ships its own scdaemon. Delegate to the system pcscd # service instead of letting nix's scdaemon open the USB device diff --git a/run_onchange_after_deploy-tb-eer.sh.tmpl b/run_onchange_after_deploy-tb-eer.sh.tmpl index 6a7690e..27f1fef 100644 --- a/run_onchange_after_deploy-tb-eer.sh.tmpl +++ b/run_onchange_after_deploy-tb-eer.sh.tmpl @@ -8,20 +8,34 @@ # Idempotent. Re-runs on script changes or whenever the host-side manifest # content changes. # -# host manifest hash: {{ output "sh" "-c" "for p in /usr/lib/mozilla/native-messaging-hosts/external_editor_revived.json /usr/lib/thunderbird/native-messaging-hosts/external_editor_revived.json; do [ -f \"$p\" ] && sha256sum \"$p\" && break; done; true" | sha256sum }} +# host manifest hash: {{ output "sh" "-c" "for p in $HOME/.nix-profile/lib/mozilla/native-messaging-hosts/external_editor_revived.json /usr/lib/mozilla/native-messaging-hosts/external_editor_revived.json /usr/lib/thunderbird/native-messaging-hosts/external_editor_revived.json; do [ -f \"$p\" ] && sha256sum \"$p\" && break; done; true" | sha256sum }} set -eu TB_APP=org.mozilla.thunderbird MANIFEST_NAME=external_editor_revived.json WRAPPER_NAME=external_editor_revived.sh -HOST_BINARY=/usr/lib/external-editor-revived/external-editor-revived + +# Locate the EER binary. nixpkgs is the preferred source (see nix/host.nix) +# because it has no thunderbird dep; the AUR package is the fallback for +# hosts where nix isn't set up yet. +HOST_BINARY= +for candidate in \ + "$HOME/.nix-profile/bin/external-editor-revived" \ + /usr/lib/external-editor-revived/external-editor-revived \ + /usr/bin/external-editor-revived; do + if [ -x "$candidate" ]; then + HOST_BINARY=$candidate + break + fi +done flatpak info --user "$TB_APP" >/dev/null 2>&1 || exit 0 -# Locate the host-side manifest. Different PKGBUILDs have used different -# install dirs; prefer the canonical mozilla path, fall back to TB-specific. +# Locate the host-side manifest. Different packagings (nix, AUR variants) +# use different install dirs; check the common ones. HOST_MANIFEST= for candidate in \ + "$HOME/.nix-profile/lib/mozilla/native-messaging-hosts/$MANIFEST_NAME" \ /usr/lib/mozilla/native-messaging-hosts/$MANIFEST_NAME \ /usr/lib/thunderbird/native-messaging-hosts/$MANIFEST_NAME \ /usr/lib64/mozilla/native-messaging-hosts/$MANIFEST_NAME; do @@ -31,12 +45,12 @@ for candidate in \ fi done [ -n "$HOST_MANIFEST" ] || { - echo "tb-eer: external-editor-revived manifest not found on host; install the package or skip TB native editor." >&2 + echo "tb-eer: external-editor-revived manifest not found on host; install via nix (host.nix) or skip TB native editor." >&2 exit 0 } -[ -x "$HOST_BINARY" ] || { - echo "tb-eer: $HOST_BINARY not executable on host; skipping." >&2 +[ -n "$HOST_BINARY" ] || { + echo "tb-eer: external-editor-revived binary not found on host; install via nix (host.nix) or skip TB native editor." >&2 exit 0 } |
