What do package managers do? Install packages, obviously! But that is not everything. In my opinion, package managers do enough to be characterized as general automation frameworks. For example:

  • manage configurations and configuration files
  • manage custom compilation options and flags
  • provide isolation or containerization
  • make sure a specific file is present in a specific place given specific conditions
  • change installation files or configuration based on architecture or other conditions

Not all package managers do all of the above, but you get the idea.

Nix even manages your entire setup with a single configuration file.

It occurred to me that package management could theoretically be managed by an automation framework.

What do I mean by automation framework? Ansible, chef, puppet, or Sparrow.

Now imagine if you were to use one of those package managers as an automation framework. For most of them, it would suck. (nix is a notable exception). So maybe common package managers are just bad automation frameworks?

What if we used an automation framework as a package manager? Well currently, it might also suck, but only because it lacks the package definitions. Maybe it is not a bad experiment to have a distribution managed by a modern automation framework like Sparrow.

What are the benefits?

  • usable on other distributions
  • more easily create your own packages on the fly
  • Greater customization and configurability
  • use a known programming language that is easy to read to define packages and other functions, instead of a DSL
  • your package manager can easily automate just about any task using the same syntax and framework
  • hallettj@beehaw.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    10 months ago

    I haven’t worked with the deployment tools which is what I think would make the most direct comparison to other automation frameworks so I don’t know how comparatively opinionated they are. I suspect it varies between those tools.

    Using NixOS or Home Manager there is a certain way of doing things. But these are intended to be opinionated. Packages and modules come from either nixpkgs, or from third-party flakes which package for Nix. Services are usually orchestrated through systemd units which come from Nix packages.

    You can do anything with Nix. The tools and frameworks encourage certain ways of doing things. But that depends on the framework. You can always build a new framework that works differently. Since they are all based on common concepts of Nix expressions, derivations, and in many cases flakes you get a certain baseline interoperability between frameworks.