Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Nix

From Nest Guides
Revision as of 17:44, 27 March 2024 by David (talk | contribs) (Overhauled with more instructions)

This article is a stub. Please help expand it.

Nix is a package manager which is used on nest to allow users to install packages without the need of apt, which requires sudo (Superuser Do) permissions. It's normally used to make reproducible developer and production environments with just one file! What is great about nix, compared to pacman (Arch), or apt (Debian/Ubuntu), is that you can have multiple versions of a package installed on the nest server because it's on the user-level. This means one user could have Node.js 18, another 20, etc.

Nix Environment (persistent)

You can install things just like apt permanently using nix! This means even if you reboot or log off, the package will stay with your user account. You can run nix-env -f '<nixpkgs>' -iA <package> to install packages.

Nix shells (temporary)

Let's talk about nix shells! You can spawn a new shell with the packages so you can try out packages, and when you close out the shell, all of those packages will be gone! For example, you can run nix shell nixpkgs#package nixpkgs#package (replacing "package" with the packages you want) to spin up a new shell with those packages.

Once you're done, exit out using the exit command.

Removing a package

You can remove a package just by running nix profile remove <package>

Searching for a package

You can also search for the package you want online or by running nix search nixpkgs <package>. It appears to use a lot of memory running it from the command line so it's recommended that you use the online version instead.