Skip to content

Nix refactor #1285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Nix refactor #1285

wants to merge 5 commits into from

Conversation

RossSmyth
Copy link

Hello,

This nix devshell was a bit jank. I cleaned it up, and also added a nix derivation.

  1. Make a ./nix directory to put Nix-specific stuff in
  2. Create a patch for grabbing tinycbor from nixpkgs, since fetching in the Nix sandbox is not allowed

This is fine because the version in nixpkgs is the same version that was being fetched via git anyways.

  1. Create a derivation for building c2rust in the nix sandbox at ./nix/package.nix
  2. Create a wrapper derivation for running c2rust at ./nix/default.nix

This provides things that c2rust needs in its environment to run, such as setting up PATH and other things.

  1. Make a ./shell.nix file

This is basically the same as before. It is hooked up to the flake too.

  1. Add some flake checks

This allows to check that it builds when updating and other things.

  1. Add overlay in ./default.nix

This is very useful, because it allows for people to directly import c2rust as an overlay into their NixOS config, home-manager config, or devshells.

  1. Update Nix instructions in README

I am unsure what sort of scope the project would like for Nix integration. This is basically the minimum of being able to build it on Nix easily. There are other things that could be done:

  1. Run Nix checks in CI
  2. Automatically update lock file

There is a TODO for a test failures:

fn lighttpd_minimal() {

error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/build/source/target/x86_64-unknown-linux-gnu/release/c2rust-analyze /nix/store/ipjksldzmw00pwndfc8v4wy99q83k8z2-cargo-auditable-0.6.5/bin/cargo-auditable rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 101)
  --- stderr
  error: multiple input filenames provided (first two filenames are `rustc` and `-`)

thread 'main' panicked at '
[ERROR @ c2rust-analyze/src/main.rs:241 @ c2rust_analyze]: error (exit status: 101) running: "/nix/store/k5cb6zl45g4hpwzkjj41qzwq29zy2w1x-cargo-1.65.0-nightly-2022-08-08-x86_64-unknown-linux-gnu/bin/cargo" "check" "--manifest-path" "../analysis/tests/lighttpd-minimal/Cargo.toml"
', c2rust-analyze/src/log.rs:50:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

And various filecheck failures. It also looks like there is some sort of race happening on stderr output?
filecheck.log

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