From 87d4600af38c5ec72e0db49ca949bcddba8eb0c7 Mon Sep 17 00:00:00 2001 From: Fabrice Bellamy <12b@distrilab.fr> Date: Sun, 22 Dec 2024 00:15:31 +0100 Subject: [PATCH] rename forgejo options --- config/arachnide/configuration.nix | 4 ++-- modules/forgejo-runner.nix | 8 ++++---- modules/forgejo.nix | 28 ++++++++++++++-------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/config/arachnide/configuration.nix b/config/arachnide/configuration.nix index 34abca8..a42228a 100644 --- a/config/arachnide/configuration.nix +++ b/config/arachnide/configuration.nix @@ -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 ; diff --git a/modules/forgejo-runner.nix b/modules/forgejo-runner.nix index 42ebf4b..e2d173d 100644 --- a/modules/forgejo-runner.nix +++ b/modules/forgejo-runner.nix @@ -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" diff --git a/modules/forgejo.nix b/modules/forgejo.nix index 314eb28..ff0f82a 100644 --- a/modules/forgejo.nix +++ b/modules/forgejo.nix @@ -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"; }; };