| 21 Oct 2022 |
Wanja Hentze | I keep wanting a multi-host service abstraction | 11:52:57 |
Wanja Hentze | we have a few of these strung about in an ad-hoc manner in this codebase | 11:53:07 |
Wanja Hentze | but they're all bad in different ways | 11:53:14 |
@yuka:yuka.dev | you can already kinda do that with hive by accessing the nodes specialArgs attribute | 11:53:19 |
Wanja Hentze | yes, we have that | 11:53:28 |
Wanja Hentze | and some ad-hoc conventions on top | 11:53:33 |
Wanja Hentze | sometimes we filter nodes by name, other times by tag etc. | 11:53:55 |
@yuka:yuka.dev | I also generate a groups module arg:
_module.args.groups = let
tagNames = lib.unique (
lib.concatLists (
lib.mapAttrsToList (
name: host: host.config.deployment.tags
) args.nodes
)
);
in lib.genAttrs tagNames (
tagName: lib.filter (
host: lib.elem tagName host.config.deployment.tags
) (
lib.attrValues args.nodes
)
);
| 11:54:09 |
Wanja Hentze | o nice | 11:54:17 |
@yuka:yuka.dev | * I also generate a groups module arg:
{ ... }@attrs:
{
_module.args.groups = let
tagNames = lib.unique (
lib.concatLists (
lib.mapAttrsToList (
name: host: host.config.deployment.tags
) args.nodes
)
);
in lib.genAttrs tagNames (
tagName: lib.filter (
host: lib.elem tagName host.config.deployment.tags
) (
lib.attrValues args.nodes
)
);
}
| 11:55:28 |
@yuka:yuka.dev | * I also generate a groups module arg:
{ lib, ... }@attrs:
{
_module.args.groups = let
tagNames = lib.unique (
lib.concatLists (
lib.mapAttrsToList (
name: host: host.config.deployment.tags
) args.nodes
)
);
in lib.genAttrs tagNames (
tagName: lib.filter (
host: lib.elem tagName host.config.deployment.tags
) (
lib.attrValues args.nodes
)
);
}
| 11:55:40 |
@yuka:yuka.dev | * I also generate a groups module arg:
{ lib, ... }@args:
{
_module.args.groups = let
tagNames = lib.unique (
lib.concatLists (
lib.mapAttrsToList (
name: host: host.config.deployment.tags
) args.nodes
)
);
in lib.genAttrs tagNames (
tagName: lib.filter (
host: lib.elem tagName host.config.deployment.tags
) (
lib.attrValues args.nodes
)
);
}
| 11:55:52 |
@yuka:yuka.dev | makes some of the modules way cleaner | 11:56:02 |
Wanja Hentze | this just makes one group per tag, right? | 11:56:32 |
@yuka:yuka.dev | yes | 11:56:43 |
@yuka:yuka.dev | like the wireguard module just adds deployment.tags = [ "wireguard" ]; and then accesses groups.wireguard to get all the hosts that have the module enabled (it should mesh to) | 11:57:13 |
Wanja Hentze | I might steal this ┏ʕ •ᴥ•ʔ┛ | 11:58:52 |
@yuka:yuka.dev | feel free to | 11:59:07 |
@yuka:yuka.dev | but also I'll try to get my module based hive thing into shape and make a repo somewhere | 11:59:36 |
@yuka:yuka.dev | not sure really what modules would work better on that layer | 11:59:50 |
@yuka:yuka.dev | Wanja Hentze: do you have an idea for a name for the module system hive thingy? | 12:37:56 |
Wanja Hentze | 😬 | 12:38:08 |
@yuka:yuka.dev | coming up with names is hard | 12:38:14 |
Wanja Hentze | oh no, my sole weakness | 12:38:18 |
@yuka:yuka.dev | but I need a name to publish it in a repo | 12:38:22 |
@yuka:yuka.dev | currently it is hive-modules/yuka-hive.nix | 12:38:34 |
@yuka:yuka.dev | to distinguish it from a colmena hive | 12:38:42 |
@yuka:yuka.dev | but don't really want to keep my nickname in there if others will use it | 12:39:02 |
@yuka:yuka.dev | so I need something else to distinguish it from colmena hive, or another name entirely | 12:39:17 |
Wanja Hentze | "colmena" is spanish for "hive", so maybe another word for "hive" from a different language? 🤔 | 12:39:47 |