Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with clap v4.0.22: missing dependency atty #267

Open
Panke opened this issue Dec 19, 2022 · 2 comments
Open

Build fails with clap v4.0.22: missing dependency atty #267

Panke opened this issue Dec 19, 2022 · 2 comments

Comments

@Panke
Copy link

Panke commented Dec 19, 2022

Hi,

clap-rs switched from atty to is-terminal and I am on an old version still using atty, which I cannot build with crate2nix.

➜  crate2nix-clap-atty git:(master) nix build -f Cargo.nix
error: builder for '/nix/store/4irmizhc2ifzijy7vni5p1l909pwv7z0-rust_clap-4.0.22.drv' failed with exit code 1;
       last 10 log lines:
       > error[E0433]: failed to resolve: use of undeclared crate or module `atty`
       >   --> src/output/fmt.rs:90:5
       >    |
       > 90 |     atty::is(stream)
       >    |     ^^^^ use of undeclared crate or module `atty`
       >
       > error: aborting due to 15 previous errors
       >
       > Some errors have detailed explanations: E0432, E0433.
       > For more information about an error, try `rustc --explain E0432`.
       For full logs, run 'nix log /nix/store/4irmizhc2ifzijy7vni5p1l909pwv7z0-rust_clap-4.0.22.drv'.
error: 1 dependencies of derivation '/nix/store/ayxjfhsslabrgzg2s5gkvbqx6fg27kfj-rust_showbug-0.1.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/8sm2412v27b2psn41rhwqiyzqkypxhhb-all-workspace-members.drv' failed to build
➜  crate2nix-clap-atty git:(master) 

Cargo.nix has been generated with crate2nix v0.10.0, built from .

I made a small test project that shows the same behaviour: https://github.com/Panke/crate2nix-clap-atty

Maybe it has something to do with clap switching to is-terminal recently, but this is my first try with crate2nix so I can't tell. Updating (nix flake update && cargo update) does not help and leads to:

➜  crate2nix-clap-atty git:(master) ✗ nix build -f Cargo.nix 
error: builder for '/nix/store/bqs0kl0g2lxp5xqhgm0r2dvshj9lc6k6-rust_clap-4.0.29.drv' failed with exit code 1;
       last 10 log lines:
       > error[E0599]: no method named `is_terminal` found for struct `Stderr` in the current scope
       >   --> src/output/fmt.rs:88:45
       >    |
       > 88 |         Stream::Stderr => std::io::stderr().is_terminal(),
       >    |                                             ^^^^^^^^^^^ method not found in `Stderr`
       >
       > error: aborting due to 15 previous errors
       >
       > Some errors have detailed explanations: E0432, E0433, E0599.
       > For more information about an error, try `rustc --explain E0432`.
       For full logs, run 'nix log /nix/store/bqs0kl0g2lxp5xqhgm0r2dvshj9lc6k6-rust_clap-4.0.29.drv'.

Am I doing it wrong?

@FlakM
Copy link

FlakM commented Jan 13, 2023

I was debugging a similar thing and it seems that those two issues are related: #129 it is associated with how is-terminal crate handles optional compilation based on cfg: https://github.com/sunfishcode/is-terminal/blob/main/src/lib.rs#L54-L73

For a quick fix you might disable color feature in clap

@0xbe7a
Copy link

0xbe7a commented Jan 30, 2023

The problem seems that clap uses "dep:" features. These were introduced in rust 1.60.0. Support in crate2nix was added in #252. However, after #264 noted this, only a release canidate was created by #270, and the version in nixpkgs is still version 0.10.0 and does not yet provide support for "dep:" features.

TL;DR use most recent version of crate2nix instead of nixpkgs version until 0.11.0 comes out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants