Live data from Hacker News

NixOS Linux

nixos.org

21–30 of 82 posts

Re: NixOS Linux

#21
post #2

Just to see if I understand, does this mean you might end up having dozens of libcurls?

Yeah, you potentially could.

Generally you don't specify a specific version as a dependency unless it's necessary, but when 'building' the system, specific versions are used. If things break during an upgrade you can roll back to the previous version. Keeping those older builds around will mean keeping older versions of the packages used in those builds (libcurl, for example). Periodically, you can purge older generations (i.e. builds) and collect garbage, which will clear out packages that aren't used anymore. It would be very strange to end up in a situation where you had dozens of instances of libcurl _being used simultaneously_ (though I guess that would be possible if lots of packages had very special requirements, and ended up building libcurl with different flags or something).

There may be circumstances where you have a _specific_ version dependency, and you can specify that too. That would mean having multiple copies of the same package, even in a single generation. Obviously this usually means major versions, so you don't usually see _dozens_ of them. Having specific dependencies on minor versions would be a major code smell IMHO.

Anecdotally, my NixOS systems (both desktops and servers) can grow up to, say, ~50 gb of system files in a few months, at which point I'll clear out older generations and GC, which gets them down closer to a typical Linux distro size. Once or twice, I've seen a system balloon up over 100G when I was doing a lot of experimenting with packages.

Oh, and incidentally, most of the different versions are only visible to the packages that depend on them. Your 'default' environment is one such package, and only sees one of each of it's dependencies. It's not like you have dozens of instances of packages crowding /lib or anything (since /lib doesn't exist in the first place). You have to go looking in the Nix package store to find the actual files.

Re: NixOS Linux

#23

Can anyone talk to if nixos can reasonably be used to run a desktop setup?

As long as what you want to do is already in nixpks it's extremely easy, once you stray from that you need to start learning how all of it works, it's not the best in terms of documentation & straight forward concepts, but I've been running it at my main desktop for 6 months now.

Sometimes it shines ex:

I messed up my x11 config as well as drivers and just booted into the previous generation like it was no big deal

I needed to install a version of electrum that was only available on a specific git commit. I just specified the commit and booted into a shell with it

Sometimes it sucks:

Learning to package arrive 3rd party software can sometimes be really complicated and it might be the only way forward.

Lots of steam doesn't work out of the box compared to Ubuntu.

Re: NixOS Linux

#24
If you want to get in to Nix I think two important things to note:

1. Nix is not a "package manager" and I think it's better at first to not think of it as one because you'll assume how it works incorrectly. It is a package manager, but it doesn't have the same workflow as yarn or etc. That trips a lot of people up.

2. You need to read the Nix Pills documentation. It is not long and guides you through every abstraction so you understand from the basics how it works. Nix is actually pretty self descriptive. I setup my home's Linux Router entirely by just hacking and searching through the nixpkgs repo without understanding things, but if I'd read the Nix Pills things would have been so much clearer to me. Especially when debugging or reading through what a derivation was doing.

Re: NixOS Linux

#25

Can anyone talk to if nixos can reasonably be used to run a desktop setup?

I started using it as desktop os two weeks ago. I've been quite happy with it. Fast and snappy gnome desktop. Took half a day to install and get comfortable

Then anouther half day to get comfortable with home-manager to configure my user settings

If you're willing, its worth the effort

Re: NixOS Linux

#26

I use Void now and like not having systemd. Can I install Nix on my Void? Do I then just stop using the native package manager? Or would it be better to install NixOS? Could I then choose not to use systemd? Would that be hard? Is the idea that you can define your system in a file and reproduce it more or less automatically? How does this compare to Guix?

NixOS uses systemd pretty heavily under the hood. You configure systemd services in the Nix language as part of your system config. It's quite nice.

Yeah, configuring systemd with Nix changed it from annoyance to a pleasure for me. Instead of fiddling with a bunch of random .service files, you can just do everything in a nix config and have them generated for you. Complex systems involving a bunch of units (services, timers, paths, whatever) can all be in one single place--alongside the service config. You can easily share defaults between units.

It's so much nicer than doing it ad-hoc.

Re: NixOS Linux

#27
post #14

I tried to use nixOS as a desktop system. Using a special command (nix-shell) whenever I needed to do development things (e.g. Rust builds) was not my idea of fun. Some other things, like overriding GDM's monitors.xml file, were pretty much impossible to do. Maybe it's better if you just use it as a base for servers / containers.

> Using a special command (nix-shell) whenever I needed to do development things (e.g. Rust builds) was not my idea of fun. Funny you should mention that, because that's exactly what got me using Nix everywhere :). I've always hated installing tools and libraries globally—what if I need a different version for a future project?—so I like tools that sandbox as much as possible like virtualenv, cargo, cabal... etc. But…

Out of interest, how does this work if using something like Visual Studio Code or some other IDE?

Re: NixOS Linux

#28

Can anyone talk to if nixos can reasonably be used to run a desktop setup?

As long as what you want to do is already in nixpks it's extremely easy, once you stray from that you need to start learning how all of it works, it's not the best in terms of documentation & straight forward concepts, but I've been running it at my main desktop for 6 months now. Sometimes it shines ex: I messed up my x11 config as well as drivers and just booted into the previous generation like it was no big deal I…

Second this. It's mostly been a pleasure, but Steam is a mess. And I just gave up on Android development on NixOS; I used a Ubuntu VM for that.

But starting off with a new computer, copying over a config file from one of your existing files, building...and ending up with _exactly the same system_, including all those tweaks to _this_ file and _that_ config, and the cronjobs you've set up over time, and all your different rc files, is magical.

Re: NixOS Linux

#29
I played with NixOS and am willing to admit that it was too difficult. It's probably great for devops, but it's just slightly too rigid for my own personal use.

Let me give an example: let's say you want to use xmonad on top of Plasma. NixOS doesn't have any simple way to configure that. You have the mutually exclusive options for one or the other, basically.

I know Nix is powerful enough to do this, if I wanted to go offroad and create custom packages/derivations, but that's the point where I am no longer happy with the utility/work tradeoff. It's what ultimately sent me packing back over to arch.

When I came back to arch, I was left hankering for NixOS's declarative package management, if that could be somehow reconciled with the baseline arch package system. This led me to using the aconfmgr utility, which checks in packages and system configuration files into a home-based filetree.

Once you've got it set up, aconfmgr can regenerate your current configuration from scratch, declaratively! I was able to check the aconfmgr tree into my dotfiles repo, so now it tracks my home state AND my system state. Unlike Nix, this still uses file-based configuration, but it's all versioned and fully reproducible, so I no longer particularly care about that caveat.

Re: NixOS Linux

#30

Can anyone talk to if nixos can reasonably be used to run a desktop setup?

I am writing this to you from my NixOS desktop.

After I gave up on the idea of preserving an existing Linux install (that used a file system, namely, btrfs, that NixOS's installer does not currently handle), and just allowed NixOS's installer to nuke my block device (i.e., my "hard drive"), it was easy for me to set up and configure my NixOS install to my liking -- and I know very little about Nix and NixOS although I consider it worth learning, which probably greatly affected my attitude, which has historically had a large effect on whether I succeed or fail at sys-admin-y tasks.

Where the learning curve gets very steep is when I tried to build something from source code! I would've liked to have built Emacs 24.4 from source, because that is the version against which my Emacs Lisp code is tested, but I gave up. (I'm using Emacs 26 instead and spending time adapting my Lisp code -- something I probably never would've needed to do if I could've built 24.4 because I am moving off of Emacs.)

If you're using x86_64, there are tens of thousands of packages with pre-built binary packages, so it might be you never have to build something from source to get the desktop environment you want.

Post reply on HN