Skip to content
How do I add a nix file to a repl in another language?
Profile icon
ConnorMooneyhan

I'm trying to use nix to install a package (rustup) in my Rust repl and I've tried adding a replit.nix file with the following code:

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

I'm not sure how to run the nix file from this point though. I tried using cowsay and I tried using rustup in the shell and both are saying the command doesn't exist. What do I need to do to get this thing to run?

You are viewing a single comment. View All
Profile icon
SixBeeps

RoBlockHead is completely correct, but I can explain it a little more.

Currently, there are two types of Repls. There are the Repls that run on a Docker image called Polygott, and there are the Repls which use Nix. Before Nix, everything was on Polygott. Replit eventually plans on transferring everything over to Nix iirc.

Since Rust Repls run on Polygott, Nix isn't supported on them. However, if you were to set up a Nix Repl, then you'd be able to use it.

Profile icon
EdGriebel1

@SixBeeps
So this seems like pretty sharp edge as install-pkg seems to be deprecated in many place, and it's impossible to tell when replit.nix is going to be used or ignored. Also most of the "adding your own packages" blog posts recommend nix, very confusing!

Profile icon
SixBeeps

@EdGriebel1
This post was from 4 months ago. Look at the website that RoBlockHead linked, almost all Repls run on Nix now. If you create a Repl with one of the languages, it will run on Nix.