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.
  1. I want to use Nix as a package manager and download packages to my local machine
  2. 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.
  3. 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)
      • The install instructions are here.
      • You'll need to get an ISO, burn it to a USB stick, partition and format your disk. This is a bit of a process and it's important to get it right, but you only have to do it once :) The short version of the commands required is here.
    • 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.
  4. 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!
Nix is deep rabbit hole for sure! I'm currently in the process of replacing my whole home-lab with a multi-host nix config!
reply
Haha if I had more time I would dive down the nix rabbit hole.
Some day
reply
Yeah, I keep planning to try it but I never can find the time.
reply
my best time investment of 2023 🤩
reply