Live data from Hacker News

Why I love NixOS

birkey.co

241–250 of 323 posts

Re: Why I love NixOS

#241
post #83

Earlier quoted context omitted.

I mean it's pretty wild to take s-expressions and not call them extremely terrible to read. The nix language sucks really badly, but I gladly take it over writing S-expressions.

It reads almost the exact same as any functional C-style language. Not to mention that specifically for Guix, you're going to be writing the (name value) form for 99% of it.

> you're going to be writing the (name value) form for 99% of it.

That's exactly the part that is wrong with Guix, and Scheme in general. Scheme has associated lists, they are written as '((name . value) ...), but since that's too ugly everybody makes macro wrappers around them to get them down to just (name value). But that means you aren't dealing with an obvious data type anymore, but with whatever the macro produces and if you want to manipulate that you need special tools yet again. And then you have record-type and named arguments which are different things yet again, but all serve the same name->value function as an associated list. Names themselves are sometimes symbols, sometimes keywords, and sometimes actual values. Same with lambda, sometimes you need to supply a function, other times there is a macro that allows you to supply a block of code.

It's like the opposite of the Zen of Python, there are always three different ways to do a thing and none of them as any real advantage over the other, they are just different for no good reason and intermixed in the same code base.

Re: Why I love NixOS

#242
post #61

NixOS is great. Nix the language is just awful. I still use it for my Dev laptop and for Home Manager on all my devices.

You know, I'm not going to say I'm enamored with the language, but I think the Stockholm Syndrome has kicked in because I really don't hate the language so much anymore. I mean, I'm only ever using it for configurations, and I think I'd still prefer writing Nix than YAML. I probably wouldn't like writing a full "program" with Nix, but I don't think anyone does that?

Sounds like every programming language on the planet. Just skip the "i'm unfamiliar with it, so i hate it" phase, and everything will be fine. People spend more time repeating that simple POV, using thousands of varying words, than is healthy. Just shut up, and do the work. And if you're not going to put in the work, just shut up, and let everyone else get to work.

Re: Why I love NixOS

#243

Earlier quoted context omitted.

The key point is that all such tweaks to the system is managed in a one configuration file. While installing Hyprland may be a one-liner, configuring it and all other services from a single entry point is incredibly liberating. Reverting changes are guaranteed to not leave behind any cruft, and you don't have to remember what you changed to make X or Y work: it's all visible in the (usually version controlled) system…

While nix might be free of side effects, activating a nixos configuration isn't as free as you imply. As an example, nixos keeps state around regarding user id/username mappings, to avoid giving the same user id to different users across time. So a fresh install of nixos might leave services unable to read their data files, because the file might be owned by a different user id. And if you activate and enable incus,…

> As an example, nixos keeps state around regarding user id/username mappings, to avoid giving the same user id to different users across time. So a fresh install of nixos might leave services unable to read their data files, because the file might be owned by a different user id.

One reason to set `mutableUsers = false`: https://mynixos.com/nixpkgs/option/users.mutableUsers.

> And if you activate and enable incus, for instance, it will probably create a bridge device: the device will remain in place after you remove incus, which will have implications for how your network/firewall works that your configuration will depend on but will not enforce or be able to reproduce.

Impermanence: https://github.com/nix-community/impermanence.

To be clear, I don't use neither. But you can get NixOS to be almost completely stateless (if this is something you care) with a few changes. The power is there, but it is disabled by default because it is not the pragmatic choice in most cases.

Re: Why I love NixOS

#244

Earlier quoted context omitted.

I love my kitchen knife and I love Emacs. More love is a good thing. Unless you're the kind of person who thinks not loving is better because you've got nothing to lose.

To me, loving inanimate "trivial" things diminishes the value of love. I love my girlfriend and my pets. I like my kitchen knife and my car. To bunch up both into the same category confuses things into "which one do I love the most", some sort of spectrum of love. In the case of a fire, I'm sure you wouldn't prioritize your laptop with NixOS over your cat (let's imagine that the only backup is in the house that's on…

Do you "love" your girlfriend or your pets more? If your girlfriend starts requiring you to view ads before talking, would you still "love" her?

Re: Why I love NixOS

#245

Earlier quoted context omitted.

I would have never become a power user of Linux were I used LLM to do the installation of Gentoo once upon a time. :( So do you guys not know much about the distro you are using, or how does this work? I honestly thought your comment was sarcasm, but apparently it is not.

NixOS is high-level declarative, so you're reading high-level config diffs when the AI agent is pitching changes. Unless you're brand new to Linux or computing, it's not a mystery what a given nix config change is ever doing. You can probably guess what this does: networking.firewall.allowedTCPPorts = [ 8080, 9000 ]; The things to know about the OS are high level things. The rest of its idiosyncrasies you learn just…

> [ 8080, 9000 ]

Fails to parse is what it does...

Are we really living in times where people can't write a single (syntactically) well-formed line of code in a programming language they use?

I understand this doesn't really matter when just using NixOS Slop Edition™ but man I hate it.

Re: Why I love NixOS

#246
post #118
post #112

Earlier quoted context omitted.

As a NixOS user for 3 years, and a Claude user for 1+ year, I agree with you that it's an ideal fit. I've been very happy with, for example, how Claude can configure GNOME via dconf settings: tweaking those settings declaratively requires cross-domain knowledge and knowing where to dig. But Claude just knows. But trying to set up an environment for one of those perpetually running AIs, and asking it to refactor its o…

I just migrated my personal website to nixos and can second all of this. There's a learning curve, but the time to provision a new server once it's all working is hilariously short.

If you're using Hugo or a similar static site generator, you might like my blog series:

https://simonshine.dk/articles/hugo-static-site-setup/

https://simonshine.dk/articles/vendoring-hugo-themes-with-ni...

My blog is deployed here:

https://github.com/sshine/nix/blob/main/services/nginx.nix#L...

Re: Why I love NixOS

#247

Earlier quoted context omitted.

also the AI hallucinating nix options. I have to constantly check https://search.nixos.org/packages?channel=unstable

oh yeah AI realy does not seem to actually know which packages exist. I once asked AI to create a devenv for some Julia development and it pulled some packages out of its ass that just plain did not exist.

I'm overwhelmingly surprised about Claude's ability to know the package.

But the cut-off point in model / harness quality before it hallucinates everything but the general Nix syntax is staggeringly low.

Re: Why I love NixOS

#248

Earlier quoted context omitted.

No, you don't have to rank things, there's your mistake. Stop ranking things.

If I say "Girlfriend, I love equally to my operative system" I'm in for a world of trouble.

Don't say it then. Nobody is forcing you to rank anything.

Re: Why I love NixOS

#249
post #118
post #112

Earlier quoted context omitted.

As a NixOS user for 3 years, and a Claude user for 1+ year, I agree with you that it's an ideal fit. I've been very happy with, for example, how Claude can configure GNOME via dconf settings: tweaking those settings declaratively requires cross-domain knowledge and knowing where to dig. But Claude just knows. But trying to set up an environment for one of those perpetually running AIs, and asking it to refactor its o…

I just migrated my personal website to nixos and can second all of this. There's a learning curve, but the time to provision a new server once it's all working is hilariously short.

I use debian + ansible and it requires discipline (you have to make sure you never do manual steps basically) but my entire ansible playbook makes server creation a 3 min process.

I'm sure Nix is better, I just haven't needed it yet.

Re: Why I love NixOS

#250
post #118

Earlier quoted context omitted.

I just migrated my personal website to nixos and can second all of this. There's a learning curve, but the time to provision a new server once it's all working is hilariously short.

I use debian + ansible and it requires discipline (you have to make sure you never do manual steps basically) but my entire ansible playbook makes server creation a 3 min process. I'm sure Nix is better, I just haven't needed it yet.

> it requires discipline (you have to make sure you never do manual steps basically)

Since Nix requires a declarative configuration, you need less discipline, but more up-front specification. For example, making truly idempotent Ansible scripts requires a lot of effort and some strong assumptions about your starting state and what processes piped changes into your state, and what your state changes really mean. Also, running your playbook with newer version of the same software may lead to a different result. For example, migrating from bullseye to bookworm with a cargo-deb that contained dependencies: It turned out that there were implied dependencies taken for granted in bullseye that were removed in bookworm. With Nix this will lead to a build error rather than a deployment error or a runtime error (in most cases).

Nix requires fewer assumptions.

> my entire ansible playbook makes server creation a 3 min process

I'm a big fan of Ansible, and everything has its use.

I like to categorize deployment tools as either "bottom-up" or "top-down" depending on what assumptions you make about the world: Ansible fills the slot where you have no control of how the server got there, but you gotta make use of what you have, and start from scratch. Terraform is the canonical bottom-down tool: You assume you have perfect control of what gets provisioned, and that it won't go away or go out-of-sync without active maintenance.

In this top-down/bottom-up topology, Nix can fill the whole spectrum; most people assume Nix/NixOS is available to them, at which point their automation starts. Others deploy NixOS via various automated processes that can be integrated with both top-down or bottom-up solutions, e.g. distribute via network boot, VM image repository, or via "hostile takeover" (deploy on existing Linux machines via SSH, like Ansible, or using Ansible).

Post reply on HN