Skip to content

packaging(nix): ship desktop as a prebuilt binary (download, no compile)#211

Merged
adibhanna merged 1 commit into
mainfrom
nix/prebuilt-desktop
Jun 19, 2026
Merged

packaging(nix): ship desktop as a prebuilt binary (download, no compile)#211
adibhanna merged 1 commit into
mainfrom
nix/prebuilt-desktop

Conversation

@adibhanna

Copy link
Copy Markdown
Contributor

The most-requested Nix ask: make nix run github:ZenNotes/zennotes download the app instead of compiling Electron from source.

This rewrites zennotes-desktop to wrap the official prebuilt ZenNotes-<ver>-linux-x64.tar.gz release artifact (fetchurl + autoPatchelfHook + wrapGAppsHook3) — the same approach the AUR and Flatpak packages use, and how nixpkgs packages prebuilt Electron apps (Slack/Discord). No Cachix/binary-cache account needed; the prebuilt binary is the download.

Changes

  • package-desktop.nix — prebuilt repackage (sourceProvenance = binaryNativeCode). Drops the SUID chrome-sandbox (can't be setuid in the Nix store → Electron uses the userns sandbox, same as the Flatpak); installs icons + .desktop from the tarball's arch-extras tree.
  • release-data.json — adds desktopHash (the tarball sha256, sha256-Y+l/bhP…, matching the AUR 63e97f…). The server still builds from source, so hash/npmDepsHash/vendorHash stay.
  • flake.nixzennotes-desktop is now x86_64-linux only (prebuilt x64); the server is the default on other systems so eval stays clean on darwin/aarch64.
  • nix-build.yml — CI builds both packages on any Nix-packaging change (we have no local Nix machine, so CI is the verification).

Verification

The Nix build check on this PR runs nix build .#zennotes-desktop .#zennotes-server. Merging only after it's green. (Runtime launch can't be tested without a NixOS box — same constraint under which the AppImage/deb/AUR/Flatpak shipped — but the lib set mirrors nixpkgs' proven prebuilt-Electron packaging.)

Trade-off

Loses the from-source build (x64-linux gets the official binary instead). The server remains from-source.

zennotes-desktop now wraps the official prebuilt ZenNotes-<ver>-linux-x64.tar.gz
release artifact (fetchurl + autoPatchelfHook + wrapGAppsHook3) instead of
building Electron from source via buildNpmPackage. This makes
`nix run github:ZenNotes/zennotes` download the same signed binary the
AppImage/deb/AUR ship rather than compiling locally — the most-requested Nix
ask. The tarball sha256 is pinned as release-data.json `desktopHash`.

- package-desktop.nix: rewritten as a binaryNativeCode repackage; drops the
  SUID chrome-sandbox so Electron uses the userns sandbox; installs icons +
  desktop entry from the tarball's arch-extras tree.
- release-data.json: add desktopHash (server still builds from source, so
  hash/npmDepsHash/vendorHash stay).
- flake.nix: desktop is x86_64-linux only now (prebuilt x64); server is the
  default elsewhere, keeping eval clean on darwin/aarch64.
- nix-build.yml: CI builds both packages on Nix-packaging changes (we have no
  local Nix machine to verify on).
@adibhanna
adibhanna merged commit 8634a8d into main Jun 19, 2026
6 checks passed
@adibhanna
adibhanna deleted the nix/prebuilt-desktop branch June 19, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant