feat: basic config for ForgeJo
This commit is contained in:
parent
98136e802b
commit
97d1783561
3 changed files with 121 additions and 3 deletions
116
applications/git/forgejo.nix
Normal file
116
applications/git/forgejo.nix
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
name = "forgejo";
|
||||||
|
cfg = config.services.skynet."${name}";
|
||||||
|
|
||||||
|
domain_base = "${cfg.domain.base}.${cfg.domain.tld}";
|
||||||
|
domain_full = "${cfg.domain.sub}.${domain_base}";
|
||||||
|
in {
|
||||||
|
imports = [
|
||||||
|
];
|
||||||
|
|
||||||
|
options.services.skynet."${name}" = {
|
||||||
|
enable = mkEnableOption "Skynet Forgejo";
|
||||||
|
|
||||||
|
domain = {
|
||||||
|
tld = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "ie";
|
||||||
|
};
|
||||||
|
|
||||||
|
base = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "skynet";
|
||||||
|
};
|
||||||
|
|
||||||
|
sub = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = name;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
forgejo = {
|
||||||
|
port = mkOption {
|
||||||
|
type = types.port;
|
||||||
|
default = 3000;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
# age.secrets.forgejo-mailer-password = {
|
||||||
|
# file = ../../secrets/forgejo/mailer-password.age;
|
||||||
|
# mode = "400";
|
||||||
|
# owner = "forgejo";
|
||||||
|
# };
|
||||||
|
|
||||||
|
services.skynet.acme.domains = [
|
||||||
|
"${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}"
|
||||||
|
];
|
||||||
|
|
||||||
|
# using https://nixos.org/manual/nixos/stable/index.html#module-services-gitlab as a guide
|
||||||
|
services.skynet.dns.records = [
|
||||||
|
{
|
||||||
|
record = cfg.domain.sub;
|
||||||
|
r_type = "CNAME";
|
||||||
|
value = config.services.skynet.host.name;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
services.nginx.virtualHosts = {
|
||||||
|
# main site
|
||||||
|
"${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}" = {
|
||||||
|
forceSSL = true;
|
||||||
|
useACMEHost = "skynet";
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://localhost:${toString cfg.forgejo.port}";
|
||||||
|
extraConfig = ''
|
||||||
|
client_max_body_size 1000M;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
services.forgejo = {
|
||||||
|
enable = true;
|
||||||
|
database.type = "sqlite3";
|
||||||
|
# Enable support for Git Large File Storage
|
||||||
|
lfs.enable = true;
|
||||||
|
settings = {
|
||||||
|
server = {
|
||||||
|
DOMAIN = "${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}";
|
||||||
|
# You need to specify this to remove the port from URLs in the web UI.
|
||||||
|
ROOT_URL = "https://${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}/";
|
||||||
|
HTTP_PORT = cfg.forgejo.port;
|
||||||
|
};
|
||||||
|
|
||||||
|
# You can temporarily allow registration to create an admin user.
|
||||||
|
service.DISABLE_REGISTRATION = true;
|
||||||
|
# Add support for actions, based on act: https://github.com/nektos/act
|
||||||
|
# actions = {
|
||||||
|
# ENABLED = true;
|
||||||
|
# DEFAULT_ACTIONS_URL = "github";
|
||||||
|
# };
|
||||||
|
# Sending emails is completely optional
|
||||||
|
# You can send a test email from the web UI at:
|
||||||
|
# Profile Picture > Site Administration > Configuration > Mailer Configuration
|
||||||
|
# mailer = {
|
||||||
|
# ENABLED = true;
|
||||||
|
# SMTP_ADDR = "mail.${cfg.domain.base}.${cfg.domain.tld}";
|
||||||
|
# FROM = "noreply@${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}";
|
||||||
|
# USER = "noreply@${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}";
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
# mailerPasswordFile = config.age.secrets.forgejo-mailer-password.path;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -779,11 +779,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_8": {
|
"nixpkgs_8": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721379653,
|
"lastModified": 1722813957,
|
||||||
"narHash": "sha256-8MUgifkJ7lkZs3u99UDZMB4kbOxvMEXQZ31FO3SopZ0=",
|
"narHash": "sha256-IAoYyYnED7P8zrBFMnmp7ydaJfwTnwcnqxUElC1I26Y=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "1d9c2c9b3e71b9ee663d11c5d298727dace8d374",
|
"rev": "cb9a96f23c491c081b38eab96d22fa958043c9fa",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -27,6 +27,7 @@ Notes: Each user has roughly 20gb os storage
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
../applications/git/gitlab.nix
|
../applications/git/gitlab.nix
|
||||||
|
../applications/git/forgejo.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
deployment = {
|
deployment = {
|
||||||
|
@ -41,5 +42,6 @@ in {
|
||||||
host = host;
|
host = host;
|
||||||
backup.enable = true;
|
backup.enable = true;
|
||||||
gitlab.enable = true;
|
gitlab.enable = true;
|
||||||
|
forgejo.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue