2019-09-06 06:50:59 +00:00
|
|
|
# NixOps configuration for the hosts running Gitea
|
2019-09-06 01:05:32 +00:00
|
|
|
|
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
services.gitea = {
|
2019-09-06 06:50:59 +00:00
|
|
|
enable = true; # Enable Gitea
|
|
|
|
appName = "mcwhirter.io: Gitea Service"; # Give the site a name
|
2019-09-06 01:05:32 +00:00
|
|
|
database = {
|
2019-09-06 06:50:59 +00:00
|
|
|
type = "postgres"; # Database type
|
|
|
|
passwordFile = "/run/keys/gitea-dbpass"; # Where to find the password
|
2019-09-06 01:05:32 +00:00
|
|
|
};
|
2019-09-06 06:50:59 +00:00
|
|
|
domain = "source.mcwhirter.io"; # Domain name
|
|
|
|
rootUrl = "https://source.mcwhirter.io/"; # Root web URL
|
|
|
|
httpPort = 3001; # Provided unique port
|
|
|
|
extraConfig = let
|
|
|
|
docutils =
|
|
|
|
pkgs.python37.withPackages (ps: with ps; [
|
|
|
|
docutils # Provides rendering of ReStructured Text files
|
|
|
|
pygments # Provides syntax highlighting
|
|
|
|
]);
|
|
|
|
in ''
|
2019-09-06 01:05:32 +00:00
|
|
|
[mailer]
|
|
|
|
ENABLED = true
|
|
|
|
FROM = "gitea@mcwhirter.io"
|
|
|
|
[service]
|
|
|
|
REGISTER_EMAIL_CONFIRM = true
|
|
|
|
[markup.restructuredtext]
|
|
|
|
ENABLED = true
|
|
|
|
FILE_EXTENSIONS = .rst
|
2019-09-06 06:50:59 +00:00
|
|
|
RENDER_COMMAND = ${docutils}/bin/rst2html.py
|
2019-09-06 01:05:32 +00:00
|
|
|
IS_INPUT_FILE = false
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
services.postgresql = {
|
|
|
|
enable = true; # Ensure postgresql is enabled
|
2019-09-06 06:50:59 +00:00
|
|
|
authentication = ''
|
|
|
|
local gitea all ident map=gitea-users
|
|
|
|
'';
|
2019-09-06 01:05:32 +00:00
|
|
|
identMap = # Map the gitea user to postgresql
|
|
|
|
''
|
|
|
|
gitea-users gitea gitea
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = true; # Enable Nginx
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
virtualHosts."source.mcwhirter.io" = { # Gitea hostname
|
|
|
|
enableACME = true; # Use ACME certs
|
|
|
|
forceSSL = true; # Force SSL
|
|
|
|
locations."/".proxyPass = "http://localhost:3001/"; # Proxy Gitea
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
security.acme.certs = {
|
|
|
|
"source.mcwhirter.io".email = "craige@mcwhirter.io";
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|