diff options
author | Martin Fischer <martin@push-f.com> | 2025-09-18 06:00:38 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2025-09-18 10:48:23 +0200 |
commit | b5840e628e60d1614e6e4e04b3ca30f3c7bfacd8 (patch) | |
tree | 2bb0d423338166a2e259be85b910d5c6760569fa /nixos/helpers.nix | |
parent | 70b3abe0d6a5e7cf46a8109dce05edcaca892f79 (diff) |
feat: generate web index for private web UIs
Diffstat (limited to 'nixos/helpers.nix')
-rw-r--r-- | nixos/helpers.nix | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/nixos/helpers.nix b/nixos/helpers.nix index f8f1384..a236c42 100644 --- a/nixos/helpers.nix +++ b/nixos/helpers.nix @@ -60,6 +60,19 @@ '}'; ''; + serviceIndexHost = tailnetHostname: webPorts: + let + li = name: port: ''<li><a href="http://${tailnetHostname}:${toString port}">${name}</a></li>''; + html = "<ul>" + (lib.concatStringsSep "\n" (lib.mapAttrsToList li webPorts)) + "</ul>"; + in + { + listenAddresses = [tailnetHostname]; + locations."= /".extraConfig = '' + default_type text/html; + return 200 '${html}'; + ''; + }; + writeAlloyConfig = cfg: let alloy-nix-config = "${pkgs.callPackage <top/shared/alloy-nix-config> {}}/bin/alloy-nix-config"; |