refactor: factor out forgejo option

This commit is contained in:
Kiana Sheibani 2024-11-22 18:54:57 -05:00
parent 992ffdd92e
commit f27c89de11
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -3,6 +3,8 @@ let
cfg = config.aether.forgejo; cfg = config.aether.forgejo;
forgejo = config.services.forgejo; forgejo = config.services.forgejo;
srv = forgejo.settings.server; srv = forgejo.settings.server;
useSubdomain = !(builtins.isNull cfg.subdomain);
in { in {
imports = [ ./options.nix ]; imports = [ ./options.nix ];
@ -33,15 +35,14 @@ in {
database.user = forgejo.user; database.user = forgejo.user;
settings.server = { settings.server = {
DOMAIN = lib.optionalString (!(builtins.isNull cfg.subdomain)) "${cfg.subdomain}." DOMAIN = lib.optionalString useSubdomain "${cfg.subdomain}."
+ config.aether.domain; + config.aether.domain;
ROOT_URL = "https://${srv.DOMAIN}/"; ROOT_URL = "https://${srv.DOMAIN}/";
}; };
}; };
systemd.tmpfiles.rules = systemd.tmpfiles.rules =
lib.optional lib.optional useSubdomain
(!(builtins.isNull cfg.templates))
"L+ ${cfg.stateDir}/custom/templates - - - - ${cfg.templates}"; "L+ ${cfg.stateDir}/custom/templates - - - - ${cfg.templates}";
} }
// lib.mkIf cfg.createUser { // lib.mkIf cfg.createUser {