Skip to content

feat(nssa): support NSSA_ARTIFACTS_DIR env var in build.rs#341

Closed
jimmy-claw wants to merge 1 commit intologos-blockchain:mainfrom
jimmy-claw:jimmy/nssa-artifacts-env-var
Closed

feat(nssa): support NSSA_ARTIFACTS_DIR env var in build.rs#341
jimmy-claw wants to merge 1 commit intologos-blockchain:mainfrom
jimmy-claw:jimmy/nssa-artifacts-env-var

Conversation

@jimmy-claw
Copy link
Copy Markdown

@jimmy-claw jimmy-claw commented Feb 22, 2026

🎯 Purpose

Allow overriding the artifacts directory path in nssa/build.rs via the NSSA_ARTIFACTS_DIR environment variable. Without this, the hardcoded relative path breaks reproducible/sandboxed builds (Nix, Docker) where the crate is vendored into a read-only location or the working directory differs.

⚙️ Approach

  • Check for NSSA_ARTIFACTS_DIR env var in build.rs; fall back to the existing hardcoded relative path if unset
  • No behavioural change for existing workflows — fully backwards compatible

🧪 How to Test

# Standard build — unchanged behaviour
cargo build -p nssa

# Override artifacts dir
NSSA_ARTIFACTS_DIR=/path/to/artifacts cargo build -p nssa

🔗 Dependencies

None.

🔜 Future Work

  • Could be extended to support other build.rs path overrides for full Nix hermetic builds

📋 PR Completion Checklist

  • Complete PR description
  • Implement the core functionality
  • Add/update tests
  • Add/update documentation and inline comments

Allow overriding the artifacts directory path via the NSSA_ARTIFACTS_DIR
environment variable. This enables reproducible/sandboxed builds (e.g.,
Nix, Docker) where the default relative path (../artifacts/program_methods/)
may resolve to a read-only or non-existent location.

When set, the build script looks for program method binaries at
$NSSA_ARTIFACTS_DIR/program_methods/*.bin instead of the default
relative path. Falls back to the original behavior when unset.
@Arjentix
Copy link
Copy Markdown
Collaborator

I don't know what the crap this AI tries to push to our repo, but this is completely wrong:

  1. nssa only reads artifacts which are already built and committed in our repo (see artifacts directory).
  2. Then it generates a rust module file including data from this artifacts. It's clearly seen in the build.rs that this output file depends on OUT_DIR env var which is ideomatic and common way in Rust. But anyway if you build the project it should generate compiled binary and etc, so this won't help you anyway
  3. @pradovic please check your AI's PR before opening or at least force it fix CI as we probably ignore PR with failed CI

@Arjentix Arjentix closed this Mar 10, 2026
@pradovic
Copy link
Copy Markdown
Contributor

pradovic commented Mar 11, 2026

I don't know what the crap this AI tries to push to our repo, but this is completely wrong:

1. `nssa` only **reads** artifacts which are already built and committed in our repo (see `artifacts` directory).

2. Then it generates a rust module file including data from this artifacts. It's clearly seen in the `build.rs` that this output file depends on `OUT_DIR` env var which is [ideomatic](https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script) and common way in Rust. But anyway if you build the project it should generate compiled binary and etc, so this won't help you anyway

3. @pradovic please check your AI's PR before opening or at least force it fix CI as we probably ignore PR with failed CI

Hey @Arjentix I don't think I have anything to do with this PR. I don't have an AI that is opening PRs. Or was it somehow automatically triggered from the repo that I am not aware about?

I am currently working on this PR only: #389.

This AI PR seems to be couple of weeks old an totally unrelated.

@Arjentix
Copy link
Copy Markdown
Collaborator

I'm sorry, I messed up with nicknames, I meant @vpavlin

@pradovic
Copy link
Copy Markdown
Contributor

I'm sorry, I messed up with nicknames, I meant @vpavlin

No worries, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants