···
cfg = config.services.gitea;
opt = options.services.gitea;
8
+
exe = lib.getExe cfg.package;
pg = config.services.postgresql;
useMysql = cfg.database.type == "mysql";
usePostgresql = cfg.database.type == "postgres";
···
staticRootPath = mkOption {
type = types.either types.str types.path;
251
-
default = gitea.data;
251
+
default = cfg.package.data;
defaultText = literalExpression "package.data";
example = "/var/lib/gitea/data";
description = lib.mdDoc "Upper level of template and static files path.";
···
# If we have a folder or symlink with gitea locales, remove it
# And symlink the current gitea locales in place
484
-
"L+ '${cfg.stateDir}/conf/locale' - - - - ${gitea.out}/locale"
484
+
"L+ '${cfg.stateDir}/conf/locale' - - - - ${cfg.package.out}/locale"
systemd.services.gitea = {
after = [ "network.target" ] ++ lib.optional usePostgresql "postgresql.service" ++ lib.optional useMysql "mysql.service";
wantedBy = [ "multi-user.target" ];
491
-
path = [ gitea pkgs.git pkgs.gnupg ];
491
+
path = [ cfg.package pkgs.git pkgs.gnupg ];
# In older versions the secret naming for JWT was kind of confusing.
# The file jwt_secret hold the value for LFS_JWT_SECRET and JWT_SECRET
···
cp -f ${configFile} ${runConfig}
if [ ! -s ${secretKey} ]; then
515
-
${gitea}/bin/gitea generate secret SECRET_KEY > ${secretKey}
515
+
${exe} generate secret SECRET_KEY > ${secretKey}
# Migrate LFS_JWT_SECRET filename
···
if [ ! -s ${oauth2JwtSecret} ]; then
524
-
${gitea}/bin/gitea generate secret JWT_SECRET > ${oauth2JwtSecret}
524
+
${exe} generate secret JWT_SECRET > ${oauth2JwtSecret}
if [ ! -s ${lfsJwtSecret} ]; then
528
-
${gitea}/bin/gitea generate secret LFS_JWT_SECRET > ${lfsJwtSecret}
528
+
${exe} generate secret LFS_JWT_SECRET > ${lfsJwtSecret}
if [ ! -s ${internalToken} ]; then
532
-
${gitea}/bin/gitea generate secret INTERNAL_TOKEN > ${internalToken}
532
+
${exe} generate secret INTERNAL_TOKEN > ${internalToken}
···
# run migrations/init the database
551
-
${gitea}/bin/gitea migrate
# update all hooks' binary paths
554
-
${gitea}/bin/gitea admin regenerate hooks
554
+
${exe} admin regenerate hooks
# update command option in authorized_keys
if [ -r ${cfg.stateDir}/.ssh/authorized_keys ]
559
-
${gitea}/bin/gitea admin regenerate keys
559
+
${exe} admin regenerate keys
···
WorkingDirectory = cfg.stateDir;
568
-
ExecStart = "${gitea}/bin/gitea web --pid /run/gitea/gitea.pid";
568
+
ExecStart = "${exe} web --pid /run/gitea/gitea.pid";
# Runtime directory and mode
RuntimeDirectory = "gitea";
···
systemd.services.gitea-dump = mkIf cfg.dump.enable {
description = "gitea dump";
after = [ "gitea.service" ];
638
+
path = [ cfg.package ];
···
649
-
ExecStart = "${gitea}/bin/gitea dump --type ${cfg.dump.type}" + optionalString (cfg.dump.file != null) " --file ${cfg.dump.file}";
649
+
ExecStart = "${exe} dump --type ${cfg.dump.type}" + optionalString (cfg.dump.file != null) " --file ${cfg.dump.file}";
WorkingDirectory = cfg.dump.backupDir;
···
timerConfig.OnCalendar = cfg.dump.interval;
661
-
meta.maintainers = with lib.maintainers; [ srhb ma27 ];
661
+
meta.maintainers = with lib.maintainers; [ srhb ma27 thehedgeh0g ];