23
votes
Has anyone ever used NixOS as daily-drive distro?
I'm impressed by reproducibility of NixOS, configuration mechanism and Nix package manager, but how it would be in daily-drive use? Is it worth it?
I'm impressed by reproducibility of NixOS, configuration mechanism and Nix package manager, but how it would be in daily-drive use? Is it worth it?
Still do (and nix-darwin on Macs).
It's not for the faint of heart, I can tell you that much. The documentation situation really leaves much to be desired and because of the declarative nature thereof, an update to libraries with a ton of dependents such as glibc requires you to re-download pretty much everything.
On the other hand, me setting up a new computer (or setting up the same computer from a wipe) is now more or less:
And then I have pretty much everything set up the way I need it to, on macOS that's my terminal environment taken care of, on Linux, everything from the specific version of Nvidia drivers for my desktop to my firewall rules to the daemon that configures my Logitech mouse are all set up. It took effort to get there, but once you're there, it's like a magic trick.
Appreciate you! That feature of NixOS is what makes me think about migration to it. Beside that, how did you learn NixOS? Can you share some useful resources or give an advice?
Thank you!
Argh, I typed up a reply but forgot to post it.
For me it was a lot of googling and a lot of trial and error so my approach is not recommended.
I recommend going through Zero-to-Nix on your current Linux distro then if you like what you see, install NixOS.
Your operating system config file is going to be at
/etc/nixos/configuration.nix
-- you can start messing with it immediately (and if you break something, Nix will allow you to roll-back to a previous system, so it's relatively risk-free.) You can learn more about NixOS config files at https://zero-to-nix.com/concepts/nixos.Is this a human effort issue, or just bandwidth/compute? I've been vaguely thinking of testing it out as a more bare-metal alternative to Docker, and I wouldn't be worried about leaving the machine to do its thing for a little longer while updating, but I know myself well enough to know that if there's extra manual overhead as well I'm likely to postpone updating things at all for longer than I should!
That's a big part of why I'm interested in it in the first place, to be honest: my baseline Ubuntu installs always pick up so many ad hoc package installations and config changes and
TODO: come back and sort out this mess
notes when I'm on a tight deadline and just need something to work that I'd rather put in the effort up front for a system that keeps things organised by default. My main concern would be whether imposing that organisation adds overhead that discourages changes later?In my experience it’s a bandwidth/compute “issue.” I put issue in quotes because my internet speeds are quick. I’ve also setup automatic updates which are amazing. Unless you’ve made unusual customizations to packages like glic updates will simply consist of downloading binaries.
yeah, bandwidth. it's a non-issue for some people but a rebuild of most packages for me is a 14GiB download which isn't instant
That's super nice, but I guess it's more a tinkering thing? I mean, I switch laptop every 5 years, so for me setting up a new computer isn't something I do often. And I'd guess the time spent on figuring out things in NixOS is greater then me just re-installing everything on my new laptop in 1 day. In case of laptop failure, well I do have a full system backup which does incremental backups every week.
Not really, no. Having to hunt down and/or remember every single tiny config I do to get weird USB devices working/the screen to stop flickering/etc, sometimes even when I just update my computer and not reinstall a distro turned me off of daily-driving Linux in the first place. Nix takes that mental load off.
Okay, but there's also added mental load? In the form of figuring out why 'package x' doesn't behave like it would on a "normal" distro.
Sure. But once you figure it out once you can forget about it semi-permanently.
This depends on entirely how you use your computer. Do you mostly use things out-of-the-box? If so, I'd agree, this probably doesn't sound particularly strong. If you take the "system-crafter" approach of investing in customisation with the long view in mind you might accumulate much more state. I run various bits of nix on all of the computers I use, and it is far far far far cheaper to replicate a few kb of text than gigabytes of full system backup. I also use nix for work, so if I get issued a new corp laptop I spend zero time setting it up.
If you are a dev then it gets even more compelling in terms of reproducing evironments sharing scripts / packages across operating systems etc. If you don't have any problems it solves then it's probably just niche for niche's sake, but I'd say anyone that uses a computer for long enough will one day wish they had a succinct way of capturing the essence of the state of their computer without the attendent cruft. Nix is that.
I'm a dev, I've done both approaches. Currently I try to setup everything as much out-of-the-box as possible, and the rest I run in Docker. Through the years I've always been shifting OS's as well:
5 years Windows: until I get tired of all the bloat, inconsistencies and updates
5 years Linux: until I get tired of having to spend hours fixing Wayland glitches, or Flatpak issues, or...
5 years Mac: until I want to play games again :D, and being disgusted by Apple's pricing, walled-garden and handholding approach
What does that workflow look like? Are you using something like vscode dev containers? The thing that I really really like about nix is how it combines configuration and code in a single closure which once you get the hang of it is difficult to imagine living without. The snippet below is a heavily redacted snippet of what I have to install my shell (fish). It is effectivly a function that takes many arguments one of which has to be a package set, which returns a config map which causes
${pkgs.terraform}
string interpolation syntax expands to the input-hash addressed path that terraform is stored under and installs terraform at the same time. The beauty of this being that in order to refer to the path of a package it has to be installed. Configuration + closure. This snippet will never be missing it's dependencies, even if terraform somehow isn't available on the path. For funsies I also include a bit cross platform stuff. I run linux at home and travel with a macbook. I use the same set of nix expressions to manage both.isDarwin
checks which platform I am on and selects the right way for me to get my md5 hash.I'll do another one: have you ever just wanted to refer to a script and not wanted to care about naming it? I do all of the time, and nix frees me from having to care about it. Another redacted snippet, this time setting up the MFA process to pull OTP codes out of a nitrokey for AWS. This generate my
.aws/config
file and installs bothaws-vault
andpynitrokey
and a small script that tidies up the nitrokey script output. I don't care where the script lives, and with nix I don't have to name a path, it's just input-hashed. It's also guaranteed to exist as long as it's referenced by the config. Win win win.I don't know about you, but my computer is littered with this stuff, and now it's trivial to evolve, track and rollback from (switching config takes about 10 seconds typically). I can't see myself going back to anything else that doesn't at least bear a passing resemblence to nix.
That's actually amazing. Thanks for your extensive comment! What I meant is that I run all of my dependencies inside containers: postgres, elasticsearch, nginx, ngrok,... Then there's other things like configs, which I just sync to github.
That makes sense. If you aren't regularly mixing config and code then the dependency linking doesn't buy you much, and you still have to deal with ejecting the FHS, which isn't an obvious win at all.
I have sort of used it as a daily driver during Uni on a shitty corebooted Chromebook. With i3wm and a Celery processor, It runs day to day fine.
Nix-build though may take a fairly long time to finish.
It is not a distro I recommend honestly based on my use cases(More for desktop, I don’t develop or need to rebuild multiple machines)
But I stick with for some of its features
Generational builds, never running into dependency hell, atomicity and reproducibility(which is also a negative point).
I don’t use it for gaming or as a main machine fwiw, but I tried to run a game from gog that has a native Linux version and I still can’t run it, nix-ld and some weird things need to be done first.
Documentations are kind of poopoo, I tend to rely on old blog posts or other things to configure things like syncthing and kde connect(though usually you only need to do them once anyway).
That’s sort of my stance about it as “Someone that knows how to use computers a good amount but isn’t a programmer”.
Yes! I have started it using it this past summer, with relatively no programming background. It is a lot of upfront time for long term payoff which is why i decided to learn it. In terms of resources I highly highly recommend videos by Vimjoyer on youtube, ill link some of the main ones I found helpful. I also joined his discord, and the people on there are super super helpful. Like I said I am not a programmer by any any means but through their help I feel way more confident about nixos, and I use hyprland, home-manager, and flakes so there was a lot of new learning on my end.
My tip is to use flakes, I can't really tell you what they are beyond ensuring youre pulling from a specific source, but I think they probably make more sense if you are a programmer of some sort
this is a useful flakes guide
this is his ultimate guide and it is I think what i followed most in getting setup
And again his channel in general covers just about everything you need to get started. Fwiw I really like hyprland so if you're up for the challenge i say go for it! There are a lot of helpful resources on the channel, and in his discord!
In terms of packages I recommend using Search.nixos.org to search for things!
Oh another tip I have is to move your nixos config, I have mine in ~/Documents/nix which is also tracked by git! The only thing you need to change in your command is just specify a path, so for me the command is
nixos-rebuild switch --flake ~/Documents/nix
(also sidenote I would alias this, I have mine set to rebuild-nix)You are welcome to explore my git repo located here (I know it says i don't know what I am doing, but everything works quite well, and I tried to comment stuff as much as possible)! and feel free to ask if you have any questions! I really like nixos, and it was definitely worth the effort to learn! I run it on my desktop, and my laptop which you can see in my config, I have two directories in the host directory.
I ran NixOS and home-manager on all my machines for about a year using flakes and deploy-rs.
The upsides were nice:
NixOS is among the largest package repositories, so what you want to install is likely available already, and it often takes just a single flag to install something with a sane base configuration.
This is especially nice for self-hosted stuff (e.g. an RSS reader). Instead of messing with Docker containers (though you can do that too), you just flip a flag, and it installs postgres and whatever other dependencies are needed.
Configuration can be versioned with git and is mostly shareable between machines, so you can have the same shell configuration and whatnot even when SSHing into a server, and deploying the configuration to said server is trivial with
deploy-rs
.However, compatibility was a big problem for me:
I've migrated off of NixOS a few months ago and switched to Bluefin, which is an immutable distribution based on Fedora Silverblue, and I'm very happy with that decision.
Just like NixOS, the system root is immutable, and it automatically updates to new versions in the background using OSTree. Almost all apps I need are available via
homebrew
or Flatpaks, everything else is either distributed as an AppImage -- that just works --, or in the usual way (e.g. Python pip), and if something is really missing,distrobox
can run packages from other distributions in containers, though I haven't needed to do that so far.While I can't speak of the long term yet, so far the distro has been rock-solid. Easily the least problems I've ever had with a Linux installation -- less trouble than Ubuntu, even Debian and god-forbid Arch; it just works.
For future reference or anyone having issues with Appimage on NixOS. Install
appimage-run
. Then you canappimage-run my-appimage
from the terminal. In my experience that solves the vast majority of appimage problems.I considered mentioning
appimage-run
but the comment was long as it was.It didn't work for me, as the software I wanted to run with it (pCloud) was using libFUSE and that was broken with
appimage-run
. I spent quite a bit of time trying to fix that. pCloud is also packaged in NixOS, but (used to be?) in a permanently broken state.I’ve been daily driving NixOS for a few years now. My suggestion for new users is use flakes. I find they make channel[1] management, using libraries, and managing multiple systems much easier. It’s also worth picking up home manager sooner rather than later.
I disagree with the common sentiment that Nix documentation sucks. It has sharp edges, but being able to copy paste config from the wiki or manual is way nicer than following a 30 step guide. The Nix organization has been making progress on improving documentation too (ex. the wiki is official now, rather than community ran).
As mentioned elsewhere, search.nixos.org is great for finding packages, BUT it’s also awesome for finding configuration options. For example search for
pipewire
to see all its config options.Other people’s configurations are also a great learning resource. Copy paste different configs and see what they do. You can always rollback if you don’t like the changes.
[1] channels are roughly equivalent to Ubuntu versions (22.04, 23.10, 24.04, etc)
Yes, and it was a glorious nightmare. NixOS is fantastic, but temperamental and absolutely taxing on the mind to set up properly. I never used flakes, but everyone says you should, some suggest "newbs" should use it, others strongly suggest against it. Use flakes.
I would 95% suggest daily driving it. I still prefer just running Arch1(through EndeavorOS, the "modern" Antegros), but running it with toolbx on the inside. That way I can spin up "mini-archs" in containers that are entirely mutable, but configurations can be exported to be rebuilt (like a NixOS Configuration), and "if things go wrong, it’s easy to throw a toolbox away and start again", I have atleast 15 running all with different configurations and different distros (AUR, and DNF, and APT on one system???)
A good article other than the official link is, as usual, on the Arch Wiki. You can set it up with Nix or any other distro, but Arch is just a love of mine 1.
1. My fourth computer love of all time.
I have been using NixOS as a daily driver for a bit over 6 months now, I used a lot of other distros in the past from the more vanilla Ubuntu, through Arch to some of the more different ones like Fedora Silverblue.
A coworker told me about it and linked the NixOS: Everything Everywhere All At Once video by No Boilerplate and also the aforementioned Vimjoyer and I fell in love with the idea.
I use it for everything: Browsing the internet, gaming, and some coding - mostly Python and some C++. I actually cheat a bit due to how special some of my things are. I really like a lot of the concepts NixOS has, but I don't really have the time of day to learn all these new paradigms so I have some pet containers with Distrobox.
All-in-all, if you do more than just some basic stuff (and I would include gaming on Steam under basic stuff) there is some learning curve to it and it can be quite daunting. One more thing that I think I would recommend, aside from the things others have recommended, and it's a habit I picked up while using Silverblue, would be using Flatpaks. They get you far and are hassle-free.
I have been thinking about this recently and definitely have been annoyed at some of the sharper edges, especially when it comes to programming or running programs that aren't in the Nix or Flatpak repositories.
I love NixOS, and I am probably going to switch to something more "vanilla" again.
Second the video! It was what got me hooked on nixos!
I tried for six months and couldn't get into it for a couple of reasons:
I wasn't using advanced tooling like nix-home and nix-flakes. These would've made life easier from a deployment/maintenance standpoint. Integration with Plasma wasn't quite there, though, so I didn't use nix-home until I tried using
nix
on other distros.ad-hoc binary apps: You either need to write your own configs for these or find somebody who did, or get Distrobox set up. I couldn't get Distrobox set up two years ago, so this was a bit harder for me.
I wanted an immutable, adjustable system which is not what Nix is intended to provide. Nix is intended to provide a declarative system first and foremost, which it is brilliant at. I enjoyed learning it, am happy I did so, and is an absolutely amazing system.
I moved to Aurora, with a custom image to add packages, Distrobox where other distros (mostly Arch) has packages/tooling that works for me, Flatpak, and WINE for everything else.
I've used it on my main desktop and laptop for ~5 years.
Pros:
, <package>
in your shell to run a packageCons:
I've used it daily and I honestly don't have many serious critiques with the tech.
Yep, I daily drive it here, and it's what my entire homelab runs on.
I went to nixos as an alternative to my overcomplicated K8s homelab, and nix fills the gap nicely, everything just works once setup.
I've used it for over two years during my study, and currently still use it for WSL.
It's probably the most relaxing way to use Linux imo. All of the setup and removal is handled for you behind the config.