Live data from Hacker News

Reflections on NixOS

zenhack.net

61–70 of 102 posts

Re: Reflections on NixOS

#61
post #57

I used NixOS for about six months, and while I think the core of NixOS is great, but I never liked KDE and how much it kind of forces it on you. Gnome support is kind of horrible, and it felt like I either had to commit to something incredibly low-level like XMonad, or KDE.

I don't think many NixOS users use desktop environments, generally speaking, and NixOS users tend to wind up being NixOS contributors as it stands right now. XFCE's available, though, for something lightweight.

I mean, the Live-CD has KDE running by default, so I kind of assumed that was the standard.

Re: Reflections on NixOS

#62

Disclaimer: I'm core NixOS developer It's great to see such articles as they dive deep into psychology when it comes to new technology. It's really hard to unlearn. It takes effort to realize that the promised gain is bigger than the pain coming from doing what we're used to doesn't work.

> It takes effort to realize that the promised gain is bigger than the pain coming from doing what we're used to doesn't work.

This could almost be the subtitle for "Functional Languages: Those Things Your Manager Won't Allow You To Use Yet"

I think that a day will come when everyone will realize, and we'll have the tools to do, "functional" all the way to the metal. I like to quote John Carmack from http://www.gamasutra.com/view/news/169296/Indepth_Functional...,

"A large fraction of the flaws in software development are due to programmers not fully understanding all the possible states their code may execute in. In a multithreaded environment, the lack of understanding and the resulting problems are greatly amplified, almost to the point of panic if you are paying attention. Programming in a functional style makes the state presented to your code explicit, which makes it much easier to reason about, and, in a completely pure system, makes thread race conditions impossible... No matter what language you work in, programming in a functional style provides benefits. You should do it whenever it is convenient, and you should think hard about the decision when it isn't convenient."

I think this paradigm applies at the OS and filesystem levels as well (ideally). The better control you (and your code) have over the states of everything in your system, the more deterministic your system behaves, the fewer unexpected bugs you have to chase down, the better you can reason about the computing you're doing and the programming you're responsible for making work.

I mean, what's the big advantage of Docker and the whole "container" movement? You are guaranteed (more or less) to have a known state. Why does resetting hardware fix problems? Because it resets things to a known state. Managing state is the problem, and functional paradigms are the solution.

Re: Reflections on NixOS

#63
PLAN9 namespace is a perfect solution for this kind of package isolations. I can imagine a perfect NixOS plan9 hybrid, only if APE were good enough. Perhaps people(TM) should really pool resources together and make that happen.

Re: Reflections on NixOS

#64
post #52

Earlier quoted context omitted.

> Packaging the Nix way does require patching upstream and that's probably inevitable. Not to familiar with Nix, can you explain why? Anything that can't be handled simply by applying small patches to the upstream during packaging?

"patching upstream" in this context means "applying patches to the upstream during packaging". Nix and Guix require programs to work with a directory layout that differs significantly from the standard. Simple things like `#!/bin/python` don't work anymore, because they aren't explicit enough.

Yeah, thanks. To add to that, the Nixpkgs "standard library" includes lots of convenient tools for patching like this, and much of the common stuff is done automatically by the standard package function. The #nixos IRC channel is a good place to ask if you run into trouble when packaging something.

Generally, making NixOS packages is really delightful. Even the patching stuff is straightforward and easy to use. Now that I've learned the basics, I routinely make small packages.

With many typical packages the only thing you need to do is specify how to fetch the source, plus the list of build dependencies, and there are built-in functions for fetching from HTTPS or Git.

Re: Reflections on NixOS

#65

People need to stop thinking of NixOS as another Unix-alike, because it isn't, in very much the same way that MacOS used to be a Unix-alike, but isn't any more, either. NixOS is rebuilding important pieces of the foundation. Why? To address a basket of problems we have been complaining about with Unix for a very long time. Is it worth the hassle? Well, have you ever lived through a kitchen remodel in your house? That…

It's worth checking out at least the introductory parts of the theses written about Nix and NixOS.

Eelco Dolstra's Ph.D. thesis describing Nix, "The Purely Functional Software Deployment Model": https://nixos.org/~eelco/pubs/phd-thesis.pdf

Armijn Hemel's master's thesis describing NixOS: https://nixos.org/docs/SCR-2005-091.pdf

Or this more recent journal article about Nix/NixOS which is a good introduction: https://nixos.org/~eelco/pubs/nixos-jfp-final.pdf ("NixOS: A Purely Functional Linux Distribution").

Re: Reflections on NixOS

#66
post #25
post #9

Earlier quoted context omitted.

I would love to hear your thoughts on Guix.

Guix comes up on every Nix thread on HN and it's a bit frustrating. Guix runs on Nix technology with a new config language for packages & a different philosophy about what can go into its core package set (it's a GNU project). My personal take is that the difference isn't large enough to warrant a new distribution and if you want to choose you should go with the momentum and that's with core Nix (10-30x contributors,…

I agree that the endless Nix vs Guix discussions are getting tiring.

As a contributor to both, I'll try to explain why Guix won't make Nix obsolete any time soon:

Guix is an official GNU project, meaning they won't ever support any proprietary code. The Linux kernel is "Linux-libre", which is a Linux fork with all proprietary drivers removed, so it probably won't run well (if at all) on your laptop. Whereas on NixOS you'll have things like Steam working out of the box.

Guix also has an unfair advantage in that they started "from scratch", while Nix contains a lot of legacy cruft from "paving the way". The `guix` tool/frontend is a lot better than the various "nix-*" commands, but there is work underway for a similar unified interface to Nix.

Finally, the language: Scheme is more pleasant to work with, but I find system configuration a lot more intuitive in Nix. NixOS also uses systemd/udev which is more familiar for most people than the maturing Shepherd service manager in GuixSD.

TL;DR: Nix and Guix serve different purposes through similar means. They are both excellent distributions and clearly represents a new era of operating systems. Most people would want to go with NixOS if they want a minimal-hassle functional operating system; but if you are just looking for a decent package manager for your favourite distro then Guix may be a better choice (as long as you can live without any non-free software).

Re: Reflections on NixOS

#67
So this probably just saved me a trip down NixOS road, which was on my (ever too long) todolist for some time now.

Last year, I finally put my private systems under configuration management, but just like the author, I was concerned that both the configuration management tool and the system package manager like to exert complete authority over the system without knowing about each other, a recipe for disaster.

In the end, I wound up writing my own configuration management tool, Holo [1], which relies on system packages to install applications and deliver configuration files, and implements the additional logic to provision things that the package manager does not understand (users, groups, SSH keys, etc.).

One thing that's missing from Holo right now is a validation pass that the whole system matches the expectation described by the configuration packages. (Right now, only files that were touched by Holo can be monitored for changes, but not files installed by the package manager.)

But it turns out that that's a hard problem. A normal Linux system has a lot of moving parts that are not accounted for by the system package manager. See for example the positively huge list of exceptions in [2]. Of course, the bulk of these quickly-changing files are data, which can be skipped easily by just ignoring /run, /tmp, /var/cache, /home and so on. The question remains what to do with the rest: implement some sort of parsing for auto-generated configuration like /etc/passwd, /etc/ssl/certs and so on, or just rely on snapshots of known-good states designated by the administrator? I'm still undecided.

[1] http://holocm.org (the site seriously needs an update)

[2] https://github.com/graysky2/lostfiles/blob/master/lostfiles

Re: Reflections on NixOS

#68

Disclaimer: I'm core NixOS developer It's great to see such articles as they dive deep into psychology when it comes to new technology. It's really hard to unlearn. It takes effort to realize that the promised gain is bigger than the pain coming from doing what we're used to doesn't work.

It sounds like you're blaming the users for not "unlearning" enough to be able to use NixOS. As long as you have that attitude, you'll be driving away users. How do you think you can improve your software to make it easier for users to "unlearn" stuff you think is bad?

We're not running a startup here Ok? It's not "grow or die". Priority #1 is make sure all the proper abstractions are in place: foundations before furnature. And while we're pretty good on that front, there are a few things left.

That's said we've got some CLI stuff being rewritten and other work that will help new users.

Re: Reflections on NixOS

#69
post #58

Earlier quoted context omitted.

Because that's fundamental to Nix. We're giving up on some current habits to get the freedom we want. This won't ever change, but people might. I'm not blaming them, I feel their pain. This is common in technology all around, think about driving a car for 25 years with manual transmission and then trying automatic transmission.

While some things are fundamental for Nix's architecture, user interfaces are not. You don't even have to force people to learn the language, you can get apt-getish experience for generating .nix files with git-like commits or whatever. There are no limits in making it user-friendly and respecting people's habits and familiarity (which is actually a core concept for interfaces, that you seem to confuse with new techn…

Faking destructive package management on top does exist, and we do plan on making it better, but it's lot harder to get right than you might think.

Re: Reflections on NixOS

#70
post #16

I use NixOS since last spring and I adore it so much that I almost credit it with making me like computers again. It's a kind of bumpy ride sometimes but for me there's no other distribution that's even close. Packaging the Nix way does require patching upstream and that's probably inevitable. It would be nice to help with the documentation situation, though I'd note that the NixOS manual and the Nixpkgs manual are s…

Your first sentence is very close to something I've said to others. NixOS is the first time I've been excited about an OS since first discovering Linux back in 2003.

The OP mentions "the ability to do controlled per-user changes in an ad-hoc fashion". I assume they are referring to the use of "nix-env", which some members of the community frown upon. I've adopted the policy of not using it. My system is defined entirely by various ".nix" files, and for launching simple applications, such as firefox, I just have my xmonad configuration bind "C-SHIFT-F" to "nix-shell -p firefox --run firefox".

For programs where I have more complicated environments, I have a "shell.nix" file in $HOME which contains a bunch of derivations that I commonly use, and I use "nix-shell -A" to enter them.

For development, all of my projects now include a "default.nix" file. Typing "nix-shell" in the project directory then brings in my project's dependencies as well as the tools I want when developing on that project, such as a suitable Emacs with the appropriate packages already installed.

I find I move these move ".nix" files frequently between different machines, and I really appreciate that I am put into reproducible development environments wherever they are.

To reiterate what others have said below: the Nix package manager makes sure to share build inputs. If I start a new project and include a bunch of stuff in my "default.nix" that I use elsewhere, it costs nothing to enter the new environment.

Post reply on HN