NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.35k stars 13.59k forks source link

forgejo: Static File Root Path: "@data@" Is REQUIRED but not accessible. #299802

Closed LunarLambda closed 5 months ago

LunarLambda commented 5 months ago

Describe the bug

forgejo fails to start up because the static file root path that is meant to point at the data output of the package was not correctly patched at build time

Steps To Reproduce

Steps to reproduce the behavior:

  1. install forgejo (I used nixpkgs-unstable)
  2. run /nix/var/nix/profiles/default/bin/gitea doctor check -c /etc/forgejo/app.ini (I was moving an existing install to the nix package to be up to date)
  3. Observe the following output:
    - [I] Static File Root Path:      "@data@"
    - [E]     Is REQUIRED but is not accessible. ERROR: stat @data@: no such file or directory
    - [E] Please check your configuration files and try again.

Expected behavior

Forgejo should find the required frontend files provided by the data output and start properly.

Additional context

I am aware that using nix and especially nixpkgs-unstable on a non-NixOS system comes with essentially no warranty whatsoever. However, given that the nix derivation is clearly intended to remove this @data@ placeholder (source) and that it failing to do so seems to be the only thing wrong with my installation, I do not believe there is an error on my part.

Notify maintainers

@emilylange @urandom @bendlas @adamcstephens

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 6.7.6-arch1-1, Arch Linux, noversion, rolling`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.21.1`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/root/.nix-defexpr/channels/nixpkgs
emilylange commented 5 months ago

Hi, thanks a lot for the report!

Turns out, there is a typo in https://github.com/NixOS/nixpkgs/blob/2726f127c15a4cc9810843b96cad73c7eb39e443/pkgs/applications/version-management/forgejo/default.nix#L66

It should be modules/setting/server.go not modules/setting/setting.go, just like the patch:

https://github.com/NixOS/nixpkgs/blob/2726f127c15a4cc9810843b96cad73c7eb39e443/pkgs/applications/version-management/gitea/static-root-path.patch#L1

This went unnoticed when using forgejo with the nixos module, because we explicitly set STATIC_ROOT_PATH in the app.ini to pkgs.forgejo.data by default^1.

Will open a PR with a fix shortly :)

LunarLambda commented 5 months ago

Thank you very much! I didn't notice the typo, glad I was able to provide enough information anyhow ^^

bjornfor commented 5 months ago

I heard substituteInPlace has a new --replace-fail option(?). Using that should prevent silent failures like this.

emilylange commented 5 months ago

There is #299811 now.

I heard substituteInPlace has a new --replace-fail option(?). Using that should prevent silent failures like this.

From what I can tell, --replace-fail does not apply to --subst-var. But feel free to check and write a review in #299811 :)