This continues where d8f7f6a5ce left off. Similarly
to that commit, this commit this also points `sourceRoot`s to `src.name` and similar
instead of keeping hardcoded names, and edits other derivation attrs do do the same,
where appropriate.
Also, similarly to d8f7f6a5ce some of expressions this
edits use `srcs` attribute with customly-named sources, so they have to be moved
into `let` blocks to keep evaluation efficient (the other, worse, way to do this
would to recurcively refer to `elemAt n finalAttrs.srcs` or, similarly, with `rec`).
Broke in 408ece7d3d because the
`disallowedRequisites` fails here since the QT variant apparently needs
to reference a few dev outputs[1].
I won't look into the details of that now, so the easiest way to unbreak
is to skip the check for the QT variant. It should be kept for non-QT
though to make sure that a change similar to the BUILDCONFIG thing isn't
missed again by us.
[1] https://github.com/NixOS/nixpkgs/pull/245361#issuecomment-1651389735
error: output '/nix/store/2y0czyy26gcsqhmcvd2mlqa35f0gcl4l-libreoffice-7.5.4.1' is not allowed to refer to the following paths:
/nix/store/0hmvklj0mbhrn8flwbcwivvkv45limhg-freetype-2.13.0-dev
/nix/store/0rnx7rc87hwkbrhsys7mgwq4jw6pz7ma-zlib-1.2.13-dev
[...]
In v7.5.x a change was introduced that writes the BUILDCONFIG into
`$out/lib/libreoffice/program/libsofficeapp.so` including the
`PKG_CONFIG_PATH` containing references to all `dev` outputs of library
dependencies:
$ strings $(nix-build -A libreoffice-fresh)/lib/libreoffice/program/libsofficeapp.so|grep PKG_CONFIG_PATH
[...], "BuildConfig": "[...] 'PKG_CONFIG_PATH=[...]'"
This isn't really needed because this information can also be obtained
by `nix derivation show`. Also, this causes a 20% larger runtime-closure
because of all the dev dependencies being referenced by the output and
thus downloaded whenever libreoffice is substituted somewhere. The
actual numbers look like this:
$ nix path-info -Sh ./result-old
/nix/store/3mzrqh4gg7v27vdrrap9dj3x8myysmyf-libreoffice-7.5.4.1-wrapped 2.0G
$ nix path-info -Sh ./result
/nix/store/g5y60s0a2q2v6r58xcayv62z7fjfi816-libreoffice-7.5.4.1-wrapped 1.6G
Only `libreoffice-fresh` is affected, `pkgs.libreoffice` isn't because
it still points to 7.4 whereas the problematic change was introduced in
7.5.
To make sure this doesn't get reintroduced by accident, the derivation
also prohibits now to reference any dev output from a build input.
[1] https://gerrit.libreoffice.org/c/core/+/141197