Skip to content

openXC7: Import upstream packages, add project#616

Merged
fricklerhandwerk merged 6 commits into
ngi-nix:mainfrom
OPNA2608:init/openxc7
Mar 21, 2025
Merged

openXC7: Import upstream packages, add project#616
fricklerhandwerk merged 6 commits into
ngi-nix:mainfrom
OPNA2608:init/openxc7

Conversation

@OPNA2608
Copy link
Copy Markdown
Contributor

Closes #552

https://github.com/openXC7/toolchain-nix contains upstream's Nix code for the toolchain, but we can't just fetchFromGitHub that & pass everything through as-is

  • We can't do import or callPackage any of the downloaded files, because that would re-introduce IFD to the repo after it was previously removed from it treewide.
  • We could just copy the src into out and make a shell script that wraps Nix to run nix develop inside of the downloaded checkout, but
    1. nix is dumb and sees nix develop /nix/store/... as "oh, you want me to build a derivation based on this store path… sorry, i can't parse this into a derivation!", necessitating some directory changing shenanigans
    2. It makes it impossible to test that setup in a VM, since that would require internet access for Nix to resolve URLs for downloads… unless we re-introduce IFD and finangle the VM environment to have everything pre-downloaded maybe?

So that left me with one option: Copy the relevant files from the repo into here, and replicate some setup code from the flake to build a wrapper that adds things to the environment, similar to a development shell (whose output we can't just use as-is, because the generated file in the store is commented with "this is an implementation detail, do not have any expectations for this path).

As a result, src is kinda useless, only serving as a pointer to what version of the repo the code was copied from.

Formatting of the copied files differs from upstream due to our pre-commit hook forcing a reformatting.

Really not happy with any of this, but given the situation described above, it is what it is…

@fricklerhandwerk
Copy link
Copy Markdown
Contributor

@OPNA2608 this is the correct approach from what I gather after reading or participating in discussions with Nixpkgs maintainers. @imincik and @JulienMalka may chip in there with 👍👎.

Nixpkgs (and by extension NGIpkgs) a distribution, and we curate how exactly we integrate the actual code, and that's expressed with the Nix language.

- Append nextpnr-xilinx-chipdb packages' pnames with the built backend, for clearer logs
- Add all packages to openxc7.passthru.packages, to allow individual building
@OPNA2608 OPNA2608 marked this pull request as ready for review March 20, 2025 16:01
@OPNA2608
Copy link
Copy Markdown
Contributor Author

Struggled abit with getting the packages & tests excluded from CI on platforms where some dependencies are unavailable, this is the best that I could figure out.

@fricklerhandwerk
Copy link
Copy Markdown
Contributor

Makes sense, thank you!

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Implement project metadata for OpenXC7

2 participants