When people encounter Nix, they're sometimes overwhelmed with the various parts of the ecosystem. This is my version of How to Start, which hopefully will save you some time and searching. Bookmark it for the next noob that walks your way :)
There are many different ways to install and use Nix, depending on your hardware and use case. Pick your own adventure below.
-
I want to use Nix as a package manager and download packages to my local machine
- Just install Nix.
- The DeterminateSystems installer (recommended): https://github.com/DeterminateSystems/nix-installer
- The nixOS.org installer: https://nixos.org/download
- Just install Nix.
-
I want to manage my local environment with Nix, so I can recreate it anywhere.
- Home-manager provides declarative environment management. Check out this post or this one, which walk through installing home-manager on Mac.
-
I want to run NixOS as my OS i.e. I want my OS to be configured, built, and run via Nix.
-
I have a Mac:
- You can't install NixOS on Mac hardware. What you can do, however, is bolt a declarative configuration (like NixOS!) onto your Mac with nix-darwin. (Walkthrough).
- Note: Nix-darwin works, but Apple could decide they don't want to make it easy for this to happen in a future release. Further, you entirely depend on Nix devs figuring out how to keep up with every Nix and MacOS release.
- An alternate method, if you have new M1/2 chips and CPU to spare, was put forth by Mitchell Hashimoto: just run NixOS as a VM on your Mac. See his repo here. If you want the benefit of NixOS without compromising the MacOS side of things, this is probably the way to go. The setup is a bit advanced, however.
- Orbstack is a VM manager that can spawn VMs, Docker containers, and more. It can thus run Nix in a VM for you. Seems cool if you want a way to use Nix and Docker on your Mac without taking the full Nix pill.
-
I have a PC (x86)
-
I have a RaspberryPi
- For RPi 4, see instructions here, which provides steps and a basic configuration to get started.
-
I have a phone
- As Matthew Croughan reminds us, phones are computers! Thus, hardware permitting, you can flash NixOS on them.
- See the Mobile NixOS project page and repo for device compatibility and install instructions.
-
-
I want to run my Bitcoin Core node with NixOS
- You're in luck, because some mad lads created nix-bitcoin (repo and site). You'll need a machine to deploy to set up that machine as a NixOS machine first, as above.
- You can then configure your node with any packages nix-bitcoin offers via nix's declarative configuration model.
- Once you're set up, running a Bitcoin node becomes as easy as modifying the configuration file, and running
deploy
: your node then updates to the new configuration. It's transparent, configurable, and security-conscious. It rocks.
Happy Nix-ing!