I run this command to build the package: nix-build -E "with import <nixpkgs> {}; callPackage ./default.nix {}"
but when creating local composer repo, wierd OpenSSL error appears when trying to download php package from https://git.friendi.ca (uses Let’s Encrypt certificate) (downloading packages from github.com works fine):
error: builder for '/nix/store/v6wmqmalc59px0q52lsyi836sds4iy61-friendica-2023.05-composer-repository.drv' failed with exit code 1;
last 10 log lines:
> - Downloading ezyang/htmlpurifier (v4.16.0)
> - Installing ezyang/htmlpurifier (v4.16.0): Extracting archive
> - Downloading fgrosse/phpasn1 (v2.5.0)
> - Installing fgrosse/phpasn1 (v2.5.0): Extracting archive
> - Installing friendica/json-ld (1.1.2): Cloning 5f6ea87b26
> Could not build repository: Failed to execute git clone --no-checkout -- 'https://git.friendi.ca/friendica/php-json-ld' '/build/source/repository/friendica/json-ld/1.1.2' && cd '/build/source/repository/friendica/json-ld/1.1.2' && git remote add composer -- 'https://git.friendi.ca/friendica/php-json-ld' && git fetch composer && git remote set-url origin -- 'https://git.friendi.ca/friendica/php-json-ld' && git remote set-url composer -- 'https://git.friendi.ca/friendica/php-json-ld'
>
> Cloning into '/build/source/repository/friendica/json-ld/1.1.2'...
> fatal: unable to access 'https://git.friendi.ca/friendica/php-json-ld/': OpenSSL/3.0.10: error:16000069:STORE routines::unregistered scheme
>
For full logs, run 'nix log /nix/store/v6wmqmalc59px0q52lsyi836sds4iy61-friendica-2023.05-composer-repository.drv'.
error: 1 dependencies of derivation '/nix/store/s1g5vad6mch5x2r563jj5acx9nw89yg7-friendica-2023.05.drv' failed to build
Yes, with this PR the package friendica/json-ld is downloaded fine.
The build ends with this unrelated error:
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/r6l193ghwd6kqg9m2d1ahzvx95bm1bxq-friendica-2023.05-composer-repository
checking for references to /build/ in /nix/store/r6l193ghwd6kqg9m2d1ahzvx95bm1bxq-friendica-2023.05-composer-repository...
error: illegal path references in fixed-output derivation '/nix/store/s812idab1bivvavn6qgxpqh78xs38cgg-friendica-2023.05-composer-repository.drv'
Using master branch of nixpkgs (the PR is merged now) I still have this error:
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/r6l193ghwd6kqg9m2d1ahzvx95bm1bxq-friendica-2023.05-composer-repository
checking for references to /build/ in /nix/store/r6l193ghwd6kqg9m2d1ahzvx95bm1bxq-friendica-2023.05-composer-repository...
error: illegal path references in fixed-output derivation '/nix/store/qb5xc7gyfxgs2qhc4zb4mh6xnlifrwaz-friendica-2023.05-composer-repos
itory.drv'
error: 1 dependencies of derivation '/nix/store/p77hrc734s4fmd49zkyc5zhwazjsiwbn-friendica-2023.05.drv' failed to build
Could you please post the derivation so I can try to reproduce the issue locally?
Also, what you can do is to build the derivation with something like:
nix build .#friendica --keep-failed
And then, inspect the output at /tmp/nix-build-friendica-.../.
To be honest, I don’t know yet what we’re looking for… but it’s already a start.
Which is actually my case, $out/repository/friendica/json-ld/1.1.4/.git/hook directory contains *.sample files, that contains /nix/store/.. shebangs. (Don’t know why)
How to deal with that? I don’t know how to override installPhase or fixupPhase of composer-repository derivation.
I gave up on using the existing composer infrastructure because it seems like composer-local-repo-plugin needs Composer 2, but Friendica still uses Composer 1. (You can see more of the gotchas in my code comments). Just writing my own fixed-output derivation directly seemed to work fine.