this post was submitted on 11 Mar 2024
425 points (99.1% liked)
196
16511 readers
2142 users here now
Be sure to follow the rule before you head out.
Rule: You must post before you leave.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Imperative package management detected. Deploying rocks.
What exactly is imperative and why does it suck pls and ty
So let's say you do a clean install of a Linux distro. You then have to tell the system you want to install this web browser, change this setting, open these firewall ports, enable SSH, etc.
Telling the fresh system to do each of those things is imperative.
In NixOS, you write one big config file (you can split it up) that declares all the packages, settings, ports, etc. Then you run a command that tells the system "This is the end-state I want you to be in. Do whatever you need to do to end up in that state". That's declarative.
It means you can set up a new box by just pointing at at your config and telling it to build it. That means, you don't have to remember what you did to solve that problem that one time -- you've put it into your configuration and now it's solved forever.
Edit to add: the imperative method isn't "bad" necessarily -- we're mostly just goofing around.
Holy shit that's cool! Reminds me of a good docker compose yml for a bunch of containers. Thanks for the explanation. Apparently I'm installing nixos wtf
Docker-compose is also declarative, so you're right on the money!
Have fun and ask questions -- it can be a bit overwhelming at first, but when it clicks, it clicks.
Drop tha rocks on tha Packagelowdaaaaa! Make dem Imperatives pay for all dem impuretees!