Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Declarative management of your OS is in terms of effort basically an inversion of imperative management.

With declarative, you frontload an enormous amount of effort:

- You have to learn your declarative framework

- Then you have to slowly build your configuration base, or copy someone else's and figure out why they did what.

- Then you have to figure out workarounds for things that aren't natively managed declaratively.

- Then you start writing your own little helper functions and modularize things. At this point, it starts getting very smooth.

From there on, adding another package or another machine is very very easy, basically adding a few lines of code. And now your system is mostly reproducible, putting you far ahead of an imperative configuration.

Compared to that, doing it imperatively you can just sort of do your thing and roll with it. This let's you do whatever you aim to achieve very quickly, but as time goes on you have to juggle so many balls in terms of tracking and remembering what you configured / what state your config is in that it quickly becomes impossible.

Declarative OS management really sticks once you accept that the first few weeks are gonna suck and the first few months are still gonna have friction. But once you get over the hump, the rewards are there to reap.



I feel like a lot of that effort could be reduced though:

> You have to learn your declarative framework

Could the framework be simplified so that you don't need to learn all of it but rather just a small part when you're only doing basic stuff?

> Then you have to slowly build your configuration base, or copy someone else's and figure out why they did what.

Couldn't pre-made configurations be made available? For example in docker it's very easy to base your image on another image from an online registry.

> Then you have to figure out workarounds for things that aren't natively managed declaratively.

This is unfortunately a consequence of the current ecosystem essentially being imperative-first, but I wouldn't consider it an intrinsic limitation of declarative systems.

> Then you start writing your own little helper functions and modularize things. At this point, it starts getting very smooth.

This is probably the part where you really need to spend a lot of effort, but I wonder if it's possible to reduce the need for these helper functions and modularization or provide them by default for at least most common cases. Then most wouldn't need to spend the effort for them because they either already exist or there would be no need for them.


> Could the framework be simplified so that you don't need to learn all of it but rather just a small part when you're only doing basic stuff?

If you just want to do 'basic stuff', declarative OS management has way too much overhead.

> Couldn't pre-made configurations be made available? For example in docker it's very easy to base your image on another image from an online registry.

Nix really is as a configuration of configurations (called modules). So yes. But no one runs the exact same OS setup or container, so eventually you will need to modify it to your specification.

> This is probably the part where you really need to spend a lot of effort, but I wonder if it's possible to reduce the need for these helper functions and modularization or provide them by default for at least most common cases

Nix already has premade helper functions for common cases via 'builtins'. As far as modularization goes, at some point you are going to want to do something custom, and if you want to apply that to multiple systems then making it a module just makes sense.


The crazy bit is pretty much everything you’ve described exists. Except for the most important bit, the documentation.


> Declarative OS management really sticks once you accept that the first few weeks are gonna suck and the first few months are still gonna have friction. But once you get over the hump, the rewards are there to reap.

Only if you don't change your mind and do not decide to try out that new cool distro that just came out 6 months later.

I like declarative management but so far I have sticked to puppet for that. Sure like with ansible puppet needs to be installed first but on the other hand you can quite easily convert/reuse a config for say debian, to ubuntu, arch or fedora. The main differences are usually package names.


Lots of people don't realize it, but you can actually use Nix for packages and package config on any distro and even macOS.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: