Live data from Hacker News

NixOS and the Art of OS Configuration (2018)

rousette.org.uk

91–100 of 123 posts

Re: NixOS and the Art of OS Configuration (2018)

#91
post #32

Earlier quoted context omitted.

Currently, Nix way of handling dotfiles is "home-manager". Personally, I'm not convinced to translate all my random dotfiles to the format acceptable by home-manager because I wouldn't be able to use them in a non-nixos distro or a future home-manager replacement itself.

I see. So there's a solution for dot files, if a bit too involved. Currently for a low effort approach when backing up something that I know requires a bit of reparse, I use ansible templates, which basically replaces 1 string with another in a file. So far this always worked. What about application files? I.e. backing-up/restoring firefox. In it's simplest form it's copying ~/.mozilla which I appreciate is no differ…

Imo Home Manager isn't really about dotfiles. It's a NixOS-like module system for configuration unprivileged programs and services. You could use it, for example, to install and configure systemd user services for Emacs to run as a daemon, and for gpg-agent to run and work as your SSH agent. It lets you bundle specific versions of programs (with patches or configuration changes) in a declarative, reproducible way on non-NixOS Linux distributions, and if you incorporate it into your dotfiles it lets them become more reliable and comprehensive in that way. It also includes features for directly managing dotfiles, but if you're happy with your current dotfiles management system, you can leverage Home Manager to portably configure services without using it for directly managing all your dotfiles.

> Does nix have a way to restore app artifacts?

Not really. The Nix store is read-only, so if your dotfiles are in the Nix store, running applications can't write to them. There's a lot of stuff in ~/.mozilla that Firefox expects to write to during operation. There are aspects of Firefox that you can configure in Nixpkgs, including bundling extensions and setting defaults, but ~/.mozilla is not like ~/.vimrc, so it's not suitable to generation by Nix in the same way.

Re: NixOS and the Art of OS Configuration (2018)

#92

How does KDE play with Nix? I recall KDE shits all over the place with all the different cfg files it has. I had trouble trying to store them in my git repo. Would be awesome to use Nix to bring some sanity to KDE config

Plasma is a popular choice of desktop on NixOS, but NixOS doesn't have any special facilities for managing KDE dotfiles.

Re: NixOS and the Art of OS Configuration (2018)

#93
post #40

Earlier quoted context omitted.

It is still very good for some things like as a desktop OS, has very good Steam/Proton ecosystem, etc. Using Arch as a server can be a headache. Just today I updated a Arch VM running postresql. Postgresql needs to previous version present to do the upgrade. I had actually skipped a version (11 to 13) so Arch no longer had version 11 in the repos and old packages had broken dependencies. I ended up just installing th…

This is definitely something Nix is very good at, but it's not a problem with Arch. Staying up to date with upstream is basically the point of the distro, so if you're going to postpone an update for a year you should be using something else.

Why do Arch users always do this?

> We told you Arch would be bad at this

does not refute (or even contradict)

> Arch is bad at this

The cost of Arch's KISS philosophy is a system that is uniquely brittle among Linux distros in a number of ways, and Arch users are totally unwilling to admit this except in the form of blaming users for having bad experiences.

Re: NixOS and the Art of OS Configuration (2018)

#94
post #53

Earlier quoted context omitted.

What I'm hearing is "I really don't like the way traditional systems are designed and I don't want to have to learn anything new!" Nix is different, unapologetically so, that's the issue. And if it had to be more orthodox to win over a few more itinerant users that would make the whole thing pointless.

I'm not asking it to be more 'orthodox', I'm asking to not have to spend months scouring poor documentation to learn a new language and toolchain to gain the very few benefits Nix provides over the existing systems. If Nix is so inherently complicated it cannot deliver that, then why would I want it? Ultimately I want less complication in my life, not more, and Nix very much does not provide that from what I can see.

Nix operates at the cusp of some of the most complex and obscure parts of the technology stack: operating systems, compiler toolchains, and package managers. These inherently complex components require a fair bit of commitment to fully comprehend in order to be used well. You can get a lot of mileage skimming through some tutorials to become productive, but to really utilize it to its full potential requires a fair bit of investment. You don't have to be an automotive expert to drive a car, but if you're looking to race, it behooves oneself to invest the time it takes to gain the expertise.

Nix takes a very different approach to system configuration than the traditional ways. Because it treats the entirety of the operating system (bootloader, kernel, user-land, services, account management, etc.) as a single composable unit, it is forced to break some old rules that date back to the oldest days of Unix and are (now) considered to be written in stone. The deviation from the Unix Filesystem Hierarchy is, IMO, required to make systems more composable and maintainable, and is inherently a good thing in the long run. Portable development environments eliminate "works-on-my-laptop" scenarios and ensure everyone on the team is always in sync with each other and CI/CD. Reproducible builds that can be rolled back after a botched deployment are a huge win. And delivering all of these features in a single tool requires breaking some of the old rules, and that is always met with resistance due to the inertia of "it works fine for me".

To be honest, there is no reason why you should give up what works well for you. Having said that, for those that are looking beyond the traditional tools like shell-scripts, Ansible, Chef, Puppet, and others, Nix offers all that is needed to easily build and maintain composable software stacks. Docker comes close to delivering some of the same features as Nix, but comparing the two is a bit like comparing system configuration using shell scripts to Chef/Ansible.

Yes; one does have to learn a new language and its idiosyncrasies. But that is also true of things like Rust. As a seasoned C programmer, I am able to write "good" C code. But that is not a statement about C's ability to scale to larger teams. Rust requires developers to give up their old ways of thinking and "give in" to the Rust-way. The longer you fight the borrow-checker, the more painful it gets. But once you give in, you are able to write code that is safer for use within large teams, thus delivering more momentum in the long run. It is not that it can't be built with C; it requires a communal way of thinking about software complexity that is forged by experience and tempered by camaraderie, and tools like Rust and Nix are excellent supplements.

I do agree with you that the documentation leaves a lot to be desired. I've always considered the FreeBSD Handbook to be the gold-standard for technical documentation and Nix has its work cut out to reach that stage of maturity. But I have full confidence in the Nix community's ability to deliver.

Re: NixOS and the Art of OS Configuration (2018)

#95
post #88
post #83

Earlier quoted context omitted.

What's interesting about NixOS' seamless NixOS support is that ZFS can't be included in the Linux kernel, and so that kind of integration takes more work with Linux distributions, so relatively few distros have it down pat. BSDs don't face that kind of integration challenge, since they can just ship ZFS support directly in their kernels. They have recently faced an integration challenge of their own, though: rebasing…

Can you elaborate a bit more on why ZFS is great? I am currently thinking about doing "one final install" for my system, and am undecided between BTRFS and ZFS. I noticed that most "hip" people use ZFS, but based on my meager research it seems actually recommended and designed for "big" data-center setups. Why is ZFS good for small PC setups? --- If am being honest I just want something that works reliably, is easy t…

If you have a single disk, BTRFS is probably as good as ZFS for you.

ZFS is mature and featureful, and it's easy to performance tune specific subdirectories using 'datasets' (on BTRFS you can do some of the same stuff with 'subvolumes'). It has good utilities for backup, including over the network. It always supports up to date, efficient compression (these days, zstd). It's good at pooling, so you don't need LVM if you want to be flexible about 'partitioning'.

One genuine advantage it has over BTRFS other than stable softraid support is that it's cross-platform among Unices, including (in incipient form) even macOS. So experience you gain in administering it would be transferable that way. (OTOH, Windows has a pretty mature BTRFS driver, but ZFS on Windows is even more recent (and difficult) an effort than ZFS on Mac).

Truthfully, ext4, BTRFS, and ZFS are all fast and stable, and once you set them up your filesystem, you'll probably hardly think about it. (If you go with ext4, I'd set it up on LVM to make it easier to extend or 'repartition' in case you wanna structure things differently or add another distro or whatever.)

Linux's heritage and continued use as a server OS makes it rich with fast, reliable, flexible, feature-complete filesystems. All three of your options here are better than what's on offer on any Windows or Mac desktop, so you kinda can't go wrong, so don't overthink it. Just pick something you feel like learning or whose documentation strikes you as agreeable and interesting. Whatever you choose will serve you fine until your disk dies or you get bored. :)

Re: NixOS and the Art of OS Configuration (2018)

#96
post #71

Earlier quoted context omitted.

It is like saying I don’t want spending months to learn git to gain the very few benefits of a version control system. I much prefer to share my code with my coworkers via usb-sticks. Yeah this is less complicated in the short term.

I honestly don't want to learn git precisely because there are version control systems that accomplish the things I need in a much simpler way. I only bother using git at all because some FOSS projects I've worked with use it. Hell, my impression is that most people who use git don't bother really learning it, they just keep a recipe book of how to branch, commit, etc. and then rely on stack overflow to un-fuck the r…

I could not agree more. Most people, IMO, are workflow junkies! It doesn't matter how good/bad/ugly the tool is; if it works, it stays forever! And git is a perfect example of a tool that is complex, but survives because it became the gold-standard for FOSS.

Having said that, wouldn't you agree that same recipe-book approach is also true for traditional system configuration/administration?

Re: NixOS and the Art of OS Configuration (2018)

#97
post #86
post #68

Earlier quoted context omitted.

> I just feel free and am not afraid to fuck up anything Until you have to install the latest NVidia drivers, I suppose.

Luckily not [1]. 1: https://nixos.org/manual/nixos/stable/#sec-x11-graphics-card...

That's because someone already did the porting and testing for you. But what if you want the latest video and CUDA drivers?

Re: NixOS and the Art of OS Configuration (2018)

#98
post #97
post #86

Earlier quoted context omitted.

Luckily not [1]. 1: https://nixos.org/manual/nixos/stable/#sec-x11-graphics-card...

That's because someone already did the porting and testing for you. But what if you want the latest video and CUDA drivers?

"not afraid to fuck up anything" likely refers more to the ability to rollback the system to any (non-deleted) previous revision of the system configuration, directly from the bootloader, which means you can easily recover even from a broken kernel.

This applies regardless of whether you are packaging/updating something in the package set yourself, or using something that someone else packaged.

Re: NixOS and the Art of OS Configuration (2018)

#99

Love to see more adoption of Nix and NixOS. I started my Nix journey a little over a year ago, and I regret not having switched sooner. A package-manager that also ships an operating system that can be customized from the bootloader up, using a purely functional programming language is the perfect configuration management tool! It does have some rough edges, and I did lose some hair figuring things out early on, but…

> So far I haven't missed any packages that I could not find in nixpkgs, or customize just the way I wanted to. And it's honestly not that hard to package things that aren't yet Nixified. Any C project is easy - I've learned more about cmake from mkDerivation that anywhere else. And overlays make it easy to make tweaks to a build without straight-up forking. Beautiful!

> I've learned more about cmake from mkDerivation that anywhere else.

This is something I find really fascinating about Nix (or more precisely nixpkgs) that gets overlooked a lot: it is essentially a giant database that documents how different build tools work, how different projects are built, and so on, in an exhaustive and consistent manner.

That can be an extremely valuable resource to have in your back pocket, even if you're not actually using Nix!

Re: NixOS and the Art of OS Configuration (2018)

#100
post #41

Earlier quoted context omitted.

I always think it's worth mentioning explicitly that NixOS makes it not just possible to put everything including the root file system on ZFS, it makes it completely easy.

It's not unique at that though. FreeBSD has had this for a decade. And Ubuntu is adding it now as an installer option. PS: I do like the idea of NixOS and its USPs which are indeed unique :) For me what's stopping me is the learning curve. I don't mind learning per se but if I put the time in it I'd like it to be for something that's useful in more places. Like ansible.

> I don't mind learning per se but if I put the time in it I'd like it to be for something that's useful in more places. Like ansible.

Depending on whether you mean "used by more people" or "applicable to more problems"... if the latter, tools like morph or NixOps might be of interest to you, which essentially extend Nix to "across multiple remote machines", which means that de facto you end up with an orchestration tool like Ansible or Puppet.

Post reply on HN