1{ lib, rustPlatform, fetchFromGitHub, makeWrapper, z3, pkgsHostTarget }:
2
3let
4 runtimeDeps = [
5 z3
6 pkgsHostTarget.targetPackages.stdenv.cc
7 ];
8in
9
10rustPlatform.buildRustPackage rec {
11 pname = "zz";
12 version = "unstable-2021-05-04";
13
14 # when updating, choose commit of the latest build on http://bin.zetz.it/
15 src = fetchFromGitHub {
16 owner = "zetzit";
17 repo = "zz";
18 rev = "18020b10b933cfe2fc7f2256b71e646889f9b1d2";
19 sha256 = "01nlyyk1qxk76dq2hw3wpbjwkh27zzp6mpczjnxdpv6rxs7mc825";
20 };
21
22 nativeBuildInputs = [ makeWrapper ];
23
24 cargoSha256 = "080rd8x4jsssnx4il80xcb81iw8pjcm70zckpa1hcijkw9104dgs";
25
26 postPatch = ''
27 # remove search path entry which would reference /build
28 sed -i '/env!("CARGO_MANIFEST_DIR")/d' src/lib.rs
29 '';
30
31 postInstall = ''
32 mkdir -p "$out/share/zz"
33 cp -r modules "$out/share/zz/"
34
35 wrapProgram $out/bin/zz \
36 --prefix PATH ":" "${lib.makeBinPath runtimeDeps}" \
37 --suffix ZZ_MODULE_PATHS ":" "$out/share/zz/modules"
38 '';
39
40 meta = with lib; {
41 description = "ZetZ a zymbolic verifier and tranzpiler to bare metal C";
42 homepage = "https://github.com/zetzit/zz";
43 license = licenses.mit;
44 maintainers = [ maintainers.marsam ];
45 };
46}