forge: pass --work-path to admin CLI so app.ini is found

without --work-path, forgejo's admin CLI defaults WorkPath to the
binary's directory (RO nix store), can't find custom/conf/app.ini
there, falls back to defaults, and F3 init mkdir-fails inside the
store. systemd unit sets WORK_PATH for the daemon; mirror it here
for every nixos-container-driven 'forgejo admin' invocation.
This commit is contained in:
müde 2026-05-17 00:42:03 +02:00
parent fed943a04e
commit 2b076f8ce4

View file

@ -66,7 +66,26 @@ async fn forge_admin(args: &[&str]) -> Result<String> {
// `runuser` (util-linux, always present in a NixOS container) // `runuser` (util-linux, always present in a NixOS container)
// beats `sudo` here — sudo isn't installed unless `security.sudo` // beats `sudo` here — sudo isn't installed unless `security.sudo`
// is enabled, and we don't want to depend on that. // is enabled, and we don't want to depend on that.
cmd.args(["run", FORGE_CONTAINER, "--", "runuser", "-u", "forgejo", "--", "forgejo", "admin"]); //
// `--work-path` is mandatory: without it, the admin CLI defaults
// WorkPath to `dirname(executable)` (a RO nix-store path), then
// looks for `<WorkPath>/custom/conf/app.ini` which doesn't
// exist, falls back to defaults, and F3 init tries to mkdir
// under the nix store and fatals. The systemd unit sets
// WORK_PATH for the daemon; we mirror it here for the CLI.
cmd.args([
"run",
FORGE_CONTAINER,
"--",
"runuser",
"-u",
"forgejo",
"--",
"forgejo",
"--work-path",
"/var/lib/forgejo",
"admin",
]);
cmd.args(args); cmd.args(args);
let out = cmd let out = cmd
.output() .output()