diff options
author | Ben Sima <ben@bsima.me> | 2022-02-02 14:56:56 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2022-02-02 14:56:56 -0500 |
commit | 37c7c93a11767fac68e2a5e94a8c8d36fc8c7a30 (patch) | |
tree | 7ab02555c6b8508693a5529c61ffad3c288834d6 /Biz/Cloud | |
parent | cfc91791defd0657dfa20da5a7a5aa6cda6097e0 (diff) |
Move all git stuff to Git.nix
Well except for the redirect, but that's an annoying part of the cgit
implementation which will hopefully go away at some point.
Diffstat (limited to 'Biz/Cloud')
-rw-r--r-- | Biz/Cloud/Git.nix | 23 | ||||
-rw-r--r-- | Biz/Cloud/Web.nix | 25 |
2 files changed, 26 insertions, 22 deletions
diff --git a/Biz/Cloud/Git.nix b/Biz/Cloud/Git.nix index eb61a10..d1cdf9f 100644 --- a/Biz/Cloud/Git.nix +++ b/Biz/Cloud/Git.nix @@ -1,6 +1,7 @@ { pkgs, lib, config, ... }: let + inherit (config.networking) domain; root = "/var/git"; in { services = { @@ -31,6 +32,28 @@ in { user = "gitDaemon"; group = "gitDaemon"; }; + nginx.virtualHosts.${domain}.cgit = { + enable = true; + location = "/git"; + virtual-root = "/git"; + css = "/git/cgit.css"; + logo = "/git/cgit.png"; + root-title = "ben's git repos"; + root-desc = "building"; + enable-git-config = 1; + clone-url = lib.strings.concatStringsSep " " [ + "https://$HTTP_HOST/git/$CGIT_REPO_URL" + "git://$HTTP_HOST/$CGIT_REPO_URL" + "git@$HTTP_HOST:$CGIT_REPO_URL" + ]; + include = [ + # these depend on order, scan-path must come last + (builtins.toFile "cgitrc" '' + strict-export=git-daemon-export-ok + scan-path=${root}/repositories + '') + ]; + }; }; # need to specify that these users can access git files by being part of the # git group diff --git a/Biz/Cloud/Web.nix b/Biz/Cloud/Web.nix index 08e2267..fbe4e03 100644 --- a/Biz/Cloud/Web.nix +++ b/Biz/Cloud/Web.nix @@ -66,6 +66,9 @@ in forceSSL = true; enableACME = true; locations = { + # the nginx/cgit module puts a '/' at the end of 'location', so we need to + # redirect '/git' to '/git/' + "/git".return = "301 https://$host/git/"; "/" = { root = "/var/web/simatime.com"; extraConfig = '' @@ -81,28 +84,6 @@ in ''; }; }; - cgit = { - enable = true; - location = "/git"; - virtual-root = "/git"; - css = "/git/cgit.css"; - logo = "/git/cgit.png"; - root-title = "ben's git repos"; - root-desc = "building"; - enable-git-config = 1; - clone-url = lib.strings.concatStringsSep " " [ - "https://$HTTP_HOST/git/$CGIT_REPO_URL" - "git://$HTTP_HOST/$CGIT_REPO_URL" - "git@$HTTP_HOST:$CGIT_REPO_URL" - ]; - include = [ - # these depend on order, scan-path must come last - (builtins.toFile "cgitrc" '' - strict-export=git-daemon-export-ok - scan-path=/var/git/repositories - '') - ]; - }; }; "bsima.me" = { |