What running NixOS is actually like day to day, on a server and a laptop
TL;DR: On NixOS you describe the whole machine in config files, build it, and switch to it. Every build becomes a numbered generation you can boot back into, so experimenting is much less risky than on a normal distro. The price is a real learning curve and a different way of thinking about “installing a package”. I use it on a server and a laptop. I picked it because I like it and a friend recommended it, and I value that it is reproducible.
My workflow is that I keep git repos for my desktop and laptop, and I build from them to make the apps and other configs.
Most Linux advice assumes Debian or Ubuntu, and for good reason: they are stable, documented everywhere, and boring in the best way. NixOS is a different kind of thing. It is not a distro with a different package manager bolted on. It is a distro where the entire system, from the kernel modules to the users to the services, is the output of a configuration you write.
The core idea: the system is a build output
On a traditional distro, the machine is the sum of everything you have ever done
to it. You install a package, edit a file in /etc, enable a service, tweak a
setting at 1am and forget. The current state is the result of a history nobody
wrote down.
On NixOS, the system is built from a description. The main file is traditionally
/etc/nixos/configuration.nix. A deliberately tiny, purely illustrative example:
# Illustrative example only, not a real configuration.
{ config, pkgs, ... }:
{
networking.hostName = "example-host";
services.openssh.enable = true;
environment.systemPackages = with pkgs; [
git
htop
];
system.stateVersion = "24.11";
}
You do not run apt install git. You add git to the list, then tell NixOS to
build and activate the new description:
sudo nixos-rebuild switch
NixOS evaluates the config, builds whatever is missing, puts the results in
/nix/store, and switches the running system over to the new version. If the
config does not evaluate, nothing changes. If you remove a package from the list,
it is no longer part of the system after the next switch. The file is the truth,
so the machine cannot quietly drift away from it the way a hand-edited box does.
There are a few useful variants of that command:
nixos-rebuild testactivates the new config without making it the boot default, so a reboot returns you to the previous one.nixos-rebuild bootbuilds it and makes it the default for the next boot, without switching the running system.nixos-rebuild buildjust builds it, so you can check that it compiles.
Generations: every change is a restore point
Every successful switch creates a new generation. Old generations are not
overwritten, because packages live at unique paths in the store and a generation
is mostly a set of links pointing at them. The previous version of your system is
still sitting there, intact.
That gives you two ways back.
From the command line, if the system still runs:
sudo nixos-rebuild switch --rollback
This switches to the previous generation. You can list them with
nix-env --list-generations --profile /nix/var/nix/profiles/system.
From the boot menu, if the new generation will not boot properly or you cannot get to a shell. The bootloader lists previous generations as entries, so you pick an older one at startup and you are back on a system that worked. This is the part that matters most when something goes properly wrong, because it does not depend on the broken system being able to help you.
Two honest caveats, because “rollback” can be oversold:
- It rolls back the system, not your data. Files in your home directory, a database’s contents, anything the system wrote at runtime is not rewound. If a service migrated its data format on startup, booting an older generation does not un-migrate it.
- Old generations do not live forever. Garbage collection
(
nix-collect-garbage -dand friends) deletes old generations to free space, and the bootloader can be configured to show only a limited number of entries. A rollback target you have already collected is gone.
A small example from my own laptop. When I first tried to get the Kali and Parrot tools to install cleanly, it took some playing around. Rollback gave me a clean configuration between tests, so each attempt started from a known state.
Flakes: pinning the inputs too
A configuration that says “give me whatever the package set is today” is only
partly reproducible, because the package set moves. Flakes address this. A
flake-based config has a flake.nix that declares its inputs (for example, a
particular branch of the package collection) and a flake.lock that pins those
inputs to exact revisions. You commit both, and the same repo builds the same
system tomorrow, on another machine, or after a disk failure.
You then point the rebuild at the flake:
sudo nixos-rebuild switch --flake .#example-host
One thing to know going in: flakes have been usable and widely adopted for years, but are still marked as an experimental feature that you opt into in the Nix settings. Plenty of guides assume them and plenty of older ones do not, which is a real source of confusion for newcomers. The status of flakes can change, so check the current NixOS documentation.
Why it fits a server especially well
If you have read about git-push-to-deploy for a homelab, NixOS is the same idea applied one layer lower. There the rule is that the containers only run what is in the repo. With NixOS, the host itself only runs what is in the repo. The operating system’s configuration is a text file that goes through commits, diffs and review like any other code.
My own server is set up this way: a dedicated machine configured with NixOS,
with its configuration kept in a repo, and a push to main is what deploys an
app. The idea behind it is that the repo describes the machine, so rebuilding it
means running the config rather than remembering what you did.
The same instinct is behind pinning your Docker image tags. Pinning an image, pinning a flake input and committing a lock file are all the same move: decide when things change instead of letting them change under you.
What was easier and harder for me
One thing that was easier for me than on something like Debian: NixOS keeps track of everything, because it is declarative.
Gaming is the harder part. It is easier on Windows, and on Linux I have to research each game. My desktop dual-boots Kubuntu and Windows, because I want to play Windows games.
The learning curve, honestly
This is the part people ask about, and the general picture is fair to state plainly.
- The Nix language is its own thing. It is a small, lazy, functional language. Config files look like data but are code, and the error messages can be long and indirect, especially at first.
- Things live in different places. There is no conventional
/usr/binfull of everything. Programs are in the store under hashed paths, which is what makes the whole model work, but it also means a downloaded binary built for a normal distro often will not run without help. Prebuilt generic Linux binaries commonly fail because they expect libraries at standard paths. - You do not edit
/etcby hand. Many files there are generated and read-only. Changing a setting means finding the right option, setting it in your config, and rebuilding. The option search on the official site is the tool you will use most. - Documentation is scattered. The manual is good and the community is helpful, but you will often combine the official docs with blog posts and other people’s public configs, and some of those are out of date.
- Day-to-day use gets easier. Once the shape of it clicks, most changes are “add a line, rebuild”. The cost is front-loaded.
Whether that trade is worth it depends on what you value. If you want a machine you set up once and rarely touch, Debian or Ubuntu will serve you well and ask less of you. If you tinker a lot, run more than one machine, or want to rebuild a machine from a repo, the up-front cost buys something real. Gaming is a reason to think twice.
The case for it, in short
- The configuration is the system, so it can be versioned, diffed and copied.
- Every change is a generation, so a bad experiment has an exit.
- Rollback is available even when the new system will not boot.
- The same description can build more than one machine.
None of that removes the need for backups of your data, which is the thing rollback does not cover.
If you are starting out
My advice is to learn programming and hardware fundamentals first.
Beyond that, try it in a virtual machine first, keep the config in a git repo from the first day, and make small changes with a rebuild after each. Small steps mean that when something breaks, you know which line did it, and the previous generation is still there to go back to.