Skip to content

fix(nix): build from source instead of wrapping AppImage#778

Merged
cjpais merged 2 commits intocjpais:mainfrom
y0usaf:fix/nix-native-build
Feb 11, 2026
Merged

fix(nix): build from source instead of wrapping AppImage#778
cjpais merged 2 commits intocjpais:mainfrom
y0usaf:fix/nix-native-build

Conversation

@y0usaf
Copy link
Copy Markdown
Contributor

@y0usaf y0usaf commented Feb 10, 2026

Before Submitting This PR

Please confirm you have done the following:

Human Written Description

I've been happy with the previous implementation but it wasn't robust and there were requests for building from source, so here it is :)

Related Issues/Discussions

Fixes #701

Community Feedback

Issue #701 has multiple users reporting the hash mismatch problem. The maintainer expressed support for a native build approach in the issue comments.

Testing

  • nix build .#handy builds from source successfully
  • result/bin/handy produces a working wrapped binary with all resources bundled
  • ldd confirms all shared libraries resolve to Nix store paths
  • nix develop devShell still works as before

Screenshots/Videos (if applicable)

N/A

AI Assistance

  • No AI was used in this PR
  • AI was used (please describe below)

If AI was used:

  • Tools used: Claude Code
  • How extensively: AI wrote the flake.nix changes and iterated through build failures to resolve dependency hashes, sandbox issues, and build script incompatibilities. Human reviewed and directed approach.

Replace the AppImage-based Nix package with a native from-source build
using cargo-tauri.hook + rustPlatform.buildRustPackage. This eliminates
the recurring hash mismatch failures when releases update the binary.

- Build frontend (bun) and backend (cargo tauri) from source
- Vendor JS deps as a fixed-output derivation
- Patch libappindicator-sys for Nix store path
- Patch ferrous-opencc to skip cbindgen (upstream removed in v0.3.1+)
- Wrap binary with WEBKIT_DISABLE_DMABUF_RENDERER and LD_LIBRARY_PATH
- Delete update-flake-hash.yml workflow (no longer needed)
- devShell unchanged
@cjpais
Copy link
Copy Markdown
Owner

cjpais commented Feb 11, 2026

Thanks for this, I'm going to merge it. If there's any other issues we'll continue to fix them as users say. Thank you so much for your contributions!

@cjpais cjpais merged commit c34e7d5 into cjpais:main Feb 11, 2026
4 checks passed
Copy link
Copy Markdown
Contributor

@pinage404 pinage404 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm, that it works as before =)

homepage = "https://github.com/cjpais/Handy";
license = lib.licenses.mit;
mainProgram = "handy";
platforms = [ "x86_64-linux" ];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pkg-config
wrapGAppsHook4
bun
nodejs
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need NPM

Suggested change
nodejs
nodejs-slim

I'm even surprised that Node is needed beside Bun

'';

preBuild = ''
cp -r ${bunDeps}/node_modules node_modules
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Node dependency can be removed with this

Suggested change
cp -r ${bunDeps}/node_modules node_modules
cp -r ${bunDeps}/node_modules node_modules
substituteInPlace node_modules/.bin/{tsc,vite} \
--replace-fail "/usr/bin/env node" "${lib.getExe bun}"

chmod -R +w node_modules
patchShebangs node_modules
export HOME=$TMPDIR
${pkgs.bun}/bin/bun run build
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bun has been added to nativeBuildInputs maybe the absolute path is not necessary

Suggested change
${pkgs.bun}/bin/bun run build
bun run build

${pkgs.bun}/bin/bun run build
'';

doCheck = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the tests skipped ?

cjpais pushed a commit that referenced this pull request Feb 13, 2026
- Replace patchShebangs with targeted substituteInPlace for tsc/vite
  shebangs, pointing them to bun instead of node
- Use `bun run build` instead of `${pkgs.bun}/bin/bun run build`
  since bun is already in nativeBuildInputs
- Remove nodejs from nativeBuildInputs (no longer needed)
- Add comment explaining why doCheck is disabled
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.

Nix flake hash mismatch for AppImage v0.7.1

3 participants