erg-lang / erg

A statically typed language compatible with Python
http://erg-lang.org
Apache License 2.0
2.62k stars 54 forks source link

Building use Nix flake fails with `error: cannot coerce a set to a string` #366

Open zetashift opened 1 year ago

zetashift commented 1 year ago

Describe the bug?

The docs mention you can use Nix (flakes) to build the project, but cloning the repo and running nix build fails with(without full stacktrace):

error: cannot coerce a set to a string

       at /nix/store/hm561lqf9zg7q0bx3j3rax74bnq0hjnf-source/flake.nix:35:38:

           34|         packages.erg = pkgs.rustPlatform.buildRustPackage {
           35|           inherit (cargoToml.package) name version;
             |                                      ^
           36|           src = builtins.path {
(use '--show-trace' to show detailed location information)

Reproducible code

git clone https://github.com/erg-lang/erg.git && cd erg

If you have direnv and nix-direnv installed (I do):

direnv allow

And running the build:

nix build

Expected result

A successful compilation.

Actual result

~/d/erg/erg main 1.2s | 1 ❱ nix build --show-trace
error: cannot coerce a set to a string

       at /nix/store/hm561lqf9zg7q0bx3j3rax74bnq0hjnf-source/flake.nix:35:38:

           34|         packages.erg = pkgs.rustPlatform.buildRustPackage {
           35|           inherit (cargoToml.package) name version;
             |                                      ^
           36|           src = builtins.path {

       … while evaluating the attribute 'version' of the derivation 'erg'

       at /nix/store/gx2yx1nc9i1q0r7vszcafyv52gmdwnqw-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

Additional context

No response

Erg version

main branch

Python version

None

OS

macOS 13 (Ventura)

zetashift commented 1 year ago

I see there was an update for the Nix flake, but currently with a fresh clone, getting the following error/warning:

~/d/erg/erg main ❱ nix build
error: builder for '/nix/store/sr6frjpwk8bvn7a4gci22yk0qsid6l2j-erg.drv' failed with exit code 101;
       last 10 log lines:
       > Executing cargoBuildHook
       > ++ env CC_aarch64-apple-darwin=/nix/store/b9bh3z78rqff14bf0fd78xb07b5cnwdw-clang-wrapper-11.1.0/bin/cc CXX_aarch64-apple-darwin=/nix/store/b9bh3z78rqff14bf0fd78xb07b5cnwdw-clang-wrapper-11.1.0/bin/c++ CC_aarch64-apple-darwin=/nix/store/b9bh3z78rqff14bf0fd78xb07b5cnwdw-clang-wrapper-11.1.0/bin/cc CXX_aarch64-apple-darwin=/nix/store/b9bh3z78rqff14bf0fd78xb07b5cnwdw-clang-wrapper-11.1.0/bin/c++ cargo build -j 10 --target aarch64-apple-darwin --frozen --release
       > error: failed to parse manifest at `/private/tmp/nix-build-erg.drv-0/nqa6wd2nk4hfxi7z1rmk9ird5h0m41np-source/Cargo.toml`
       >
       > Caused by:
       >   feature `workspace-inheritance` is required
       >
       >   The package requires the Cargo feature called `workspace-inheritance`, but that feature is not stabilized in this version of Cargo (1.62.0).
       >   Consider adding `cargo-features = ["workspace-inheritance"]` to the top of Cargo.toml (above the [package] table) to tell Cargo you are opting in to use this unstable feature.
       >   See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#workspace-inheritance for more information about the status of this feature.
       For full logs, run 'nix log /nix/store/sr6frjpwk8bvn7a4gci22yk0qsid6l2j-erg.drv'.
mtshiba commented 1 year ago

Yes, it looks like Nix are using an old version of cargo/rustc. I'm looking into how to update the dependencies now (I wasn't the one who added the Nix installing script).

zetashift commented 1 year ago

I tried doing fixing it as well, but I'm clueless in Rust land :P.

Usually nix flake update does things for me