From 190173e05b41153cefe0fefb3c0771e6f42e8c07 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Mon, 25 Jan 2021 14:03:26 +0100 Subject: [PATCH 1/2] zz: adjust upstream URLs --- pkgs/development/compilers/zz/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/zz/default.nix b/pkgs/development/compilers/zz/default.nix index 273873c8801..cbf5e3bd9d8 100644 --- a/pkgs/development/compilers/zz/default.nix +++ b/pkgs/development/compilers/zz/default.nix @@ -5,7 +5,7 @@ rustPlatform.buildRustPackage rec { version = "0.1"; src = fetchFromGitHub { - owner = "aep"; + owner = "zetzit"; repo = "zz"; rev = version; sha256 = "0kqrfm2r9wn0p2c3lcprsy03p9qhrwjs990va8qi59jp704l84ad"; @@ -21,7 +21,7 @@ rustPlatform.buildRustPackage rec { meta = with lib; { description = "πŸΊπŸ™ ZetZ a zymbolic verifier and tranzpiler to bare metal C"; - homepage = "https://github.com/aep/zz"; + homepage = "https://github.com/zetzit/zz"; license = licenses.mit; maintainers = [ maintainers.marsam ]; }; From 4aa937d2e212285913563517f62641cbe6c1a129 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Mon, 25 Jan 2021 14:25:42 +0100 Subject: [PATCH 2/2] zz: install modules shipped with the compiler Previously zz wouldn't be able to compile anything using standard modules like mem or log out of the box. To fix this we copy the modules directory included in the source to $out/share/zz/modules and add an entry to ZZ_MODULE_PATHS in the wrapper around zz. We also remove a search path entry which used to reference /build because it used CARGO_MANIFEST_DIR at build time. The default search path now includes: * /nix/store/modules * $out/share/zz/modules * $(pwd)/modules Patching out /nix/store/modules would be kind of cumbersome as it is a multi-line entry, but it probably does no harm and fine to leave in. An issue arising by this PR might be that the added search path entry may take priority over an user specified location even though we use --suffix. This is because zz internally uses a HashSet which has no guaranteed iteration order. This may lead to unexpected behavior for users wo previously provided custom versions of the standard modules via ZZ_MODULE_PATHS. However, this is an issue in upstream issue as well where ZZ_MODULE_PATHS may or may not take priority over the compiled in search path, so this issue should probably be resolved upstream (I'll file a report or PR). --- pkgs/development/compilers/zz/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/zz/default.nix b/pkgs/development/compilers/zz/default.nix index cbf5e3bd9d8..4d29e314c67 100644 --- a/pkgs/development/compilers/zz/default.nix +++ b/pkgs/development/compilers/zz/default.nix @@ -15,8 +15,18 @@ rustPlatform.buildRustPackage rec { cargoSha256 = "0yllcqxyyhwr9h0z8q84l0ms8x6jrqhpg79ik4xng6h5yf4ab0pq"; + postPatch = '' + # remove search path entry which would reference /build + sed -i '/env!("CARGO_MANIFEST_DIR")/d' src/lib.rs + ''; + postInstall = '' - wrapProgram $out/bin/zz --prefix PATH ":" "${lib.getBin z3}/bin" + mkdir -p "$out/share/zz" + cp -r modules "$out/share/zz/" + + wrapProgram $out/bin/zz \ + --prefix PATH ":" "${lib.getBin z3}/bin" \ + --suffix ZZ_MODULE_PATHS ":" "$out/share/zz/modules" ''; meta = with lib; {