rustlings icon indicating copy to clipboard operation
rustlings copied to clipboard

Nixos error: couldn't read `src/main.rs`: No such file or directory (os error 2)

Open aritroCoder opened this issue 2 years ago • 4 comments
trafficstars

After running nix-shell in terminal (inside rustlings folder) I get this error, although src/main.rs is already present.

error: couldn't read src/main.rs: No such file or directory (os error 2)

error: could not compile `rustlings` due to previous error
error: builder for '/nix/store/sqp4mmfz9xk7mp25h86d6h4r80dsnm4a-rustlings.drv' failed with exit code 101;
       last 10 log lines:
       >    Compiling mio-extras v2.0.6
       >    Compiling notify v4.0.17
       >    Compiling indicatif v0.16.2
       >    Compiling argh_derive v0.1.10
       >    Compiling argh v0.1.10
       >    Compiling toml v0.5.11
       >    Compiling rustlings v5.5.1 (/build/source)
       > error: couldn't read src/main.rs: No such file or directory (os error 2)
       >
       > error: could not compile `rustlings` due to previous error
       For full logs, run 'nix log /nix/store/sqp4mmfz9xk7mp25h86d6h4r80dsnm4a-rustlings.drv'.

Here are my nixos configurations for reference: https://github.com/aritroCoder/nixos-configs

aritroCoder avatar Jun 29 '23 06:06 aritroCoder

@aritroCoder - Hi, did you solve this? I am getting the same error.

devtrends avatar Oct 25 '23 23:10 devtrends

Never mind. Used my own nix shell and ran cargo install --force --path . Seems to work ok now.

devtrends avatar Oct 26 '23 14:10 devtrends

I haven't using Nix OS, but recommend you try online run by GitHub Code Space, my Rustlings too at Code Space.

XiaoZiShan avatar Oct 26 '23 15:10 XiaoZiShan

if you're not using flakes you can nix develop --extra-experimental-features nix-command --extra-experimental-features flakes instead of nix-shell Worked for me like a charm. I'm on nix 2.13.6 and NixOS 23.05

Abrolhus avatar Nov 04 '23 11:11 Abrolhus

Closing because others offered some answers

mo8it avatar Mar 28 '24 01:03 mo8it