• @JustUseMint
        link
        24 months ago

        What exactly is imperative and why does it suck pls and ty

        • @[email protected]
          link
          fedilink
          5
          edit-2
          4 months ago

          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.

          • @JustUseMint
            link
            24 months ago

            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

            • @[email protected]
              link
              fedilink
              34 months ago

              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.