News for hackers. Stuff that matters.
Re:Erase your darlings: immutable infrastructure for mutable... by PterodactylsRUs on Wednesday September 15, 2021 @05:37PM (#28544697)
The problem with Chef and Puppet is that you tell it what to _do_ to a machine, but what you care about is what the machine _is_ or _has_. If you install a package on a machine using Chef, and then delete the line to install the package, it won't go ahead and uninstall the package. Even if you want to keep all your machines up-to-date with your configuration, and tell Chef to do an uninstall, uninstalls don't necessarily restore the state of the machine to what it was before the install. Data frequently gets left behind.
Re:Erase your darlings: immutable infrastructure for mutable... by snicker7 on Wednesday September 15, 2021 @06:42PM (#28545339)
It’s worse than that. “Installing a package” is not meaningful without a reference to its version. Nix/Guix are supposed to give you byte-indentical systems.
Re:Erase your darlings: immutable infrastructure for mutable... by raffraffraff on Wednesday September 15, 2021 @06:58PM (#28545513)
CM systems don't just install any old package. You can absolutely specify a version.
Re:Erase your darlings: immutable infrastructure for mutable... by bfrog on Wednesday September 15, 2021 @08:39PM (#28546404)
Only what has been packaged, nix let’s you roll your own package if you like, letting you overlay ontop of existing expressions to produce your own. Want to rebuild a specific OpenSSL with a specific tool chain and compile time flags? Easily expressed in nix if you don’t mind the time to build it all
Re:Erase your darlings: immutable infrastructure for mutable... by raffraffraff on Friday September 17, 2021 @08:25AM (#28564619)
We had an internal RPM repo where we pushed internally built packages. Not part of CM, but part of our solution.
Re:Erase your darlings: immutable infrastructure for mutable... by raffraffraff on Wednesday September 15, 2021 @06:52PM (#28545448)
I'm more familiar with puppet, but I'd venture to say that it really depends in how well you write your code.

In my previous job where I used it heavily, every module had an enable parameter. If it was true, the module would follow one logic branch (install package, write config, perform action) but if it was false then it would follow another (remove package, delete config, perform action). This was a basic standard, and a new module would be rejected if it wasn't possible to toggle it on/off and configure it from Hiera (hierarchical yaml data). It wasn't perfect, but once the complex stuff was dockerized the puppet codebase shrank a lot. Most of the differences between our VMs were defined in Hiera (edit a yaml, toggle something on, override some default).

Re:Erase your darlings: immutable infrastructure for mutable... by watusername on Wednesday September 15, 2021 @09:31PM (#28546856)
> In my previous job where I used it heavily, every module had an enable parameter. If it was true, the module would follow one logic branch (install package, write config, perform action) but if it was false then it would follow another (remove package, delete config, perform action).

This is one area where NixOS shines: The ability to remove things from your configuration with no mental overhead. Even if you take great care to do all the cleanup work in your runbook, something is bound to get missed and you still haven't accounted for the state of the system before the runbook was run the first time.

For NixOS it's easy: "Not in config" = "It's not there". All system configurations are themselves normal Nix expressions that get evaluated into derivations which are then built into immutable paths under /nix/store. Most files in /etc are simply symlinks to files in the Nix store, and the activation script takes care of creating and deleting those symlinks when a new configuration is activated.

Re:Erase your darlings: immutable infrastructure for mutable... by paulfurtado on Wednesday September 15, 2021 @10:14PM (#28547145)
You can be fairly good about it, but there's always state with the potential to be left behind or become inconsistent: transitive dependencies of packages sticking around, packages with pre/post scripts, services writing out data files to unexpected locations on disk you forget to cleanup, a failure somewhere between a resource and a "notify" firing causing your service to not restart after a config file update and the next run not rerunning the notify, etc.
Re:Erase your darlings: immutable infrastructure for mutable... by joepie91_ on Thursday September 16, 2021 @06:48AM (#28550111)
While all of that is correct, I feel like you're leaving the most important part unspoken: Nix (and, by extension, NixOS) prevents this by construction, so that you are no longer dependent on somebody using the tool perfectly in every single place to not have this issue.

It's the difference between "you can use this tool safely" and "the tool makes sure that you will use it safely", basically.