From a62c49661e9125d5d3be8e08c4ad693d996c2a3c Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 18 Nov 2019 21:41:35 -0500 Subject: [PATCH] Setup gitea on ao --- configuration.ao.nix | 49 +++++++++++++++++++++----------------- modules/services/gitea.nix | 24 +++++++++++++++++++ 2 files changed, 51 insertions(+), 22 deletions(-) diff --git a/configuration.ao.nix b/configuration.ao.nix index 65e0b190..85ae7981 100644 --- a/configuration.ao.nix +++ b/configuration.ao.nix @@ -10,6 +10,8 @@ ./modules/services/nginx.nix ./modules/services/gitea.nix ./modules/services/syncthing.nix + + ./modules/shell/git.nix ./modules/shell/zsh.nix ]; @@ -21,33 +23,36 @@ networking.firewall.allowedTCPPorts = [ 8384 ]; # nginx hosts - services.nginx.virtualHosts = { - "v0.io" = { - default = true; - enableACME = true; - forceSSL = true; - root = "/home/hlissner/www/v0.io"; + services.nginx = { + user = "hlissner"; + virtualHosts = { + "v0.io" = { + default = true; + enableACME = true; + forceSSL = true; + root = "/var/www/v0.io"; + }; + "dl.v0.io" = { + enableACME = true; + addSSL = true; + root = "/var/www/dl.v0.io"; + locations."~* \.(?:ico|css|js|gif|jpe?g|png|mp4)$".extraConfig = '' + expires 30d; + add_header Pragma public; + add_header Cache-Control public; + ''; + }; + "git.v0.io" = { + enableACME = true; + forceSSL = true; + locations."/".proxyPass = http://127.0.0.1:3000; + }; }; - "dl.v0.io" = { - enableACME = true; - addSSL = true; - root = "/home/hlissner/www/dl.v0.io"; - locations."~* \.(?:ico|css|js|gif|jpe?g|png|mp4)$".extraConfig = '' - expires 30d; - add_header Pragma public; - add_header Cache-Control public; - ''; - }; - # "git.v0.io" = { - # enableACME = true; - # forceSSL = true; - # locations."/".proxyPass = http://gitea; - # }; }; security.acme.certs = { "v0.io".email = "henrik@lissner.net"; "dl.v0.io".email = "henrik@lissner.net"; - # "git.v0.io".email = "henrik@lissner.net"; + "git.v0.io".email = "henrik@lissner.net"; }; } diff --git a/modules/services/gitea.nix b/modules/services/gitea.nix index 865d4690..84e354be 100644 --- a/modules/services/gitea.nix +++ b/modules/services/gitea.nix @@ -1,5 +1,29 @@ { config, lib, pkgs, ... }: { + users.users.git = { + useDefaultShell = true; + home = "/var/lib/gitea"; + group = "gitea"; + }; + services.gitea = { + enable = true; + log.level = "Info"; + + appName = "V-NOUGHT"; + database = { + user = "git"; + type = "postgres"; + }; + domain = "v0.io"; + rootUrl = "https://git.v0.io/"; + cookieSecure = true; + useWizard = false; + disableRegistration = true; + extraConfig = '' + [server] + SSH_DOMAIN = v0.io + ''; + }; }