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-20 14:40:47 +0200 |
commit | 21fdce7d65f46c9935f0bf1b9475c8bcd28abf47 (patch) | |
tree | 8dd216ddf95eac6b7e780bcce0ddf5e7ae06267b /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 | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/nixos/helpers.nix b/nixos/helpers.nix index f8f1384..a30ccd8 100644 --- a/nixos/helpers.nix +++ b/nixos/helpers.nix @@ -60,6 +60,18 @@ '}'; ''; + 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 + { + 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"; |