From a280569c89bef9d67e20db601a0a26cc3b0fe302 Mon Sep 17 00:00:00 2001 From: Ethel Morgan Date: Sat, 11 Jul 2020 14:10:50 +0100 Subject: replace cgit and go-packages with sites.* functions --- nixos/sites/go-packages.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 nixos/sites/go-packages.nix (limited to 'nixos/sites/go-packages.nix') diff --git a/nixos/sites/go-packages.nix b/nixos/sites/go-packages.nix new file mode 100644 index 0000000..639b4c5 --- /dev/null +++ b/nixos/sites/go-packages.nix @@ -0,0 +1,20 @@ +{ pkgs }: +with pkgs.lib; + +let + mkLocation = virtualHost: module: url: { + name = "/${module}"; + value = { + extraConfig = '' + if ($args = "go-get=1") { + add_header Content-Type text/html; + return 200 ''; + } + return 302 ${url}; + ''; + }; + }; + +in { virtualHost, modules }: { + locations = listToAttrs (mapAttrsToList (mkLocation virtualHost) modules); +} -- cgit v1.2.3