gitea
This module provides a Nix configuration for deploying a Gitea Git service. Gitea is a self-hosted Git management software. It includes options for configuring the HTTP and SSH ports, domain, root URL, data directory, and firewall settings. It also configures the Gitea service with sensible defaults and enables it if specified.
Options
Here’s a detailed list of the available options and their configurations:
local.gitea.enable
- Type:
boolean - Default:
false - Description: Enables or disables the Gitea Git service. Setting this option to
truewill configure and enable the Gitea service.
local.gitea.port
- Type:
port(integer representing a port number) - Default:
3001 - Description: The HTTP port for the Gitea web interface. This is the port that users will use to access Gitea through a web browser.
local.gitea.sshPort
- Type:
port(integer representing a port number) - Default:
2222 - Description: The SSH port for Git operations. This port is used for cloning, pushing, and pulling Git repositories via SSH.
local.gitea.domain
- Type:
string - Default:
"localhost" - Example:
"git.example.com" - Description: The domain name for the Gitea instance. This should be a valid domain name or subdomain that resolves to the server running Gitea.
local.gitea.rootUrl
- Type:
string - Default:
"http://localhost:3001/" - Example:
"https://git.example.com/" - Description: The root URL for accessing Gitea. This URL is used by Gitea to generate links and redirects. It must end with a trailing slash. If you are using HTTPS, be sure to specify
https://here.
local.gitea.dataDir
- Type:
string - Default:
"/var/lib/gitea" - Description: The data directory for Gitea. This directory stores the Gitea database, repositories, and other data. Make sure this directory is writable by the Gitea user.
local.gitea.openFirewall
- Type:
boolean - Default:
false - Description: Opens the firewall ports for Gitea, specifically the HTTP port (
local.gitea.port) and SSH port (local.gitea.sshPort). Setting this to true will automatically configure the NixOS firewall to allow traffic on these ports.
Configuration Details
When local.gitea.enable is set to true, the following configurations are applied:
- The
services.gitea.enableoption is set totrue, enabling the Gitea service. - The
services.gitea.appNameis set to"Gitea: Git with a cup of tea". - The database type is set to
sqlite3and the path is set to${cfg.dataDir}/data/gitea.db. - The
settings.server.DOMAINis set to the calculated domain. - The
settings.server.ROOT_URLis set to the calculated root URL. - The
settings.server.HTTP_PORTis set to the value oflocal.gitea.port. - The
settings.server.SSH_PORTis set to the value oflocal.gitea.sshPort. - The
settings.server.START_SSH_SERVERis set totrue. - Various settings for
service,session,repository,ui, andactionsare configured with reasonable defaults. - The
services.gitea.stateDiris set to the value oflocal.gitea.dataDir. - If
local.gitea.openFirewallis set totrue, thenetworking.firewall.allowedTCPPortsoption is configured to allow traffic on the HTTP and SSH ports.