Compare commits

..

1 commit

3 changed files with 50 additions and 34 deletions

View file

@ -5,6 +5,7 @@
... ...
}: { }: {
imports = [ imports = [
./services/gitea.nix
./services/nextcloud.nix ./services/nextcloud.nix
./services/webserver.nix ./services/webserver.nix
./services/starbound.nix ./services/starbound.nix
@ -80,6 +81,11 @@
domain = config.services.nginx.domain; domain = config.services.nginx.domain;
in { in {
"${domain}" = proxyPassToPort 3002 {serverAliases = ["www.${domain}"];}; "${domain}" = proxyPassToPort 3002 {serverAliases = ["www.${domain}"];};
"gitea.${domain}" = proxyPassToPort 3000 {};
"nextcloud.${domain}" = {
forceSSL = true;
enableACME = true;
};
}; };
}; };

View file

@ -1,30 +1,48 @@
{config, ...}: let {config, ...}: {
domain = "gitea.${config.services.nginx.domain}"; users = {
in { extraUsers.gitea = {
services.gitea = { uid = config.ids.uids.git;
inherit domain; isSystemUser = true;
enable = true; description = "Gitea Service";
group = config.users.extraGroups.gitea.name;
httpAddress = "127.0.0.1"; };
database.type = "postgres"; extraGroups.gitea = {gid = config.ids.gids.git;};
ssh.clonePort = 2222;
rootUrl = "https://gitea.tlater.net/";
cookieSecure = true;
appName = "Gitea: Git with a cup of tea";
}; };
# Set up SSL virtualisation.pods.gitea = {
services.nginx.virtualHosts."${domain}" = let hostname = "gitea.tlater.net";
inherit (config.services.gitea) httpAddress httpPort; publish = ["3000:3000" "2221:2221"];
in { network = "slirp4netns";
forceSSL = true;
enableACME = true;
extraConfig = ''
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
'';
locations."/".proxyPass = "http://${httpAddress}:httpPort"; containers = {
gitea = {
image = "gitea/gitea:latest";
volumes = ["gitea:/data:Z" "/etc/localtime:/etc/localtime:ro"];
dependsOn = ["postgres"];
environment = {
DB_TYPE = "postgres";
DB_HOST = "localhost:5432";
DB_NAME = "gitea";
DB_USER = "gitea";
USER_UID = toString config.users.extraUsers.gitea.uid;
USER_GID = toString config.users.extraGroups.gitea.gid;
RUN_MODE = "prod";
DOMAIN = "gitea.tlater.net";
SSH_PORT = "2221";
};
};
postgres = {
image = "postgres:alpine";
environment = {
POSTGRES_DB = "gitea";
POSTGRES_USER = "gitea";
};
volumes = ["gitea-postgres-14:/var/lib/postgresql/data"];
};
};
}; };
} }

View file

@ -5,13 +5,11 @@
}: let }: let
inherit (pkgs) fetchNextcloudApp; inherit (pkgs) fetchNextcloudApp;
nextcloud = pkgs.nextcloud23; nextcloud = pkgs.nextcloud23;
hostName = "nextcloud.${config.services.nginx.domain}"
in { in {
services.nextcloud = { services.nextcloud = {
inherit hostName;
package = nextcloud; package = nextcloud;
enable = true; enable = true;
hostName = "nextcloud.${config.services.nginx.domain}";
maxUploadSize = "2G"; maxUploadSize = "2G";
https = true; https = true;
@ -34,10 +32,4 @@ in {
# Ensure that this service doesn't start before postgres is ready # Ensure that this service doesn't start before postgres is ready
systemd.services.nextcloud-setup.after = ["postgresql.service"]; systemd.services.nextcloud-setup.after = ["postgresql.service"];
# Set up SSL
services.nginx.virtualHosts."${hostName}" = {
forceSSL = true;
enableACME = true;
};
} }