mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
feat: home-assistant + tewi
This commit is contained in:
parent
57e48cd9a8
commit
ec7571171b
15 changed files with 322 additions and 113 deletions
44
meta.nix
44
meta.nix
|
|
@ -1,4 +1,45 @@
|
|||
{ config, pkgs, lib, root, ... }: {
|
||||
{ config, pkgs, lib, root, ... }: with lib; let
|
||||
home = config.deploy.targets.home.tf;
|
||||
in {
|
||||
options = {
|
||||
tailnet_uri = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
tailnet = mkOption {
|
||||
type = types.attrsOf (types.submodule ({ name, ... }: {
|
||||
options = {
|
||||
addresses = {
|
||||
ipv4 = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
ipv6 = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
tags = mkOption {
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
};
|
||||
}));
|
||||
};
|
||||
};
|
||||
config = {
|
||||
|
||||
tailnet_uri = "inskip.me";
|
||||
tailnet = let
|
||||
raw = home.resources.tailnet_devices.importAttr "devices";
|
||||
devices = mapListToAttrs (elet: nameValuePair (removeSuffix ".${config.tailnet_uri}" elet.name) {
|
||||
tags = elet.tags;
|
||||
addresses = let
|
||||
addresses = elet.addresses;
|
||||
ipv4 = head (filter (e: hasInfix "." e) addresses);
|
||||
ipv6 = head (filter (e: hasInfix ":" e) addresses);
|
||||
in {
|
||||
inherit ipv4 ipv6;
|
||||
};
|
||||
}) raw;
|
||||
in devices;
|
||||
|
||||
runners = {
|
||||
lazy = {
|
||||
file = ./default.nix;
|
||||
|
|
@ -14,4 +55,5 @@
|
|||
|
||||
deploy.targets.dummy.enable = false;
|
||||
_module.args.pkgs = lib.mkDefault pkgs;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue