10 ms·
NixOS and my descent into insanity
- smoldesu 3y ago> At this point I had a home.nix that spanned a couple of thousand lines. This is a bad idea, mostly because it's hard to manage. This has also been my experience with home-manager. The promise is great - it's like DLC for Nix that just Does More™. Then you get into it, and realize the modules are a lot more fragile and most of them are outdated. Then you're a few hundred lines in with workarounds, DBUS declarations and all sorts of declarative ricing and go "is it worth it?". Since then I just removed all the home-manager stuff and relied on NixOS' native config. Things are much more stable and easier to define, and I haven't found a whole lot of things that are truly undoable without it. It's slower and non-declarative, sure, but my sanity is all the better for it. I hope I'm not the only one out there.
- k__ 3y agoSad to see the Nix team can't get UX right. Their technology is on point.
- smoldesu 3y agoIronically, the Nix team is the one providing the best UX to me. It's more that many community solutions are stale and broken, despite being well-made and thoughtfully designed. I'd like to make home-manager work for me, but I struggle to in practice.
- CuriousCosmic 3y agoThere's a massive push to improve UX but it'll take time for things to happen and it's only really just in the last few years that nix has gained the popularity in industry for there to be more than just a few groups spending engineering hours towards improving things.
- fnordpiglet 3y agoI think this is the right path. Get the guts working right and stable, then make the useful thing usable. That last bit is by far the hardest, but trying to make something usable useful is impossible.
- smoldesu 3y agoIt's been said many times and many ways, but the big thing will be the push to flakes. If they can bump that to stable before the project and it's integrations lose momentum, Nix might just become the defacto build system for Unix software. The development experience of flakes is just unreal. Having seen it in-use at work was eye opening: - You get all the Nix goodness, including package/dependency caching for multiple OS/arches with minimal configuration. Build times are practically reduced to automated searching and downloading. - Dev environments are much cleaner and not spread across READMEs and makefiles. Adding a build dependency is one (1) SLOC in flake.nix. Adding environment variables is trivial, and it all gets shared with your branch. - Invoking a quick 'nix develop' drops you into a shell w/ build dependencies, `nix build` builds the program, `nix profile install` adds it to your current environment, etc. The list goes on. It will clean up shop once dev teams find out how little configuration is required to get this all working, if Nix move fast enough to ship this.
- fnordpiglet 3y agoI think you’re likely right, but as has also been said many time and many ways, the documentation is truly terrible. I don’t know why there isn’t a good documentation set that takes you from nix to nixos to flakes. When do I choose nix shell? Flakes? nix-env? I’ve got a few months between gigs and I’ve been flirty with nix for a year or so so I plan to dig in and master it, but it is mind bogglingly hard to get started.
- SuperSandro2000 3y agoWell, for most other distro you also Google around and back someone together all the time, we just got used to it.
- theLiminator 3y agoI want to try nix, but honestly can't justify the time investment when pop_os just works for me.
- esafak 3y agoAs a fish user interested in Nix this put me off looking into it.
- rgoulter 3y agoAs a fish user on NixOS, I'd say nix is still worth looking at. The fish-related issues came from trying to manage the whole of the fish configuration with Nix. I think that's a fairly niche thing to want to do.
- 0cf8612b2e1e 3y agoBut isn’t that the Nix promise? That I can have a fully reproducible system defined by a few configuration files?
- jahsome 3y agoWhat I've come to realize is while yes nix leads to absolutely bullet proof "reproducible" environments, there is seemingly very little care or thought about anything that comes before the build, i.e. the user experience for creating a configuration.
- rgoulter 3y agoGenerally, Nix's strength is allowing for reproducing software behaviour, yeah. I'd say NixOS's declarative config more/less covers the config files, where on non-NixOS you'd edit the files under /etc (and hope you didn't break anything). Whereas, Home Manager's declarative config is more/less the stuff underneath $HOME or the XDG config dir. Turns out that a few things with fish shell don't work with a purely declarative config. (e.g. the universal environment variables are stateful). For myself, I don't rely on writing all my configuration in Nix files. I configure fish shell using config.fish. (Though I do use HM to symlink the config file).
- temptemptemp111 3y ago[dead]
- 3y ago
- zellyn 3y agoIf I understand it right, https://getfleek.dev/ https://getfleek.dev/ will turn a simpler yaml config into home-manager/nix/flake config. Might be a simpler way to get started. Haven't started down into the Nix abyss myself though…
- bryanlarsen 3y agohttps://www.jetpack.io/devbox https://www.jetpack.io/devbox converts a simple json config into a nix dev environment.
- klysm 3y agoYAML appears simpler but usually isn’t if you want to do anything hard
- IshKebab 3y agoWell this is enough to put anyone off Nix. Such a shame because the abstract idea is obviously a good one. But every time Nix/NixOS comes up the story is the same. Terrible UX. Terrible documentation. Is Guix any better?
- reidrac 3y agoMy Guix experience wasn't great. IMHO the people that love it will give you a non realistic view of it, so I recommend you listening to those that didn't like it that much but still like it. I installed it on Debian, and there's no uninstall. Sure, at that point I was already frustrated, but IMHO that's just a sample. It wasn't for me.
- rgoulter 3y agoOver half the blogpost is the user describing how they were able to get nix set up on a machine they don't have admin permissions to, and had a 4 GiB disk quota limit. Those constraints don't really apply if you have admin control of your machine. (And the troubles in the first half were caused by zealously diving deeper with Nix, after an initial simple setup went well).
- rowanG077 3y agoI tried and found it even worse. Impenetrable language, worse documentation, less packages unless you use nixpkgs anyway...
- markstos 3y agoIronically, there are lots of blog posts documenting how people worked around the poor documentation, but seemingly few fixes being made in the upstream docs themselves. The excellent Arch Linux Wiki demonstrates that high-quality community-maintained docs are possible.
- takeda 3y agoI think the problem is people are assuming that Nix is just one another tool. In reality Nix is a programming language. It is a relatively simple language, but it is also functional and lazily evalated. And while the language is simple, its stdlib (nixpkgs) is actually puts another abstraction layer on top of it which is quite complex. I do think though that Nix should do the same thing other programming languages do: identify what the nix stdlib is, move it to a separate repo with its own release schedule and ensure that whatever is added to it/removed from it is documented. This won't help author of this blog, but it would be a great help for anyone who is willing to go through Nix Pills.
- rgoulter 3y ago> Home-manager needs to add a channel to install it. This will not do. FWIW, I see that nix-portable does support nix flakes, and home-manager also supports nix flakes. (And flakes are a feature which replaces use of channels).
- unshavedyak 3y agoYea, i'm using home manager with flakes. Though i forget what initial setup is like. I've found bootstrapping new systems to be a bit odd with Nix + Flakes.
- jm4 3y agoNixOS is awful except for everything else out there. The learning curve is... steep. The documentation sucks. You have to learn a new OS because a lot of your prior Linux knowledge no longer applies. But, man, it's so slick when you get it working. It's so easy to understand your system and how it's set up. There's no weird stuff changing between updates that you don't know about. You don't have to merge new configurations. It's so easy to try something new without changing your system. Rollbacks are awesome. It's easy to move your config to a new machine or keep multiple machines in sync. My machines were constantly getting out of sync as far as packages, versions, config, etc. and it was a headache to maintain them all the way I like. Not anymore. It's so easy to maintain working NixOS systems. I have the same packages, users, and config on my machines without having to think about it. I have automatic updates going where I get a new system when I reboot. It basically works like an appliance I don't have to think about except it's set up the way I want it instead of how someone else decided it should work. There are so many nice things about NixOS, but it sucks. It's the worst thing out there except for everything else. I hate it and I feel like I can't go back either. I would love a NixOS-like system with a better language, documentation on par with Arch, and the reliability of Debian.
- SuperSandro2000 3y agoPrior Linux knowledge still applies and is required, it is just managed differently. Another language won't change much. Debian reliability is outside of core packages a myth and Debian has no way to properly migrate configuration. Every major update is a wild rollercoaster ride were things might break in the middle.
- textread 3y ago> Another language won't change much. Why do you think Guix+Guile isnt a substantial positive change?
- kaba0 3y agoWhy do you think it is? The problem with Nix is not the language, it is mostly the ad hoc, grown over time “standard library” for packaging programs. It is just hard to know what that magic buildXPackage function does, or sometimes even where it is. You basically have to grep through the nixpkgs repo to find these things. The language is very small and is a great fit for its domain.
- benreesman 3y agoLe sigh, another day, another group of people turned off on NixOS for completely legitimate learning curve, documentation, and support reasons that are nonetheless heartbreakingly fixable. It’s never the user’s fault. Home manager is a well-intentioned and technically well-executed piece of software that is nonetheless a disaster as the “how to do dots on Nix” story, especially for newcomers. We need “Home Manager Light” or something. I’m a fucking serious Nix-head and I procrastinate doing anything serious to my dots like getting a root canal.
- skulk 3y agoOn the contrary for me, playing around with nix and nixos is how I procrastinate everything. It's incredibly effective.
- jahsome 3y agoI find nix incredible but the thing that I struggle with is trying to figure out how to do things on nixpkgs, and home manager in particular while not using nixos. This is a critical use case for the apprehensive crowd like me who is averse to distro hopping, let alone willing to take on the paradigm shift of Linux-to-nixos. The documentation for either is all but non-existent and the pages I can find are glorified source or man pages. Given how scalable nix, in the right use case, can make things, that's just not the modern experience it should or could be.
- rch 3y agoNixpkgs is also critical for non-apprehensive people who nonetheless need to use MacOS and other distros on a daily basis.
- jahsome 3y agoGreat point. My $dayjob use case is the same, but probably worse (windows + wsl).
- taffit 3y agoI completely agree. I'm also trying to wrap my head around Nix on a non-NixOS system. My requirements are to just manage my dotfiles (successful with home-manager) and configuring my system/installing certain packages, so everyone on the host can e. g. start a docker container with Docker installed by Nix. Ideally all with flakes. I suppose, I can't have the second part without NixOS, though ...
- skulk 3y ago> It looked cool, and I was getting kinda sick of Zsh being slow in big Git repositories. Sorry, what? If your zsh is slow in a big git repository, that's on you, not zsh. I honestly have a hard time taking anything else in this article seriously after reading that. edit: the article is good. I was being harsh. Nix is horrible, and yet I refuse to use anything else.
- aendruk 3y agoThe author acknowledges this in the next sentence. A charitable reading would be that “Zsh” means “my Zsh”. > I was getting kinda sick of [my Zsh] being slow in big Git repositories. Instead of fixing [my Zsh], I decided to give Fish a shot.
- fnordpiglet 3y agoThat’s a shame because the rest of it was pretty insightful and descends into a deep hole of interesting hopelessness. I think you took things too seriously, they clearly are lark hunting - which is beautiful to watch because that’s where learning happens.
- femiagbabiaka 3y agoYep, UX is a terrible issue. FWIW, I went through this too and after swapping to flakes and getting familiar with the ecosystem, I feel like I just "get it" more. There are still idiosyncracies of the language and the magic that is done in Nix core libraries that are frustrating to work through, but for 99% of daily tasks I feel better. I had a similar learning curve with Rust. It's worth it for me! So tl;dr don't be too put off by the learning curve, it's not impossible, just more than it should be.
- bouchardm 3y agoNixOS is by far the most stable piece of software I used. Yeah, it can be hard to get something working, but once you do, you can be sure it will work anywhere.
- pcwelder 3y agoWould Chatgpt help in accelerating the learning process? Does it understand Nix well enough to be useful?
- fnordpiglet 3y agoMy experience has been it generally does but not with newer more emergent things like flakes.
- markstos 3y agoI tried using Google Bard, another LLM for learning Rust, and it had no awareness that solutions were specific to certain versions of software. So it would give me confidently wrong solutions for outdated versions of the software.
- Macha 3y ago> There is one notable exception to programs I am not managing with home-manager, and that's SSH. Although it's pretty easy to use home-manager to manage SSH configurations, I'd prefer the security-through-obscurity of people not knowing my SSH aliases (since, y'know, I'm making my nix configuration public). Tip I use for this: End your ~/.ssh/config with Include ~/.ssh/config.local . Write ~/.ssh/config with whatever you're happy being public. Write your aliases into ~/.ssh/config.local. SSH will just ignore it if it's missing.
- DrDroop 3y agoThis is a shame to read, I've thought of learning Nix for basic devops tasks and avoid tools like Ansible. Is this critique true for Nix in general or just NixOS?
- aliasxneo 3y agoAs with anything, "it depends." I think Nix and NixOS is great for personal and hobby stuff, but I cannot in good faith recommend it for anything professional. I personally run my daily driver on NixOS and haven't had any desire to change, but I'd prefer to never have to write an actual line of Nix code again.
- rgoulter 3y ago> I cannot in good faith recommend it for anything professional. What separates the professional from the 'personal and hobby stuff': the need for (timely) reliability, and that you want other people to be able to maintain it. With Nix, because it's so strict, it's more difficult to quickly kludge a solution. If something doesn't work as you expect, it may demand understanding of different parts of the solution stack. That Nix isn't widely adopted means it's harder to find e.g. StackOverflow answers for problems. In the blogpost, an example of a problem they had to work around was that fish's configuration expected to work statefully in a way which didn't work well with Nix's Home Manager's declarative nature.
- ParetoOptimal 3y agoWell... note that this is a critique but the conclusion encourages using Nix anyway. The whole "Nix sucks but everything else sucks worse" idea.
- takeda 3y agoTo me it sounds like criticism of someone who jumped on it but did not want to read documentation, then also spent second time of the blog trying to have Nix run on an unprivileged account with small quota. As for devops task, if it is something that you plan to do and many other users already did than it should be fine. If you are not happy with existing solutions and want things done your way, or it is an uncharted territory then you will need to go through the steep learning curve.
- mohsenari 3y ago> Now to figure out what a "flake" is… Flake is a worthwhile addition to Nix that is worth learning. But like anything Nixian, it's not straightforward. Have you checked out any of the tools that aim to simplify Nix experience? We built Devbox (https://github.com/jetpack-io/devbox https://github.com/jetpack-io/devbox) with this in mind.
- smasher164 3y agoI don't really have a need for home-manager on a single-user NixOS system. Whatever configuration home-manager would typically manage is now contained in my global configuration.nix.
- kaba0 3y agoHome-manager has a lot of options for configuring packages available through it though. You have to manually write config files in your global configuration.nix for “what color should be the fg in this terminal”, while home-manager will provide an attribute even for that. Also, you can use home-manager from within your configuration.nix, that’s how I use it! Then you don’t have to deal with it separately and everything is at one place.
- smasher164 3y agoYeah, I admit that home-manager is already decked out with all of these options. There's some more manual effort that goes into using configuration.nix here. That being said, I've been seeing more software being packaged up as nixos modules. For example, you can configure a git installation globally now.
- takeda 3y agoI'm a single user and still use home-manager. And I wouldn't be surprised that's the majority of cases. The thing is that while NixOS configuration.nix also contains modules for software, it primarily concentrates on global services and might not have modules for programs that are meant to be run under user.
- takeda 3y agoFeels like the problem people have is they are approaching Nix as a tool, instead of a programming language. I see author just dismissed tutorial, because it was "too technical" for him. I think if you don't have patience to get through nix pills, nix is likely not for you. You won't have enough patience. Also few things: - he decided to manage sway via home-manager, then got suprprised that after he made changes to its configuration and run "home-manager switch" it restarted the service - when searching for installing nix on another machine, he tried nix-user-chroot, nix-portable, proot. He pointed out that nix-user-chroot is abandoned. The reason is that it is no longer needed, what he wanted to do can be done with statically built nix[1] [1] https://youtu.be/6Le0IbPRzOE?t=4282 https://youtu.be/6Le0IbPRzOE?t=4282 - I recommend watching the whole video (especially once he starts doing demo at 14 minutes) as you can do a lot of things you might not even know it was possible.
- klysm 3y agoLast time I did nix things, the language docs were not good. I’m fairly comfortable bashing my head into hard things for long periods of time but it was very hard to squeeze answers out of the internet.
- takeda 3y agoFor me it took some time. Finishing Nix Pills was enough knowledge to start looking into nix and nixpkgs manual and understanding it. I still get frustrated that some new features that are being added are undocumented, though I also noticed that the nixpkgs documentation by default is set to last stable version. This means changes could be delayed by even 6 months. And given how rapidly nixpkgs change that could be the reason.
- rewgs 3y agoI'm 100% sold on the idea that the Nix model is, generally, the best way forward. But time and time again I hear the same thing: the documentation and UX suck. Until I hear differently, I'm just gonna stick with my battle-tested shell scripts and symlinks. Sure, it's not the same degree of reproducibility, but also I've not yet had a practical reason to need whatever remaining percentage of the diminishing returns Nix offers that I'm not getting, at least when using my scripts combined with the use of other tools such as venv, nvm, cargo, etc, or even just building a lot of software from source.
- Niksko 3y agoNot the best thing to see pop up on the day that I'm supposed to get my new work laptop that I plan to nixify using home manager... I guess since I'm going to be running nix inside of MacOS it's a little less disastrous if I have to just pack it in and uninstall.
- totallywrong 3y agoI think Nix is cool as a dev tool, but I have near zero interest in NixOS. The newer immutable distros (CoreOS, Silverblue, etc.) get you the actually important features and it's still good old Linux. I'm talking about (easy) declarative config, atomic upgrades, and guaranteed rollbacks. I don't need any more than that.