Skip to content

feat: integrate crane library and enhance Rust build configuration#633

Open
arunabha003 wants to merge 8 commits intoGaloyMoney:mainfrom
arunabha003:nixify-rust-compilation
Open

feat: integrate crane library and enhance Rust build configuration#633
arunabha003 wants to merge 8 commits intoGaloyMoney:mainfrom
arunabha003:nixify-rust-compilation

Conversation

@arunabha003
Copy link
Copy Markdown

@arunabha003 arunabha003 commented Jun 22, 2025

This PR integrates the Crane library into Bria’s Nix setup and strengthens the Rust build/check pipeline around reproducible package builds and repository-level checks.

Implemented in this PR:

  • added Crane as a flake input
  • expanded flake.nix to build Rust dependencies separately and then build the package via Crane
  • introduced package/check outputs for the Rust project in Nix
  • wired in repo-level checks such as formatting, clippy, and audit within the Nix build flow
  • updated Makefile and build.rs-related configuration to fit the new build path

@krtk6160
Copy link
Copy Markdown
Member

I'm unable to build the binary, logs below:

➜  bria git:(nixify-rust-compilation) nix build .
warning: 'https://lana-ci-test1.cachix.org' does not appear to be a binary cache
error: builder for '/nix/store/j8vcmzanl4pgidkccd77m20ydxmcldiz-bria-deps-deps-0.0.0.drv' failed with exit code 101;
       last 10 log lines:
       >   Unable to update https://github.com/HyperparamAI/sqlxmq?rev=52c3daf6af55416aefa4b1114e108f968f6c57d4#52c3daf6
       >
       > Caused by:
       >   failed to clone into: /build/source/.cargo-home/git/db/sqlxmq-325889b2be0d66a3
       >
       > Caused by:
       >   revision 52c3daf6af55416aefa4b1114e108f968f6c57d4 not found
       >
       > Caused by:
       >   process didn't exit successfully: `git fetch --no-tags --force --update-head-ok 'https://github.com/HyperparamAI/sqlxmq' '+52c3daf6af55416aefa4b1114e108f968f6c57d4:refs/commit/52c3daf6af55416aefa4b1114e108f968f6c57d4'` (exit status: 128)
       For full logs, run 'nix log /nix/store/j8vcmzanl4pgidkccd77m20ydxmcldiz-bria-deps-deps-0.0.0.drv'.
error: 1 dependencies of derivation '/nix/store/n37cwqrgrai8r1b7lzj5bvdk3rgs27zi-bria-0.1.114-dev.drv' failed to build

Comment thread Makefile Outdated
local-daemon:
SIGNER_ENCRYPTION_KEY="0000000000000000000000000000000000000000000000000000000000000000" \
cargo run --bin bria daemon --config ./bats/bria.local.yml run
cargo run --bin bria daemon --config ./bats/bria.local.yml run
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.

should this not be using nix now ?

@krtk6160
Copy link
Copy Markdown
Member

I'm unable to build the binary, logs below:

➜  bria git:(nixify-rust-compilation) nix build .
warning: 'https://lana-ci-test1.cachix.org' does not appear to be a binary cache
error: builder for '/nix/store/j8vcmzanl4pgidkccd77m20ydxmcldiz-bria-deps-deps-0.0.0.drv' failed with exit code 101;
       last 10 log lines:
       >   Unable to update https://github.com/HyperparamAI/sqlxmq?rev=52c3daf6af55416aefa4b1114e108f968f6c57d4#52c3daf6
       >
       > Caused by:
       >   failed to clone into: /build/source/.cargo-home/git/db/sqlxmq-325889b2be0d66a3
       >
       > Caused by:
       >   revision 52c3daf6af55416aefa4b1114e108f968f6c57d4 not found
       >
       > Caused by:
       >   process didn't exit successfully: `git fetch --no-tags --force --update-head-ok 'https://github.com/HyperparamAI/sqlxmq' '+52c3daf6af55416aefa4b1114e108f968f6c57d4:refs/commit/52c3daf6af55416aefa4b1114e108f968f6c57d4'` (exit status: 128)
       For full logs, run 'nix log /nix/store/j8vcmzanl4pgidkccd77m20ydxmcldiz-bria-deps-deps-0.0.0.drv'.
error: 1 dependencies of derivation '/nix/store/n37cwqrgrai8r1b7lzj5bvdk3rgs27zi-bria-0.1.114-dev.drv' failed to build

@arunabha003 I think I found the reason for the error above. I am running nix in a sandboxed mode, and network access is disabled during the build phase. Maybe sandboxed mode is set to false on your system. Can you share the output of nix-info -m?

@arunabha003
Copy link
Copy Markdown
Author

Arunabhas-MacBook-Air:bria arunabha003$ nix run nixpkgs#nix-info -- -m
 - system: `"aarch64-darwin"`
 - host os: `Darwin 24.5.0, macOS 15.5`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Determinate Nix 3.5.2) 2.28.3`
 - nixpkgs: `/nix/store/9g7vwfbsk7hcp12vrm8a82cnv6y9v8fb-source`
 

Yes the Sandbox mode appears to be set false in my system...Should I try to make it true?

Comment thread Makefile Outdated
Comment on lines +55 to +64

nix-shell:
nix develop

nix-show:
nix flake show

# Run the application
run:
nix run
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can remove these three targets

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed

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.

3 participants