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

View file

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

View file

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