add forgejo-cli to forgejo.nix module
This commit is contained in:
parent
81fda64f42
commit
327c1990d0
1 changed files with 22 additions and 0 deletions
|
@ -55,6 +55,28 @@ in
|
||||||
secrets.mailer.PASSWD = "${config.nixin.forge.smtp-pwd-file}";
|
secrets.mailer.PASSWD = "${config.nixin.forge.smtp-pwd-file}";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = let
|
||||||
|
cfg = config.services.forgejo;
|
||||||
|
forgejo-cli = pkgs.writeScriptBin "forgejo" ''
|
||||||
|
#!${pkgs.runtimeShell}
|
||||||
|
cd ${cfg.stateDir}
|
||||||
|
sudo=exec
|
||||||
|
if [[ "$USER" != forgejo ]]; then
|
||||||
|
sudo='exec /run/wrappers/bin/sudo -u ${cfg.user} -g ${cfg.group} --preserve-env=GITEA_WORK_DIR --preserve-env=GITEA_CUSTOM'
|
||||||
|
fi
|
||||||
|
# Note that these variable names will change
|
||||||
|
export GITEA_WORK_DIR=${cfg.stateDir}
|
||||||
|
export GITEA_CUSTOM=${cfg.customDir}
|
||||||
|
$sudo ${lib.getExe cfg.package} "$@"
|
||||||
|
'';
|
||||||
|
in [
|
||||||
|
forgejo-cli
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.hosts = {
|
||||||
|
"127.0.0.1" = ["${config.nixin.forge.domain}"];
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services.forgejo.preStart = let
|
systemd.services.forgejo.preStart = let
|
||||||
adminCmd = "${lib.getExe config.services.forgejo.package} admin user";
|
adminCmd = "${lib.getExe config.services.forgejo.package} admin user";
|
||||||
in ''
|
in ''
|
||||||
|
|
Loading…
Reference in a new issue