rename forgejo options

This commit is contained in:
Douze Bé 2024-12-22 00:15:31 +01:00
parent 2f3c48b657
commit 87d4600af3
3 changed files with 20 additions and 20 deletions

View file

@ -47,7 +47,7 @@
http-port = 8081;
};
nixin.forge = {
nixin.forgejo = {
http-port = 8082;
domain = "forge.lab12.fr";
smtp-addr = "lab12.org";
@ -64,7 +64,7 @@
in lib.strings.trim pwd;
};
nixin.forge-runner = {
nixin.forgejo-runner = {
token-file = "/etc/forgejo/runner.token";
#token = let
# pwd = builtins.readFile <secrets/forgejo-runner-token>;

View file

@ -6,7 +6,7 @@ let
in
{
options = {
nixin.forge-runner = {
nixin.forgejo-runner = {
token-file = mkOption { type = lib.types.str; };
#token = mkOption { type = lib.types.str; };
url = mkOption { type = lib.types.str; };
@ -30,9 +30,9 @@ in
instances.default = {
enable = true;
name = "local-runner";
url = "${config.nixin.forge-runner.url}";
tokenFile = "${config.nixin.forge-runner.token-file}";
#token = "${config.nixin.forge-runner.token}";
url = "${config.nixin.forgejo-runner.url}";
tokenFile = "${config.nixin.forgejo-runner.token-file}";
#token = "${config.nixin.forgejo-runner.token}";
labels = [
# provide a debian base with nodejs for actions
"debian-latest:docker://node:20-bookworm"

View file

@ -6,7 +6,7 @@ let
in
{
options = {
nixin.forge = {
nixin.forgejo = {
http-port = mkOption { type = lib.types.int; };
domain = mkOption { type = lib.types.str; };
smtp-addr = mkOption { type = lib.types.str; };
@ -28,10 +28,10 @@ in
lfs.enable = true;
settings = {
server = {
DOMAIN = "${config.nixin.forge.domain}";
DOMAIN = "${config.nixin.forgejo.domain}";
# You need to specify this to remove the port from URLs in the web UI.
ROOT_URL = "https://${config.nixin.forge.domain}/";
HTTP_PORT = config.nixin.forge.http-port;
ROOT_URL = "https://${config.nixin.forgejo.domain}/";
HTTP_PORT = config.nixin.forgejo.http-port;
};
# You can temporarily allow registration to create an admin user.
service.DISABLE_REGISTRATION = true;
@ -46,13 +46,13 @@ in
mailer = {
ENABLED = true;
PROTOCOL = "smtp+starttls";
SMTP_ADDR = "${config.nixin.forge.smtp-addr}";
FROM = "${config.nixin.forge.smtp-from}";
USER = "${config.nixin.forge.smtp-user}";
#PASSWD = "${config.nixin.forge.smtp-pwd}";
SMTP_ADDR = "${config.nixin.forgejo.smtp-addr}";
FROM = "${config.nixin.forgejo.smtp-from}";
USER = "${config.nixin.forgejo.smtp-user}";
#PASSWD = "${config.nixin.forgejo.smtp-pwd}";
};
};
secrets.mailer.PASSWD = "${config.nixin.forge.smtp-pwd-file}";
secrets.mailer.PASSWD = "${config.nixin.forgejo.smtp-pwd-file}";
};
environment.systemPackages = let
@ -74,26 +74,26 @@ in
];
networking.hosts = {
"127.0.0.1" = ["${config.nixin.forge.domain}"];
"127.0.0.1" = ["${config.nixin.forgejo.domain}"];
};
systemd.services.forgejo.preStart = let
adminCmd = "${lib.getExe config.services.forgejo.package} admin user";
in ''
env >/tmp/debug
${adminCmd} create --admin --email "${config.nixin.forge.admin-email}" --username "${config.nixin.forge.admin-user}" --password "${config.nixin.forge.admin-pwd}" || true
${adminCmd} create --admin --email "${config.nixin.forgejo.admin-email}" --username "${config.nixin.forgejo.admin-user}" --password "${config.nixin.forgejo.admin-pwd}" || true
## uncomment this line to change an admin user which was already created
# ${adminCmd} change-password --username ${config.nixin.forge.admin-user} --password "${config.nixin.forge.admin-pwd}" || true
# ${adminCmd} change-password --username ${config.nixin.forgejo.admin-user} --password "${config.nixin.forgejo.admin-pwd}" || true
'';
services.traefik.dynamicConfigOptions.http.services."service-forgejo" = {
loadBalancer.servers = [
{ url = "http://localhost:${toString config.nixin.forge.http-port}"; }
{ url = "http://localhost:${toString config.nixin.forgejo.http-port}"; }
];
};
services.traefik.dynamicConfigOptions.http.routers."router-forgejo" = {
rule = "Host(`${config.nixin.forge.domain}`)";
rule = "Host(`${config.nixin.forgejo.domain}`)";
service = "service-forgejo";
};
};