MercuryTechnologies / nix-your-shell

A `nix` and `nix-shell` wrapper for shells other than `bash`
MIT License
85 stars 12 forks source link

nix-your-shell build errors #26

Closed moissela closed 1 year ago

moissela commented 1 year ago

Today I encountered this issue while running a nix-darwin upgrade (using flakes) on my machine:

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/46r4xikymhl5kzyrhy84sgi1xdcx02m3-kq475akl03xj7z3v9vnn1p5v6sw34cvi-source
source root is kq475akl03xj7z3v9vnn1p5v6sw34cvi-source
Executing cargoSetupPostUnpackHook
Finished cargoSetupPostUnpackHook
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
Executing cargoSetupPostPatchHook
Validating consistency between /private/tmp/nix-build-nix-your-shell-1.2.0.drv-0/kq475akl03xj7z3v9vnn1p5v6sw34cvi-source/Cargo.lock and /private/tmp/nix-build-nix-your-shell-1.2.0.drv-0/cargo-vendor-dir/Cargo.lock
Finished cargoSetupPostPatchHook
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
@nix { "action": "setPhase", "phase": "buildPhase" }
building
Executing cargoBuildHook
++ env CC_aarch64-apple-darwin=/nix/store/b0d5xkncz7jn72kkgzsaizpk9170mybf-clang-wrapper-11.1.0/bin/cc CXX_aarch64-apple-darwin=/nix/store/b0d5xkncz7jn72kkgzsaizpk9170mybf-clang-wrapper-11.1.0/bin/c++ CC_aarch64-apple-darwin=/nix/store/b0d5xkncz7jn72kkgz>
   Compiling libc v0.2.139
   Compiling once_cell v1.17.0
   Compiling proc-macro2 v1.0.51
   Compiling version_check v0.9.4
   Compiling unicode-ident v1.0.6
   Compiling quote v1.0.23
   Compiling io-lifetimes v1.0.5
   Compiling memchr v2.5.0
   Compiling rustix v0.36.8
   Compiling cfg-if v1.0.0
   Compiling lazy_static v1.4.0
   Compiling syn v1.0.107
   Compiling sharded-slab v0.1.4
   Compiling pin-project-lite v0.2.9
   Compiling cc v1.0.79
   Compiling tracing-core v0.1.30
   Compiling thread_local v1.1.4
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling bitflags v1.3.2
   Compiling tracing-subscriber v0.3.16
   Compiling tracing v0.1.37
   Compiling gimli v0.27.1
   Compiling eyre v0.6.8
   Compiling backtrace v0.3.67
   Compiling adler v1.0.2
   Compiling miniz_oxide v0.6.2
   Compiling object v0.30.3
   Compiling camino v1.1.2
   Compiling indenter v0.3.3
   Compiling rustc-demangle v0.1.21
   Compiling tracing-error v0.2.0
   Compiling errno v0.2.8
   Compiling os_str_bytes v6.4.1
   Compiling heck v0.4.1
   Compiling owo-colors v3.5.0
   Compiling clap_lex v0.3.1
   Compiling termcolor v1.2.0
   Compiling terminal_size v0.2.3
   Compiling is-terminal v0.4.3
   Compiling strsim v0.10.0
   Compiling shell-words v1.1.0
   Compiling addr2line v0.19.0
   Compiling color-spantrace v0.2.0
   Compiling color-eyre v0.6.2
   Compiling clap_derive v4.1.0
   Compiling clap v4.1.4
   Compiling nix-your-shell v1.2.0 (/private/tmp/nix-build-nix-your-shell-1.2.0.drv-0/kq475akl03xj7z3v9vnn1p5v6sw34cvi-source)
    Finished release [optimized] target(s) in 8.08s
Executing cargoInstallPostBuildHook
Finished cargoInstallPostBuildHook
Finished cargoBuildHook
@nix { "action": "setPhase", "phase": "checkPhase" }
running tests
Executing cargoCheckHook
++ cargo test -j 12 --release --target aarch64-apple-darwin --frozen -- --test-threads=12
   Compiling nix-your-shell v1.2.0 (/private/tmp/nix-build-nix-your-shell-1.2.0.drv-0/kq475akl03xj7z3v9vnn1p5v6sw34cvi-source)
    Finished release [optimized] target(s) in 0.27s
     Running unittests src/main.rs (target/aarch64-apple-darwin/release/deps/nix_your_shell-0411700737e87c01)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Finished cargoCheckHook
`cargo fmt` is OK
   Compiling libc v0.2.139
    Checking once_cell v1.17.0
   Compiling proc-macro2 v1.0.51
   Compiling version_check v0.9.4
   Compiling quote v1.0.23
   Compiling unicode-ident v1.0.6
   Compiling io-lifetimes v1.0.5
    Checking cfg-if v1.0.0
   Compiling memchr v2.5.0
   Compiling rustix v0.36.8
    Checking lazy_static v1.4.0
   Compiling syn v1.0.107
    Checking pin-project-lite v0.2.9
    Checking sharded-slab v0.1.4
   Compiling cc v1.0.79
    Checking bitflags v1.3.2
    Checking tracing-core v0.1.30
    Checking thread_local v1.1.4
   Compiling eyre v0.6.8
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
    Checking tracing-subscriber v0.3.16
    Checking tracing v0.1.37
    Checking gimli v0.27.1
    Checking adler v1.0.2
    Checking object v0.30.3
    Checking owo-colors v3.5.0
    Checking miniz_oxide v0.6.2
    Checking indenter v0.3.3
   Compiling heck v0.4.1
    Checking rustc-demangle v0.1.21
    Checking os_str_bytes v6.4.1
   Compiling camino v1.1.2
   Compiling backtrace v0.3.67
    Checking clap_lex v0.3.1
    Checking strsim v0.10.0
    Checking tracing-error v0.2.0
    Checking termcolor v1.2.0
    Checking shell-words v1.1.0
    Checking color-spantrace v0.2.0
    Checking errno v0.2.8
    Checking is-terminal v0.4.3
    Checking terminal_size v0.2.3
    Checking addr2line v0.19.0
    Checking color-eyre v0.6.2
   Compiling clap_derive v4.1.0
    Checking clap v4.1.4
    Checking nix-your-shell v1.2.0 (/private/tmp/nix-build-nix-your-shell-1.2.0.drv-0/kq475akl03xj7z3v9vnn1p5v6sw34cvi-source)
error: this looks like you are trying to swap `__clap_subcommand` and `clap::Subcommand`
  --> src/main.rs:41:24
   |
41 | #[derive(Debug, Clone, clap::Subcommand)]
   |                        ^^^^^^^^^^^^^^^^
   |
   = note: or maybe you should use `std::mem::replace`?
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#almost_swapped
note: the lint level is defined here
  --> src/main.rs:41:24
   |
41 | #[derive(Debug, Clone, clap::Subcommand)]
   |                        ^^^^^^^^^^^^^^^^
   = note: `#[deny(clippy::almost_swapped)]` implied by `#[deny(clippy::correctness)]`
   = note: this error originates in the derive macro `clap::Subcommand` (in Nightly builds, run with -Z macro-backtrace for more info)

error: this looks like you are trying to swap `arg` and `args`
  --> src/main.rs:49:16
   |
49 |     NixShell { args: Vec<String> },
   |                ^^^^ help: try: `std::mem::swap(&mut arg, &mut args)`
   |
   = note: or maybe you should use `std::mem::replace`?
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#almost_swapped

error: this looks like you are trying to swap `arg` and `args`
  --> src/main.rs:51:11
   |
51 |     Nix { args: Vec<String> },
   |           ^^^^ help: try: `std::mem::swap(&mut arg, &mut args)`
   |
   = note: or maybe you should use `std::mem::replace`?
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#almost_swapped

error: could not compile `nix-your-shell` due to 3 previous errors
/nix/store/crv0aygayvds8xwyqln2p1zrdsmfw54s-stdenv-darwin/setup: line 88: pop_var_context: head of shell_variables not a function context
/nix/store/crv0aygayvds8xwyqln2p1zrdsmfw54s-stdenv-darwin/setup: line 50: pop_var_context: head of shell_variables not a function context
/nix/store/5z6qpyv6sk78bnsmpx02abpx8dag0lfd-cargo-check-hook.sh/nix-support/setup-hook: line 1603: pop_var_context: head of shell_variables not a function context
drupol commented 1 year ago

Same issue...

image

drupol commented 1 year ago

In the end, I used the version in nixpkgs and everything worked.

9999years commented 1 year ago

Fixed in #30.