nixos-config/docs/content/en-US/06-faq/index.adoc

6.0 KiB
Raw Blame History


title: Frequently asked questions (FAQ) --- = Frequently asked questions (FAQ) :devos-example-commit: 580fc57ffaaf9cf3a582372235759dccfe44ac92

More like "Most anticipated questions (MAQ)" since almost no one asked me about this yet. :) However, it doesnt roll off the tongue.

  1. Im new to Nix and NixOS, where should I start?

    Oh no, youve seen the multiple configurations from other systems, didnt you?

    I hope youre ready for some time understanding because the learning curve is steeper than the wikipedia:Troll_Wall[Troll Wall]. Ive 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 Ive 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. Heres a few I personally dug into:

    • github:divnix/digga[rev={devos-example-commit}, path=examples/devos]

    • github:hlissner/dotfiles[]

    • github:thiagokokada/nix-configs[]

  2. Should I use NixOS?

    I feel like this answer is enough but Ill 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 github:NixOS/nixpkgs/[opts=repo], 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.

    • Youll encounter vague and unique errors as the likes of NixOS is a unique world (the infamous infinite recursion, anyone?).

    • Youll appreciate technical writers as the documentation department is lacking.

    • Youll read outdated unofficial guides, resources, and the source code as you dive deeper into Nix.

    • Youll get used to the unfortunate UX that is the toolings around Nix (even the revised Nix CLI has its problems).

    Theres 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, github:NixOS/nixops[opts=repo] for deployment, github:NixOS/hydra[opts=repo] for continuous integration).

    • You can make use of Nixs 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.

  3. 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).

  4. Hey! I have an error something like /nix/${HASH}-nmd/ from my installation. Why it doesnt work?

    This error seems to be related to home-manager. See the issue at github:nix-community/home-manager[issue=2074] for more details. Basically, you have to add --impure flag when running nixos-install.

  5. 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.

  6. Is this based from devos?

    Yes but Ive 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 whats going under the hood with Nix. At the time Ive 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, Ive 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.

  7. Whats 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).


1. Or unfortunately from a different perspective.
2. Though, other packaging formats also has those but for Nix, reproducibility is one of the focus.