| 17 May 2023 |
Jan Tojnar | since there are no third party dependencies | 14:14:56 |
Gaël Reyrol | Oh I see, I like that fact that I can use it as an extra package, to run it and maybe test it independently | 14:17:38 |
Jan Tojnar | yeah, separate derivation is definitely nicer, ideally it would also have passthru.tests with mypy & black | 14:20:56 |
Gaël Reyrol | Well I am still stuck on the error with the hook executing the script from bash instead of python ... | 14:33:32 |
Gaël Reyrol | https://github.com/gaelreyrol/nixpkgs/commit/d80b5eccf7191768fa18c2e917d3fba984f1aab1 | 14:33:33 |
Jan Tojnar | In reply to @Zevran:matrix.org https://github.com/gaelreyrol/nixpkgs/commit/d80b5eccf7191768fa18c2e917d3fba984f1aab1 well, you are using writeScript without a shebang | 14:50:59 |
Jan Tojnar | you need writeShellScript | 14:51:08 |
Gaël Reyrol | Mhhh I am using composerCreateRepositoryPythonScript not composerCreatreRepositoryScript | 14:56:28 |
Jan Tojnar | Gaël Reyrol: also you need to put the script into /bin/ otherwise stdenv will think it is a setup hook and try to run it or something | 14:56:33 |
Jan Tojnar | but it is probably better to use substitutions rather than propagation anyway | 14:57:59 |
Jan Tojnar | since propagation will pollute the closure of dependents | 14:58:21 |
Jan Tojnar | Something like this:
diff --git a/pkgs/build-support/php/hooks/composer-setup-hook.sh b/pkgs/build-support/php/hooks/composer-setup-hook.sh
index 90e51c3659a..1bbc0991f3f 100644
--- a/pkgs/build-support/php/hooks/composer-setup-hook.sh
+++ b/pkgs/build-support/php/hooks/composer-setup-hook.sh
@@ -44,6 +44,8 @@ composerSetupConfigureHook() {
composerSetupBuildHook() {
echo "Executing composerSetupBuildHook"
+ PATH_original="$PATH"
+ export PATH="@path@"
# argstr=("--no-interaction" "--download-only")
@@ -73,6 +75,7 @@ composerSetupBuildHook() {
composer-create-repository-python ${argstr[@]}
echo "Finished composerSetupBuildHook"
+ export PATH="$PATH_original"
}
composerSetupInstallHook() {
diff --git a/pkgs/build-support/php/hooks/default.nix b/pkgs/build-support/php/hooks/default.nix
index 5f51c77b75a..02fa8ca3421 100644
--- a/pkgs/build-support/php/hooks/default.nix
+++ b/pkgs/build-support/php/hooks/default.nix
@@ -12,7 +12,7 @@
let
# Can be call with composer-create-repository-python [-h] [--include-dev] lockfile_path output_path
- composerCreateRepositoryPythonScript = writers.makePythonWriter python311 python3Packages buildPackages.python3Packages "composer-create-repository-python" {
+ composerCreateRepositoryPythonScript = writers.makePythonWriter python311 python3Packages buildPackages.python3Packages "/bin/composer-create-repository-python" {
flakeIgnore = ["E501"];
} ./composer-create-repository.py;
@@ -24,7 +24,16 @@ in
{
composerSetupHook = makeSetupHook {
name = "composer-setup-hook.sh";
- propagatedBuildInputs = [ php unzip xz git jq composerCreateRepositoryPythonScript ];
+ substitutions = {
+ path = lib.makeBinPath [
+ php
+ unzip
+ xz
+ git
+ jq
+ composerCreateRepositoryPythonScript
+ ];
+ }
} ./composer-setup-hook.sh;
composerInstallHook = makeSetupHook {
| 15:05:14 |
Gaël Reyrol | Like this? https://github.com/gaelreyrol/nixpkgs/commit/350cb0132980494f4bc174db4f0e6f3f5bdc23f3 | 15:22:51 |
Gaël Reyrol | It seems to work but then I get an SSL error while the script execute git fetch origin $rev : atal: unable to access 'https://github.com/composer/ca-bundle.git/': OpenSSL/3.0.8: error:16000069:STORE routines::unregistered scheme | 15:25:09 |
Gaël Reyrol | I think I need pkgs.cacert 😅 | 15:28:23 |
Gaël Reyrol | Yep :P | 15:29:56 |
Pol | Allright | 15:30:02 |
Pol | I stand here: https://github.com/NixOS/nixpkgs/pull/232450 | 15:30:08 |
Pol | I'm looking for a bit of help | 15:30:14 |
Pol | The composer plugin is hooked in, | 15:30:19 |
Pol | I just can't use it's output for some unknown Nix reasons | 15:30:30 |
Pol | When I try to do ls -la ${composerVendorCache}, it breaks | 15:30:49 |
Pol | Can you please have a quick look, I've been working on this the whole afternoon, my head is in the fog now. | 15:31:11 |
Gaël Reyrol | Have you tried to not directly run composer build-local-repo in $out/repo but another and then copy it ? | 15:34:25 |
Pol | No. But if I do that, the path to the repository in package.json will not be valid anymore. | 15:35:12 |
Pol | * No. But if I do that, the paths to the repositories in package.json will not be valid anymore. | 15:35:30 |
Pol | I'm kinda stick | 15:35:50 |
Pol | * I'm kinda stuck | 15:35:53 |
Gaël Reyrol | I see :/ | 15:39:20 |
Pol | Maybe the solution will come along after a quick nap... Or maybe if Jan has an idea 💡! | 15:40:05 |