Frequently asked questions (FAQ)
More like "Most anticipated questions (MAQ)" since almost no one asked me about this yet. :) However, it doesn’t roll off the tongue.
-
I’m new to Nix and NixOS, where should I start?
Oh no, you’ve seen the multiple configurations from other systems, didn’t you?
I hope you’re ready for some time understanding because the learning curve is steeper than the Troll Wall. I’ve written a blog post regarding my experience with Nix (and eventually a follow-up for managing a server with NixOS) with a bunch of links for getting started. Fortunately [1], it is mostly the same experience now that I’ve revisited it. (That said, Nix Pills is getting better!)
For a more practical start, I recommend to look into several configurations to see the general gist of configuration with Nix. Here’s a few I personally dug into:
-
Should I use NixOS?
I feel like this answer is enough but I’ll give my take on it regardless.
If you are looking forward to debugging your configuration which consists of finding multiple sources from the manuals from the website, reading the source code from the appropriate point in nixpkgs, and repeatedly testing your NixOS configurations with each change then this is for you.
Entering the Nix ecosystem at the beginning requires high level of engagement to learn the ropes even if your only intention is to create a basic reproducible operating system ala-Ansible.
-
You’ll encounter vague and unique errors as the likes of NixOS is a unique world (the infamous infinite recursion, anyone?).
-
You’ll appreciate technical writers as the documentation department is lacking.
-
You’ll read outdated unofficial guides, resources, and the source code as you dive deeper into Nix.
-
You’ll get used to the unfortunate UX that is the toolings around Nix (even the revised Nix CLI has its problems).
There’s nothing better with NixOS than the (un)official NixOS experience™.
Once you passed the initial curve and the difficulties that come with Nix, the benefits are immense.
-
Using Nix beyond package management.
-
As a universal build system due to its ability to install and integrate multiple versions of the same program without problems and decent support for different projects use cases (i.e., programming languages, build systems).
-
As a virtualenv-like environment useful for managing development environments.
-
As a way to manage clusters and infrastructure (i.e., NixOS for your installations, nixops for deployment, hydra for continuous integration).
-
-
You can make use of Nix’s large ecosystem of packages and tools from nixpkgs and beyond.
-
It is easier to distribute and verify your builds as Nix also has toolings available for those purposes. [2]
If you intend to use NixOS, I recommend to start small and install Nix on a non-NixOS distro and use it as a way to create reproducible development environment, be familiar to its build process (I recommend reading Nix Pills to get started), get intimate with systemd, and then test NixOS in a virtual machine.
-
-
Any requirements for this setup?
You only need Nix 2.6 installed with the experimental features for Nix command and flakes enabled (i.e.,
experimental-features = nix-command flakes
). -
Hey! I have an error something like
/nix/${HASH}-nmd/
from my installation. Why it doesn’t work?This error seems to be related to home-manager. See the issue at nix-community/home-manager#2074 for more details. Basically, you have to add
--impure
flag when runningnixos-install
. -
What is my experience on Nix flakes?
I LIKE IT! There are still some hiccups like the strict tie-in to Git which leads to strange experience like having to add untracked files just to be recognized. However, this feature is still in the works so no surprise there.
With that said, it is workable to be a daily part of the NixOS experience especially with the benefits of Nix flakes.
-
More user-friendly compared to Nix channels.
-
Just one reference file to know what is being exported from a project.
-
Unification with commonly-agreed schemas.
This feature somewhat helped me understand more about the Nix language, oddly. I guess those lightbulb moments can come from random places.
-
-
Is this based from devos?
Yes but I’ve created this from scratch. One of my goals when creating this config is to use as little dependency as much as possible and to understand more what’s going under the hood with Nix. At the time I’ve rewritten this configuration, I have little idea about Nix as a language and I find devos to be overwhelming so I doubled down to create from scratch.
However, I can say that my configuration is moving in a similar direction to devos (which is intended to be modified anyways) as I explore more of Nix. In fact, I’ve based much of my config from it and may even be ended up as one. It is nice that such a project exists serving as a reference for bigger configurations.
-
What’s up with some error regarding something in restricted mode?
If you found some error regarding something in restricted mode, you can run the installation with
--impure
flag (i.e.,nixos-install --impure --flake {canonical_flake_url}#ni
).