From f27c89de119afbaaedbf9d71847e9b2ef66ce2b6 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Fri, 22 Nov 2024 18:54:57 -0500 Subject: [PATCH] refactor: factor out `forgejo` option --- modules/forgejo/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/forgejo/default.nix b/modules/forgejo/default.nix index 981dc46..7d7be8e 100644 --- a/modules/forgejo/default.nix +++ b/modules/forgejo/default.nix @@ -3,6 +3,8 @@ let cfg = config.aether.forgejo; forgejo = config.services.forgejo; srv = forgejo.settings.server; + + useSubdomain = !(builtins.isNull cfg.subdomain); in { imports = [ ./options.nix ]; @@ -33,15 +35,14 @@ in { database.user = forgejo.user; settings.server = { - DOMAIN = lib.optionalString (!(builtins.isNull cfg.subdomain)) "${cfg.subdomain}." + DOMAIN = lib.optionalString useSubdomain "${cfg.subdomain}." + config.aether.domain; ROOT_URL = "https://${srv.DOMAIN}/"; }; }; systemd.tmpfiles.rules = - lib.optional - (!(builtins.isNull cfg.templates)) + lib.optional useSubdomain "L+ ${cfg.stateDir}/custom/templates - - - - ${cfg.templates}"; } // lib.mkIf cfg.createUser {