Migrate from gitea to forgejo.
This commit is contained in:
parent
3de8ff246f
commit
4c29603f14
5 changed files with 23 additions and 23 deletions
|
@ -4,19 +4,19 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
mkIf (elem "gitea" config.machine.services) {
|
||||
mkIf (elem "forgejo" config.machine.services) {
|
||||
services = {
|
||||
gitea = let
|
||||
forgejo = let
|
||||
cfg = config.machine;
|
||||
inherit ((findFirst (s: s.service == "gitea") cfg cfg.vHosts)) domain;
|
||||
inherit ((findFirst (s: s.service == "forgejo") cfg cfg.vHosts)) domain;
|
||||
in {
|
||||
enable = true;
|
||||
user = "git";
|
||||
database = {
|
||||
type = "mysql";
|
||||
user = "git";
|
||||
name = "gitea";
|
||||
passwordFile = config.sops.secrets."services/gitea/dbPass".path;
|
||||
name = "forgejo";
|
||||
passwordFile = config.sops.secrets."services/forgejo/dbPass".path;
|
||||
};
|
||||
settings = {
|
||||
repository = {
|
||||
|
@ -26,8 +26,8 @@ with lib;
|
|||
|
||||
security = {
|
||||
INSTALL_LOCK = true;
|
||||
COOKIE_USERNAME = "gitea_username";
|
||||
COOKIE_REMEMBER_NAME = "gitea_userauth";
|
||||
COOKIE_USERNAME = "forgejo_username";
|
||||
COOKIE_REMEMBER_NAME = "forgejo_userauth";
|
||||
};
|
||||
|
||||
server = {
|
||||
|
@ -45,15 +45,15 @@ with lib;
|
|||
};
|
||||
};
|
||||
};
|
||||
sops.secrets."services/gitea/dbPass" = {
|
||||
sops.secrets."services/forgejo/dbPass" = {
|
||||
owner = "git";
|
||||
group = "gitea";
|
||||
group = "forgejo";
|
||||
};
|
||||
users.users.git = {
|
||||
description = "Gitea Service";
|
||||
description = "Forgejo Service";
|
||||
isNormalUser = true;
|
||||
home = config.services.gitea.stateDir;
|
||||
createHome = true;
|
||||
home = config.services.forgejo.stateDir;
|
||||
createHome = false;
|
||||
useDefaultShell = true;
|
||||
};
|
||||
}
|
|
@ -6,9 +6,9 @@
|
|||
with lib;
|
||||
{
|
||||
vHost =
|
||||
if config.services.gitea.enable
|
||||
if config.services.forgejo.enable
|
||||
then {
|
||||
root = "${config.services.gitea.stateDir}/public";
|
||||
root = "${config.services.forgejo.stateDir}/public";
|
||||
extraConfig = ''
|
||||
location / {
|
||||
try_files maintain.html $uri $uri/index.html @node;
|
||||
|
@ -16,7 +16,7 @@ with lib;
|
|||
|
||||
location @node {
|
||||
client_max_body_size 0;
|
||||
proxy_pass http://${config.services.gitea.settings.server.HTTP_ADDR}:${toString config.services.gitea.settings.server.HTTP_PORT};
|
||||
proxy_pass http://${config.services.forgejo.settings.server.HTTP_ADDR}:${toString config.services.forgejo.settings.server.HTTP_PORT};
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $host;
|
|
@ -22,7 +22,7 @@ with lib;
|
|||
extraConfig = let
|
||||
users =
|
||||
concatMapStrings (user: "${user.name} ") config.machine.administrators
|
||||
+ (optionalString config.services.gitea.enable (config.services.gitea.user + " "));
|
||||
+ (optionalString config.services.forgejo.enable (config.services.forgejo.user + " "));
|
||||
in ''
|
||||
UsePAM no
|
||||
AllowUsers ${users}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue