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

cannot install rust in repl.it? #1352

Closed
simin75simin opened this issue Feb 2, 2023 · 4 comments
Closed

cannot install rust in repl.it? #1352

simin75simin opened this issue Feb 2, 2023 · 4 comments

Comments

@simin75simin
Copy link

error: failed to extract package (perhaps you ran out of disk space?): IO receiver for '/home/runner/.rustup/tmp/9xgyql44b714js5i_dir/rustc/lib/libLLVM-15-rust-1.67.0-stable.so' disconnected

@shadows-withal
Copy link
Member

Hm, looks like a repl.it issue?

@montchr
Copy link

montchr commented Feb 6, 2023

I'm also not able to run this in Replit:

~/rustlings$ rustlings
bash: rustlings: command not found

I then tried clicking the huge and obvious "Run" button, which resulted in the following console output:

 [ -x ~/.cargo/bin/rustlings ] && ~/.cargo/bin/rustlings watch || ./install.sh
Let's get you set up with Rustlings!
Checking requirements...
SUCCESS: Git is installed
SUCCESS: cc is installed
ERROR: rustup does not seem to be installed.
Please download rustup using https://rustup.rs!

Okay:

~/rustlings$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
warning: it looks like you have an existing installation of Rust at:
warning: /nix/store/yxahn76zdfg07rims69zpwajch937kxh-rustc-1.64.0/bin
warning: rustup should not be installed alongside Rust. Please uninstall your existing Rust first.
warning: Otherwise you may have confusion unless you are careful with your PATH
warning: If you are sure that you want both rustup and your already installed Rust
warning: then please reply `y' or `yes' or set RUSTUP_INIT_SKIP_PATH_CHECK to yes
warning: or pass `-y' to ignore all ignorable checks.
error: cannot install while Rust is installed

Continue? (y/N) 

error: cannot install while Rust is installed

I also tried running nix-shell in Replit (seems like flakes are not available there?) but this resulted in Nix attempting to build the entire world. Eventually I got:

...
copying path '/nix/store/baqp47fg1iag6bzcbsv942rzgj0r276l-llvm-14.0.6-lib' from 'https://cache.nixos.org'...
preallocating file of 2004072 bytes: Disk quota exceeded
copying path '/nix/store/bbq41iasbfwwmn94r40xm7x42lsf5py8-perl-5.36.0' from 'https://cache.nixos.org'...
error: build of '/nix/store/57dlv9h9grplass2ywczdpm555nj6cgi-cargo-1.64.0.drv', '/nix/store/6innij7yzxl5m4ylz3znj4hadmadalqy-rustc-1.64.0.drv', '/nix/store/b0s7hv8aqakpdvpp8v8r5fi5k4j8dnwi-clippy-1.64.0.drv', '/nix/store/bpgd09g79wvj1p8fdvjjjy2ddza2s3yp-rustlings.drv', '/nix/store/gajvqygc937wsfjdkpfpqrrk3mlpyy6z-stdenv-linux.drv' failed

My guess is that calling nix-shell in Replit builds dependencies based on the flake.lock version rather than the version of Nixpkgs specified in .replit? But I haven't used Replit prior to this and am not sure what to try next. So I'll just run locally for now.

@shadows-withal
Copy link
Member

Huh, so repl.it automatically builds a nix derivation if a shell.nix is present? That's weird and seems counterintuitive. I also don't use it myself, it was a third party thing (from two years ago), so I can't be of too much help here. If it's broken, we just have to remove it.

@montchr
Copy link

montchr commented Feb 7, 2023

Huh, so repl.it automatically builds a nix derivation if a shell.nix is present?

Not exactly, from what I can tell. I ran nix-shell on my own while trying to get things working. But Replit is powered by Nix under the hood – everything appears to come from their Nix store which is mounted as a virtual file system.

Configuring a Repl | Replit Docs

Every new repl comes with a .replit and a replit.nix file that let you configure your repl to do just about anything in any language!

In most repls, these files are hidden by default. But you can find them easily by clicking the three dot menu in the file tree, and selecting Show hidden files.

Using Nix with Replit | Replit Docs

The replit.nix file configures the Nix environment, it tells our repl what packages to install. It should look something like this:

{ pkgs }: {
  deps = [
    pkgs.cowsay
  ];
}

If you're used to the Nix way of doing things, you can replace the replit.nix file with a shell.nix or default.nix file, with the order of priority being: replit.nix -> shell.nix -> default.nix.

So maybe if the template repl set this up ahead of time, the dependencies would be built in advance for newly-created repls? But since it looks like they only support a few Nix channels, the replit.nix would need to make use of the Replit-provided pkgs. The existing shell.nix wouldn't do the trick since it's just using the versions of packages from flake.nix via the flake-compat shim.

I'm pretty sure the adjustments for replit.nix would be pretty simple – it kind of looked to me like the replit.nix file was auto-generated (weird indentation and dependencies didn't seem to match up with flake.nix), perhaps from the existing .replit file in this repo. I say that because of prior experience with Nix, but not with Rust or Replit.

akhildevelops pushed a commit to akhildevelops/rustlings-solutions that referenced this issue Mar 5, 2023
It stopped working and needs too much manual fixing, until someone
comes along to fix it, it's not great to have in the README section.

Closes rust-lang#1352.
ComixHe pushed a commit to ComixHe/rustlings that referenced this issue Jun 20, 2023
It stopped working and needs too much manual fixing, until someone
comes along to fix it, it's not great to have in the README section.

Closes rust-lang#1352.
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