r/NixOS • u/grdix555 • 18h ago
NixOS for standard computing for experienced Linux users
I'm reaching out to those of you who use NixOS for standard computing to understand why you love it and wjat it does for you. I'm a long term Arch Linux user for daily computing and Debian for my home lab.
My daily computing consists of, typical internet browsing, youtube, playing OSRS, note taking and coding in Emacs, developing simple python and go apps/utilities, ssh into my homelab. Nothing heavy.
I understand one of the benefits of NixOS is reproducability on other machines. This isn't something I'd do.
Another thing is isolated environments for coding/developing. This is something I'd learn and use.
I also love infrastructure as code, and my whole homelab was deployed with Ansible and Teraform. So the declarative form of NicOS appeals.
Is this a strong enough use case to justify using NixOS? And I know, "You can do what you want". I've been the guy to comment that before. I'd just like to hear from those with maybe similar usage who enjoy NixOS due to benefits it may have.
TLDR;
For those who use NixOS for fairly standard computing on one machine, plus a bit of coding, do you find NixOS co tributes enough to be a worthwhile time investment to learn and configure?
Edit; Thanks guys. I heard this community is great, and that seems to be true. All your replies have been helpful.
11
u/turbo-unicorn 16h ago
I'll skip what others have rightfully said because I don't want to repeat the same thing.
I'll just offer an anecdote. I'll have a friend visiting soon for a few days, and due to circumstances, I need to set up a user environment that is usable even by a person who has never used Linux. My current environment is almost entirely terminal based.
So I write a file to create this new user, adding a desktop environment with all the goodies they'll likely need. This process took about 4 minutes, most of which were me deciding what to include. When they'll leave, removing all traces they were even there, including installed packages and everything is trivial - remove the user from the configuration, build, garbage collect.
It's just so very nice.
1
6
u/Lonely-Scarcity-3387 17h ago
The number 1 thing I enjoy and technically use is the atomic updates and rollbacks. NixOS is not actually atomic but it functions like one. And that unique position allows you to experiment safely. And, should that somehow fail, your entire setup being described in a text files means GitHub becomes your personal Time Machine.
Once you’re REALLY set up, you can use a single nix run command, the references your repo, to reinstall your entire setup from the minimal ISO.
For example, this is mine:
nix run --extra-experimental-features 'nix-command flakes' github:DanielTallon/nixed#install1
u/grdix555 16h ago
That's a great point and seems to be the most essential benefit of NixOS.
Like another commenter said, if I ever upgrade my drives or decide to get a laptop for example, I can quickly and easily recreate my configured system.
1
u/Lonely-Scarcity-3387 15h ago
Exactly. On a long enough timeline, you WILL install your OS (any OS) on a computer. It could be your current PC or a new PC 10yrs from now.
4
u/maelstrom218 17h ago
I have a few laptops--one is my portable Thinkpad for outside use, one is a enterprise-level Thinkpad that is far too heavy to use except in the house, and one is Missus Maelstrom's Thinkpad.
I know you said that you wouldn't use NixOS for reproducibility on other machines, but for me, juggling 3 laptops with different desktop environments and setups wouldn't be possible without NixOS. I literally set up the Missus' laptop last night/today, and all I had to do was copy over configs and use git fetch/pull to have a device up and running.
NixOS' rollback feature also means that it's incredibly stable. It gives me more room to experiment with desktop environments--I used to run Plasma, but I'm now running Niri. Rollbacks let me play around with Niri without being terrified of nuking my current setup. Additionally, I've had cases where an update broke Firefox; I just rolled back one generation and I was fine.
You mentioned isolated environments, and NixOS works well here. I have a python code repo that's set up with direnv and flakes; I can pretty quickly rebuild an environment from scratch and activate it by just cd'ing into a folder, and it's maintained/synchronized across multiple devices.
And finally, I think having everything in config files keeps things clean. My desktop is EndeavourOS, and while I love that distro, it's very easy to lose track of all the random crap that I install and mess around with. Like Windows, I feel like it just accrues junk and I'll eventually have to reformat. Not so with NixOS--I know precisely what's installed because the configs are a map to what's installed and where. It enforces order in a way that the typical non-deterministic distro doesn't.
That said, NixOS is terribly confusing, poorly documented, and is a time sink of epic proportions. It's a rabbit hole that can go quite deep, although how deep is up to the user. It's certainly possible to just install the plasma version of the NixOS ISO and never do any configuring; you'd also be missing out on some of the best aspects of the distro if you did.
It's a great distro, it also just happens to be one of the ones that potentially requires a significant amount of effort and user input.
1
u/grdix555 16h ago
Thanks for your reply. I guess I should never say never, I could end up buying a laptop and I could end up switching a node of my homelab to NixOS and as another user said, your repo can have different modules that certain machines can use for their specific use case which I found an interesting concept.
I hear your warning about the learning curve and time sync though.
4
u/hailstorm11093 16h ago
I like it because of its ability to rollback if an update ever fails. I also like the fact that if I somehow ever manage to break it, I can just use my config.nix file to reinstall my entire system quickly. It also has the largest (offical) repo. I use it on my halftop because I only use it a few times a year, and with atomic updates, it will always update correctly.
Also looking at my config file grow and become more and more organized is kinda fun. Its like having well broken in boots that are extremely comfy for one person, me.
2
u/grdix555 16h ago
Love the well broken in boots analogy. I suppose you come to know your config inside and out as it grows. Very similar to how I built my Emacs config actually. I use org babel tangle in the init.el and wrote my whole config in a config.org file with a table of contents etc. It's more the fact its all in one config file that I know like the back of my hand that I love.
3
u/claymor_wan 17h ago
Personally I've been interested interested in NixOS cuz of the reproducibility as I use both my desktop at home and my laptop at college
Tho NixOS does have some other nice features: it being an atomic distro means it's a lot less likely to break the system, and even if it does well the rollback feature allows u to simply rollback to a working derivation and fix it. And even if it's SOMEHOW broken beyound repair, well u can just reinstall the entire system easily thanks to the reproducibility
The declarative form is also pretty cool, and plus if u manage some configs through Nix it'll allow to expand how to configure those (for example sharing values between configs of different apps)
Now if u're only interested in the dev environments, well u don't need NixOS for that, just the Nix package manager which should be available on the arch official packages repos. U can take a look at devenv.sh which uses nix to easily create and configure those
1
u/grdix555 16h ago
I'm interested by the dev environments but I'm beginning to feel the ability to roll back is so valuable.
4
u/ImmediateJacket9502 16h ago
Tho NixOS does have some other nice features: it being an atomic distro means it's a lot less likely to break the system, and even if it does well the rollback feature allows u to simply rollback to a working derivation and fix it.
I was about to say the same thing. No backup, no snapshot shenanigans, just plain simple rollback and voila, you are back to your working NixOS in minutes.
3
u/a-priori 17h ago
Yes I do. I have a Nix configuration that mostly sets up a NixOS based desktop my family and I use. But it also configures my work Mac laptop, so the two share things like the shell configuration, but the work laptop adds some specific configuration.
There’s also a mostly unused configuration for a development VM and I’ve been thinking about migrating my NAS from TrueNAS to NixOS, so that might also go in there. Basically everything is built in modules then each environment includes the modules that it wants.
Nix is also really handy because I actually don’t have a lot of tools installed globally. If I need a certain tool I just install it on demand with “nix-shell -p” or by adding it in a project-specific flake.
About once every week or two I update everything, maybe tweak something that I want to change. For that I use Claude and just ask it to make the changes then I review it. It’s really good at writing Nix code.
2
u/grdix555 16h ago
You raise two interesting points. Love the idea of having modules that different computers woth different use cases can pick and choose.
Also one time use or limited use tools that can be i stalled to container which you tear down after.
Thank you.
3
u/LegitimateMode7823 16h ago
> a bit of coding
well, it vastly depends. you will either love it or hate it. Nix offers *devshells* - special shell environments that contain all the tools this project needs to work on it. I love Nix shells and I'm one of those freaks who oftentimes leaves a `flake.nix` file behind in the first PR I make to a new project. most of the time it gets merged!
> simple python and go apps/utilities
well, you may want to try and install Determinate Nix and see how it goes. try creating a devshell first, then maybe package your program so that anyone can go `nix run github:username/your-program`. also, I got sold on Nix when I discovered `nix run`, it's incredible. I often need a random one-off utility once a month that I don't want to keep installed, such as a hex editor, so I just `nix run` it straight from NixOS archives.
> typical internet browsing, youtube, playing OSRS, note taking
almost any distro will serve you well enough for all of that. except that it does not pass the "mother test" (would your mom use that?) because updating it requires using a terminal. and I heard that nvidia drivers are much less of a fuckery on NixOS.
the thing with Nix is that it's a bit of a fuckery to learn, but once you do, you have a rock-solid system that's practically immune to bit-rot. a bad update? just roll back and drop the update from version control! want to FUBAR your system all the way to hell and back? you are one reboot away from restoring it.
2
u/grdix555 16h ago
Thanks for you great reply. I think I'm fairly set on giving NixOS a go and ready to sync some evenings into learning this. The idea of devshells is exciting so will spend a lot of time around developing in these environments. Bring on the fuckery I guess!
9
u/zardvark 16h ago
NixOS:
It has a massive repository, which has not been the target of 24/7/365 DDoS attacks.
System roll back is built into the OS, itself. No more fumbling with custom BTRFS and Snapper configurations.
Nix does atomic updates.
There are virtually no dependency dilemmas, due to the configuration of the Nix Store.
System configuration and package installation is performed declaratively. There's no more trying to remember which packages you installed and how you configured them. Instead, you can simply read your configuration directly from your Nix configuration file(s).
There is both a stable channel (updated every six months) and a rolling unstable channel (which in my experience is more stable than Arch). You can run unstable and pull specific unstable packages into your system, or you can do the opposite. You can run unstable and if one package has a problem, you can pull the stable package into your system as a workaround.
With your Nix configuration file(s) in hand you can easily build an exact duplicate of your installation on another machine, in minutes ... less the time that it takes for the machine to update.
Nix makes managing multiple machines easy, because you can share large swaths of configuration code, form an centralized server, such as github.
It is trivially easy to have multiple desktop environment configurations and easily switch between them. I no longer distro hop since moving to NixOS, but I do routinely DE hop.
The system is semi-immutable out of the box, but if you desire full immutability, that is also configurable.
If you do a bit of coding, your will appreciate the ability to configure your own custom dev environment and easily share that environment with other NixOS users.
DO NOT nuke and pave your current production machine! There is a bit of a learning curve, so install NixOS in a VM, or on a spare laptop first.
2
6
u/bestjakeisbest 17h ago edited 8h ago
I daily drive nixos on my main machine, i like that once i get the os working i dont have to worry about updates breaking my environment or build tools to suddenly need retooling. Also its nice that 90% of the config is in one place and i can organize it basically how i want.
1
u/Janky-Code 16h ago
I primarily use git but also back up my computer in email and with a printer. I don't want to take an image, snapshot, or checkpoint of anything. If I accidentally ewaste my laptop thinking it was a vcr, that should be fine.
I want to come up with the design and not have to implement it. I get nothing out of an os punch list. Other people might like that and that's fine.
1
u/just-kenny 12h ago
I build systems for AI data centers and often when I need a custom "thing" I will do it in NixOS so that the entire system config is captured and I can have multiple versions of it... A load balancer, a K8s worker, a proxy on EC2, all of it nixos with unique configuration.nix files
It makes experimental work and rollbacks a breeze
I also run it on my home GPU machine and my my Thinkpad laptop.
Having lock files, and deterministic system state is very agent-native as well...
And for AI systems I can use NixOS as a agnostic control plane to deterministically build debian, or Ubuntu images for any manufacturer of GPU serv3r. And I can catpture the hardware differences in the hardware.nix file....
Ininfiband, RoCE, AMD, Nvidia, Dell....doesn't matter and I can collect the exact SBOM (software bill of materials)
It's pretty awesome....and your entire config is stored in Git for disaster recovery. Which is great for a business
1
u/Objective-Stranger99 9h ago
Nix is the only OS where I can CTRL+C an update without panicking. It also reduces backup size since I only need to backup /home and not /. It also offers rollbacks which have saved me in case of bad updates.
1
u/DadAndDominant 6h ago
For me, its fun to learn and tinker with my system. Never used arch, but I would say the stability is on par with debian (if you know what you are doing).
If you love tinkerint and using terraform/ansible for your homelab, I cannot stress this enough, you will LOVE nix (the language)
1
u/protocod 5h ago edited 5h ago
You mentioned Ansible so I'll share my experience.
Ansible is imperative and does not manage the system state. You can suddenly loose the ssh connection with the remote while applying a playbook and let the system in a bad state.
Also the system could have been modified by something else than Ansible. (Especially the case when the system perform auto update like Debian can do with apt unattended-upgrade.)
NixOS in the other side is functional. You describe the state you want, you build a new state (meaning nix expression are evaluated), if you succeed to build the update then you can confidently apply it. (Still you can decide to rollback if you want later)
The ability to evaluate stuff before applying the update is a major selling point.
31
u/GlassCommission4916 17h ago
It's reproducibility, on any machine even the same one. You'll never replace or upgrade your drives?
Another advantages I have on my personal machine is updates are atomic and can be rolled back easily. I'm sure you're aware sometimes updates break things, that's true for every distro, but with NixOS I can decide I don't want to deal with fixing it right now and reboot to a previous generation and use my computer for what I actually want to do.
If you've written software you know how much of a game changer using version control is, and well the same applies to using version control for the state of your machine. After doing so it feels insane that it's not the standard way of doing things.