How do you install packages/programs in a repl without needing to reload it every time and/or edit replit.nix *in the cli*?

Self explanatory, is there a way to do it?

1 Like

Yes. Open the shell and press enter. You do need to edit replit.nix though.

That’s actually a good point. A sidebar GUI for package managing would be nice to have.

Sadly not what I needed, I am fine with the config file but I want a cli installation, sorry

Oh, i think you can do that. I think there’s a nix command (possibly nix-os).
But it wouldn’t be permanent. (it’d get rid of the package after the repl restarts)
However, you can type in the command you want. If it doesn’t exist it’ll ask you which package you want to install. This might add it to replit.nix, I can’t actually remember.

yeah nix but it doesnt work

But what if you type in what you want? Here’s a GIF.

Screen Recording 2022-08-17 at 6.08.14 pm

1 Like

Yep, I am aware that this exists, but I mean to purely
use the cli, like in a script or something rather than it showing a picker menu

you could create a file with contents:

sed -i "s/\];/    pkgs.$1\n  ];/" replit.nix

Then, run chmod +x in shell. You can now run, say, ./ python311 to add python 3.11.
Note that this is quite hacky. If you change the structure of your replit.nix from the default, it’ll mess things up.


yeah this is what I’m using right now kinda, I guess I’ll use that, thanks

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.