refactor: reorganize module layout

This commit is contained in:
4DBug committed 2026-10-16 07:45:16 -05:00
1 parent 9a6bbc26c1
commit 0431bce152
63 files changed
+323

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
{
den.quirks.tunnel.description = "cloudflared ingress: { subdomain, port }";
# per host: den.hosts.<sys>.<host>.cloudflared = { uuid = "..."; protocol = "http2"; # optional };
den.aspects.services.cloudflared = {
nixos = { tunnel, host, pkgs, lib, config, ... }: let
inherit (host.cloudflared) uuid;
inherit (host) domain;
user = host.owner;
in {
environment.systemPackages = [ pkgs.cloudflared ];
environment.etc."cloudflared/${uuid}.json".source = "${config.users.users.${user}.home}/.cloudflared/${uuid}.json";
services.cloudflared = {
enable = true;
tunnels.${uuid} = {
credentialsFile = "/etc/cloudflared/${uuid}.json";
default = "http_status:404";
ingress = lib.listToAttrs (map (t: {
name = "${t.subdomain}.${domain}";
value = "http://127.0.0.1:${toString t.port}";
}) tunnel);
};
};
systemd.services."cloudflared-tunnel-${uuid}".environment = lib.mkIf (host.cloudflared ? protocol) {
TUNNEL_TRANSPORT_PROTOCOL = lib.mkForce host.cloudflared.protocol;
};
};
};
}