mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 17:46:29 +09:00
nixos/gitea: drop useWizard
It was broken and lacks automated testing. See https://github.com/NixOS/nixpkgs/issues/413172
This commit is contained in:
parent
807602f988
commit
530e878123
1 changed files with 52 additions and 57 deletions
|
@ -79,8 +79,13 @@ in
|
||||||
)
|
)
|
||||||
|
|
||||||
(mkRemovedOptionModule [ "services" "gitea" "ssh" "enable" ]
|
(mkRemovedOptionModule [ "services" "gitea" "ssh" "enable" ]
|
||||||
"services.gitea.ssh.enable has been migrated into freeform setting services.gitea.settings.server.DISABLE_SSH. Keep in mind that the setting is inverted"
|
"It has been migrated into freeform setting services.gitea.settings.server.DISABLE_SSH. Keep in mind that the setting is inverted."
|
||||||
)
|
)
|
||||||
|
(mkRemovedOptionModule [
|
||||||
|
"services"
|
||||||
|
"gitea"
|
||||||
|
"useWizard"
|
||||||
|
] "Has been removed because it was broken and lacked automated testing.")
|
||||||
];
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
@ -93,12 +98,6 @@ in
|
||||||
|
|
||||||
package = mkPackageOption pkgs "gitea" { };
|
package = mkPackageOption pkgs "gitea" { };
|
||||||
|
|
||||||
useWizard = mkOption {
|
|
||||||
default = false;
|
|
||||||
type = types.bool;
|
|
||||||
description = "Do not generate a configuration and use gitea' installation wizard instead. The first registered user will be administrator.";
|
|
||||||
};
|
|
||||||
|
|
||||||
stateDir = mkOption {
|
stateDir = mkOption {
|
||||||
default = "/var/lib/gitea";
|
default = "/var/lib/gitea";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
@ -495,9 +494,7 @@ in
|
||||||
This can be disabled by using this option.
|
This can be disabled by using this option.
|
||||||
|
|
||||||
*Note:* please keep in mind that this should be added after the initial
|
*Note:* please keep in mind that this should be added after the initial
|
||||||
deploy unless [](#opt-services.gitea.useWizard)
|
deploy as the first registered user will be the administrator.
|
||||||
is `true` as the first registered user will be the administrator if
|
|
||||||
no install wizard is used.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -752,62 +749,60 @@ in
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
# copy custom configuration and generate random secrets if needed
|
# copy custom configuration and generate random secrets if needed
|
||||||
${optionalString (!cfg.useWizard) ''
|
function gitea_setup {
|
||||||
function gitea_setup {
|
cp -f '${configFile}' '${runConfig}'
|
||||||
cp -f '${configFile}' '${runConfig}'
|
|
||||||
|
|
||||||
if [ ! -s '${secretKey}' ]; then
|
if [ ! -s '${secretKey}' ]; then
|
||||||
${exe} generate secret SECRET_KEY > '${secretKey}'
|
${exe} generate secret SECRET_KEY > '${secretKey}'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Migrate LFS_JWT_SECRET filename
|
||||||
|
if [[ -s '${oldLfsJwtSecret}' && ! -s '${lfsJwtSecret}' ]]; then
|
||||||
|
mv '${oldLfsJwtSecret}' '${lfsJwtSecret}'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -s '${oauth2JwtSecret}' ]; then
|
||||||
|
${exe} generate secret JWT_SECRET > '${oauth2JwtSecret}'
|
||||||
|
fi
|
||||||
|
|
||||||
|
${lib.optionalString cfg.lfs.enable ''
|
||||||
|
if [ ! -s '${lfsJwtSecret}' ]; then
|
||||||
|
${exe} generate secret LFS_JWT_SECRET > '${lfsJwtSecret}'
|
||||||
fi
|
fi
|
||||||
|
''}
|
||||||
|
|
||||||
# Migrate LFS_JWT_SECRET filename
|
if [ ! -s '${internalToken}' ]; then
|
||||||
if [[ -s '${oldLfsJwtSecret}' && ! -s '${lfsJwtSecret}' ]]; then
|
${exe} generate secret INTERNAL_TOKEN > '${internalToken}'
|
||||||
mv '${oldLfsJwtSecret}' '${lfsJwtSecret}'
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -s '${oauth2JwtSecret}' ]; then
|
chmod u+w '${runConfig}'
|
||||||
${exe} generate secret JWT_SECRET > '${oauth2JwtSecret}'
|
${replaceSecretBin} '#secretkey#' '${secretKey}' '${runConfig}'
|
||||||
fi
|
${replaceSecretBin} '#dbpass#' '${cfg.database.passwordFile}' '${runConfig}'
|
||||||
|
${replaceSecretBin} '#oauth2jwtsecret#' '${oauth2JwtSecret}' '${runConfig}'
|
||||||
|
${replaceSecretBin} '#internaltoken#' '${internalToken}' '${runConfig}'
|
||||||
|
|
||||||
${lib.optionalString cfg.lfs.enable ''
|
${lib.optionalString cfg.lfs.enable ''
|
||||||
if [ ! -s '${lfsJwtSecret}' ]; then
|
${replaceSecretBin} '#lfsjwtsecret#' '${lfsJwtSecret}' '${runConfig}'
|
||||||
${exe} generate secret LFS_JWT_SECRET > '${lfsJwtSecret}'
|
''}
|
||||||
fi
|
|
||||||
''}
|
|
||||||
|
|
||||||
if [ ! -s '${internalToken}' ]; then
|
${lib.optionalString (cfg.camoHmacKeyFile != null) ''
|
||||||
${exe} generate secret INTERNAL_TOKEN > '${internalToken}'
|
${replaceSecretBin} '#hmackey#' '${cfg.camoHmacKeyFile}' '${runConfig}'
|
||||||
fi
|
''}
|
||||||
|
|
||||||
chmod u+w '${runConfig}'
|
${lib.optionalString (cfg.mailerPasswordFile != null) ''
|
||||||
${replaceSecretBin} '#secretkey#' '${secretKey}' '${runConfig}'
|
${replaceSecretBin} '#mailerpass#' '${cfg.mailerPasswordFile}' '${runConfig}'
|
||||||
${replaceSecretBin} '#dbpass#' '${cfg.database.passwordFile}' '${runConfig}'
|
''}
|
||||||
${replaceSecretBin} '#oauth2jwtsecret#' '${oauth2JwtSecret}' '${runConfig}'
|
|
||||||
${replaceSecretBin} '#internaltoken#' '${internalToken}' '${runConfig}'
|
|
||||||
|
|
||||||
${lib.optionalString cfg.lfs.enable ''
|
${lib.optionalString (cfg.metricsTokenFile != null) ''
|
||||||
${replaceSecretBin} '#lfsjwtsecret#' '${lfsJwtSecret}' '${runConfig}'
|
${replaceSecretBin} '#metricstoken#' '${cfg.metricsTokenFile}' '${runConfig}'
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${lib.optionalString (cfg.camoHmacKeyFile != null) ''
|
${lib.optionalString (cfg.captcha.secretFile != null) ''
|
||||||
${replaceSecretBin} '#hmackey#' '${cfg.camoHmacKeyFile}' '${runConfig}'
|
${replaceSecretBin} '#captchasecret#' '${cfg.captcha.secretFile}' '${runConfig}'
|
||||||
''}
|
''}
|
||||||
|
chmod u-w '${runConfig}'
|
||||||
${lib.optionalString (cfg.mailerPasswordFile != null) ''
|
}
|
||||||
${replaceSecretBin} '#mailerpass#' '${cfg.mailerPasswordFile}' '${runConfig}'
|
(umask 027; gitea_setup)
|
||||||
''}
|
|
||||||
|
|
||||||
${lib.optionalString (cfg.metricsTokenFile != null) ''
|
|
||||||
${replaceSecretBin} '#metricstoken#' '${cfg.metricsTokenFile}' '${runConfig}'
|
|
||||||
''}
|
|
||||||
|
|
||||||
${lib.optionalString (cfg.captcha.secretFile != null) ''
|
|
||||||
${replaceSecretBin} '#captchasecret#' '${cfg.captcha.secretFile}' '${runConfig}'
|
|
||||||
''}
|
|
||||||
chmod u-w '${runConfig}'
|
|
||||||
}
|
|
||||||
(umask 027; gitea_setup)
|
|
||||||
''}
|
|
||||||
|
|
||||||
# run migrations/init the database
|
# run migrations/init the database
|
||||||
${exe} migrate
|
${exe} migrate
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue