5. Installing new packages
If you want to run some code you wrote, you probably need some language or runtime to do so - eg Python, GCC, Haskell. It might happen to be installed system wide, but when it's not, we use a tool called Nix to install packages per-user without having version conflicts.
Nix is able to do a lot more things, but for most cases you can use it like so:
# install 'hello' from nixpkgs $ nix-env -iA nixpkgs.hello installing 'hello-2.12.1' $ hello Hello, world! # it works! # see everything installed for the current user $ nix-env -q hello-2.12.1 # uninstall 'hello'. note no 'nixpkgs.' this time $ nix-env --uninstall hello
To search for packages, go here.
We're using a super small subset of what Nix can do here. It's also able to do things like per-project environments, building your projects, and generating docker images. For more info, see:
The language versions that Nix can install might not be the ones you want, or it might be missing a package you need. In this case, you might want to try an alternative:
- Rust has rustup
- Node.JS has NVM
- Ruby has RVM
- asdf supports many other languages
- You can just compile it from source and install it somewhere in your home directory.
If you're having problems, feel free to ask an admin.