diff options
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"; |