!UKDpaKNNsBpOPfLWfX:zhaofeng.li

Colmena

323 Members
A simple, stateless NixOS deployment tool - https://github.com/zhaofengli/colmena110 Servers

Load older messages


SenderMessageTime
2 Sep 2022
@yuka:yuka.dev@yuka:yuka.devAs a bonus, it would remove the need for this wrapper flake to get pure evaluation14:50:43
@yuka:yuka.dev@yuka:yuka.devAnother bonus: This could make it possible to be compatible with nixosConfigurations and nixos-rebuild and so on15:14:47
@tpw_rules:matrix.orgtpw_rules^16:46:57
@linus:schreibt.jetztLinux Hackerman Yeah, I've previously suggested this but it wasn't a direction Zhaofeng Li was particularly interested in :/ 16:47:39
@linus:schreibt.jetztLinux Hackerman

I'm currently doing a hack like

    nixosConfigurations = lib.mapAttrs (name: config: let
      nodeNixpkgs = self.outputs.colmena.meta.nodeNixpkgs.${name} or self.outputs.colmena.meta.nixpkgs;
      nodeNixos = import (nodeNixpkgs.path + "/nixos/lib/eval-config.nix");
      in nodeNixos {
        modules = [
          self.outputs.colmena.defaults
          config
          inputs.colmena.nixosModules.deploymentOptions
          {
            _module.args.name = name;
            _module.args.nodes = self.outputs.nixosConfigurations;
            nixpkgs.overlays = [ nodeNixpkgs.lib.flakeOverlay (import ./overlay.nix) ];
          }
        ];
        inherit (nodeNixpkgs) system;
      }
    ) (builtins.removeAttrs self.outputs.colmena ["meta" "defaults"]);

to be able to get at least an approximation of the configs (enough to be able to build it in hydra, for example)

16:48:55
@linus:schreibt.jetztLinux Hackermanbut I think sooner or later I'll be switching to another tool that actually wants to support this, possibly deploy-rs16:49:18
@linus:schreibt.jetztLinux HackermanOf course now I can't find the old messages where we discussed this... I guess it was before I moved homeservers16:53:28
@zhaofeng:zhaofeng.liZhaofeng Li I would be on-board if the Colmena flake is generating the nixosConfigurations-like structure with Colmena-specific metadata (this is similar to the evaluator idea that @blaggacao is proposing) rather than consuming an existing nixosConfigurations. We would need some versioning/schema contract to ensure compatibility between the flake output and the Colmena executable. 18:26:56
@yuka:yuka.dev@yuka:yuka.devYou could just tell the users that the colmena binary has to be from the exact same version as the hive expression18:28:22
@yuka:yuka.dev@yuka:yuka.dev

And the colmena package itself could be re-exported to my flake.
So that I do nix run .#colmena apply and it uses the colmena version pinned in my flake.

18:28:59
@yuka:yuka.dev@yuka:yuka.dev And yes, the hive expression should output nixosConfigurations-like structure, the input would be similar to what outputs.colmena is currently 18:29:50
@blaggacao:matrix.orgDavid Arnold (blaggacao)

So you mean something like:

mkFlake ...

->

nixosConfigurations = ...
__colmena = ...
18:29:51
@blaggacao:matrix.orgDavid Arnold (blaggacao)* So you mean something like: ? ``` mkFlake ... ``` -> ``` nixosConfigurations = ... __colmena = ... ```18:30:45
@zhaofeng:zhaofeng.liZhaofeng Li

To further expand on that, consuming the existing nixosConfigurations is problematic, since Colmena needs to insert two things into the configuration: Modules (deployment.* options and configs) as well as module arguments (name and nodes which allows you to refer to configurations of other nodes in the cluster). This is in part following the design decisions of NixOps and morph. Inserting them cannot be cleanly done in case of nixosConfigurations which contains complete, evaluated configurations rather than individual NixOS modules.

We could remove this need and make the user specify the deployment.* configs externally, outside the NixOS configuration. This is the approach that deploy-rs takes (the deploy output). The downside is two-fold:

  1. The level of configuration composition possible will be limited. As an example, I set deployment.tags = [ "routers" ]; in my router module so enabling it will automatically make colmena apply --on @routers deploy to this node. Additionally, I use the added nodes argument extensively in my configuration to set up a WireGuard mesh and iBGP peerings between my nodes.
  2. The effect Colmena can have on the target node configuration will be limited. For instance, Colmena creates the ${name}-key.service for each secret file defined in deployment.keys, which will no longer be possible. deploy-rs uses a deploy binary copied alongside the profile to implement activation and other features.

The end result is a level of functionality noticeably different from "normal" Colmena that would necessitate a lot of documentation changes and still be confusing to users.

18:31:10
@linus:schreibt.jetztLinux Hackerman

My interpretation is

hive = { defaults = ...; meta = ...; nodeA = ...; };
nixosConfigurations = (colmena.evalHive self.outputs.hive).nixosConfigurations;
18:31:48
@blaggacao:matrix.orgDavid Arnold (blaggacao)Even better!18:32:22
@yuka:yuka.dev@yuka:yuka.dev
In reply to @zhaofeng:zhaofeng.li

To further expand on that, consuming the existing nixosConfigurations is problematic, since Colmena needs to insert two things into the configuration: Modules (deployment.* options and configs) as well as module arguments (name and nodes which allows you to refer to configurations of other nodes in the cluster). This is in part following the design decisions of NixOps and morph. Inserting them cannot be cleanly done in case of nixosConfigurations which contains complete, evaluated configurations rather than individual NixOS modules.

We could remove this need and make the user specify the deployment.* configs externally, outside the NixOS configuration. This is the approach that deploy-rs takes (the deploy output). The downside is two-fold:

  1. The level of configuration composition possible will be limited. As an example, I set deployment.tags = [ "routers" ]; in my router module so enabling it will automatically make colmena apply --on @routers deploy to this node. Additionally, I use the added nodes argument extensively in my configuration to set up a WireGuard mesh and iBGP peerings between my nodes.
  2. The effect Colmena can have on the target node configuration will be limited. For instance, Colmena creates the ${name}-key.service for each secret file defined in deployment.keys, which will no longer be possible. deploy-rs uses a deploy binary copied alongside the profile to implement activation and other features.

The end result is a level of functionality noticeably different from "normal" Colmena that would necessitate a lot of documentation changes and still be confusing to users.

No no, inserting the modules is fine. Just what I don't like is that the version of those modules is not pinned in my flake, and thus my flake alone is not sufficient anymore for evaluating the config.
18:32:59
@blaggacao:matrix.orgDavid Arnold (blaggacao)I think it's vetter to avoid the indirection via the cli if possible.18:33:48
@blaggacao:matrix.orgDavid Arnold (blaggacao)But, I don't know if that may break the paraleval18:34:01
@blaggacao:matrix.orgDavid Arnold (blaggacao)(which may be the main current justification)18:34:24
@linus:schreibt.jetztLinux Hackerman
In reply to @zhaofeng:zhaofeng.li

To further expand on that, consuming the existing nixosConfigurations is problematic, since Colmena needs to insert two things into the configuration: Modules (deployment.* options and configs) as well as module arguments (name and nodes which allows you to refer to configurations of other nodes in the cluster). This is in part following the design decisions of NixOps and morph. Inserting them cannot be cleanly done in case of nixosConfigurations which contains complete, evaluated configurations rather than individual NixOS modules.

We could remove this need and make the user specify the deployment.* configs externally, outside the NixOS configuration. This is the approach that deploy-rs takes (the deploy output). The downside is two-fold:

  1. The level of configuration composition possible will be limited. As an example, I set deployment.tags = [ "routers" ]; in my router module so enabling it will automatically make colmena apply --on @routers deploy to this node. Additionally, I use the added nodes argument extensively in my configuration to set up a WireGuard mesh and iBGP peerings between my nodes.
  2. The effect Colmena can have on the target node configuration will be limited. For instance, Colmena creates the ${name}-key.service for each secret file defined in deployment.keys, which will no longer be possible. deploy-rs uses a deploy binary copied alongside the profile to implement activation and other features.

The end result is a level of functionality noticeably different from "normal" Colmena that would necessitate a lot of documentation changes and still be confusing to users.

  1. The nodes argument doesn't require colmena though. nixosConfigurations can reference self.outputs.nixosConfigurations to get at other hosts.
  2. (covers deployment.tags as well) I'd prefer for there to be e.g. inputs.colmena.nixosModules.default that doesn't just supply the options (as inputs.colmena.nixosModules.deploymentOptions does), but also their implementation. I don't see (feel free to point it out) what needs to be injected there that isn't available at "any" evaluation time -- with nixops's model of resources that are also managed by the tool, that makes sense, but given that colmena doesn't "create" machines or otherwise manage resources (sensible choice IMO!) it's not necessary.
18:35:45
@linus:schreibt.jetztLinux Hackerman
In reply to @zhaofeng:zhaofeng.li

To further expand on that, consuming the existing nixosConfigurations is problematic, since Colmena needs to insert two things into the configuration: Modules (deployment.* options and configs) as well as module arguments (name and nodes which allows you to refer to configurations of other nodes in the cluster). This is in part following the design decisions of NixOps and morph. Inserting them cannot be cleanly done in case of nixosConfigurations which contains complete, evaluated configurations rather than individual NixOS modules.

We could remove this need and make the user specify the deployment.* configs externally, outside the NixOS configuration. This is the approach that deploy-rs takes (the deploy output). The downside is two-fold:

  1. The level of configuration composition possible will be limited. As an example, I set deployment.tags = [ "routers" ]; in my router module so enabling it will automatically make colmena apply --on @routers deploy to this node. Additionally, I use the added nodes argument extensively in my configuration to set up a WireGuard mesh and iBGP peerings between my nodes.
  2. The effect Colmena can have on the target node configuration will be limited. For instance, Colmena creates the ${name}-key.service for each secret file defined in deployment.keys, which will no longer be possible. deploy-rs uses a deploy binary copied alongside the profile to implement activation and other features.

The end result is a level of functionality noticeably different from "normal" Colmena that would necessitate a lot of documentation changes and still be confusing to users.

*
  1. The nodes argument doesn't require colmena though. nixosConfigurations can reference self.outputs.nixosConfigurations to get at other hosts.
  2. (covers deployment.tags as well) I'd prefer for there to be e.g. inputs.colmena.nixosModules.default that doesn't just supply the options (as inputs.colmena.nixosModules.deploymentOptions does), but also their implementation. I don't see (feel free to point it out if I'm missing something) what needs to be injected there that isn't available at "any" evaluation time -- with nixops's model of resources that are also managed by the tool, that makes sense, but given that colmena doesn't "create" machines or otherwise manage resources (sensible choice IMO!) it's not necessary.
18:35:53
@blaggacao:matrix.orgDavid Arnold (blaggacao)(I might be totally wrong, too)18:36:10
@yuka:yuka.dev@yuka:yuka.dev
In reply to @blaggacao:matrix.org
But, I don't know if that may break the paraleval
I don't think that would be influenced by this kind of change
18:38:13
@linus:schreibt.jetztLinux Hackermansame18:38:38
@yuka:yuka.dev@yuka:yuka.devI will try to prepare a PR that solves most of the problem without too many changes18:38:40
@yuka:yuka.dev@yuka:yuka.devIf that's fine with y'all18:38:51
@yuka:yuka.dev@yuka:yuka.devfirst not even focusing on producing a nixosConfigurations, but giving a first stepping stone in that direction18:39:14
@zhaofeng:zhaofeng.liZhaofeng Li
In reply to @yuka:yuka.dev
You could just tell the users that the colmena binary has to be from the exact same version as the hive expression
There still need to be some kind of versioning and/or a contract, because David Arnold (blaggacao) is making a framework (std) that will emit this structure with its own logic
18:41:35
@yuka:yuka.dev@yuka:yuka.devI mean, how is the current interface versioned?18:42:16

Show newer messages


Back to Room ListRoom Version: 6