Packaging Kani Rust Verifier

My attempt is here.

It fails with

   Compiling kani-driver v0.50.0 (/build/source/kani-driver)
error: failed to run custom build command for `kani-compiler v0.50.0 (/build/source/kani-compiler)`

Caused by:
  process didn't exit successfully: `/build/source/target/release/build/kani-compiler-6b6e8907781a95f1/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at kani-compiler/build.rs:25:47:
  called `Result::unwrap()` on an `Err` value: NotPresent

The relevant line in build.rs is

let rustup_home = env::var("RUSTUP_HOME").unwrap();

which aligns with the build instructions’ indication that cargo be installed via rustup.

Not sure how to deal with this in Nix’ sandboxed environment. How should I proceed?

[ There are also pre-compiled binaries for

  • x86_64-unknown-linux-gnu
  • x86_64-apple-darwin
  • aarch64-apple-darwin ]

You would need to set the environment variables so that it can find the dependencies. I attempted packaging it here.

But I do not think I managed to make it work since I eventually used rustup with HOME in /tmp.

1 Like

This gets me a bit further, but I grind to a halt on unresolved imports.

The unusual build procedure combined with my limited Nix packaging experience probably make this lie beyond my reach. On the one hand, I’d like to understand how to deal with this; on the other, I can’t really justify the time required.

How about using the pre-compiled binaries they provide?

Yeah, I think that is because it really requires items from a Nightly compiler, so the bootstrap hack is not sufficient.

You could use fenix to get it but that will not work in Nixpkgs.