1. 15

Mostly reading a lot of posts on here about Nix, plus a personal project that’s using Kubernetes made me think about all of this. It’s a half-formed proposal, but hoping it adds some new thoughts to the space as AFAIK I haven’t seen anything like this yet.

  1. 4

    I’ve been quietly working on some stuff combining Nix and Kubernetes over the last year or so. In fact I recently - just in the last week - had a rather elegant idea (I’m biased, of course) which I’ve implemented and plan to write about.

    Good to see others considering potential crossovers!

    1. 1

      Awesome :) I look forward to seeing the post!

    2. 3

      I do this with nixos and Hashicorp’s Nomad. Nomad handles deploying/scheduling my apps and nix handles building the apps. The VM’s/machines for running the Nomad cluster are just nix built nixos ISO images, that boot from the ISO, so it’s all read-only. Works great. It’s not all packaged together, but it’s all in a single “infrastructure” repo, so it’s easy enough.

      1. 2

        So, after reading the post, one thing that I’m kind of confused if you are aware of, is that Nix/Guix (or really Scheme in the latter’s case) in theory allow generating whatever output scripts you need (that’s in fact part of their allure), so I’d imagine it should be possible to try and use them for Terraform/HCL/whatever else.

        A few other more or less related technologies that you might be interested to read about:

        1. 1

          The Terraform bit was kinda a “hey now we’re doing all the nodes with this, can we do the infra as well?” thought, but yes, I could do the Terraform generation in Nix/Guix. Given it’s templating support, maybe the other way around as well (but then I’d probably hit the limits in HCL, so probably realistically no).

          I’d heard of Cue/Dhall before, but wasn’t a massive fan in either case (partially because of a personal aversion to Haskell that Dhall’s use of lambda symbols really doesn’t help with, and not overly fond of Go either for Cue’s scripting). I’d like to have an actual go with them and see if the benefits outweigh my revulsion, but haven’t had time.

          Hermes looks really interesting. I’ve just had a quick dig around, and I haven’t seen anyone doing a “HermesOS” yet, but that would be very much towards my personal sweet spot on such matters. I’d previously dismissed Janet (mostly in a “oh, another small Lisp, yay, I’ll stick to Clojure thanks” way), but I’m seeing now the potential for it in this sort of system config space.

          1. 1

            Among cue and dhall, IMO cue is the interesting one. One thing I had issue with when trying it a couple years ago was crappy error handling (roughly boiling down to the infamous “?” error message of old compilers), with no clear will to improve when I reported that. To me that was the main thing that stopped me from using it then; no idea if they improved it since. (Modulo the fact that I am also personally rather a fan of Go so don’t have problem with that particular aspect.) Due to that I was loosely exploring the idea to try and learn microKanren and see if I could write an “alternative cue” with better error handling. However I failed to grasp microKanren quickly enough for leisure-time hacking… which is somewhat fortunate as I’m already spread far too thin among hobby projects.

            As to Hermes there’s companion hpkgs, though I’m not aware of hermesOS indeed.

        2. 1

          @palfrey So with nixops you can set default nix expressions to be evaluated on all machines.

          So there’s one part done, deciding what expressions go where out of a set of local nodes is an interesting problem however for nix.