| 17 May 2023 |
Pol | (side question, how do you do to use pkgs from nix-repl ?) | 13:38:26 |
Pol | Redacted or Malformed Event | 13:38:46 |
Gaël Reyrol | from the root of nixpkgs, I launch nix repl | 13:38:53 |
Gaël Reyrol | then load it with :l . | 13:39:01 |
Gaël Reyrol | then I can access to entire nixpkgs tree | 13:39:24 |
Pol | Oh I was doing :lf . | 13:39:25 |
Pol | Thanks :) | 13:39:28 |
Gaël Reyrol | lf is for flakes ;) | 13:39:37 |
Gaël Reyrol | so I guess :l is just for the standard way | 13:40:06 |
Pol | indeed.. | 13:40:16 |
Pol | In the meantime, I have found this: https://github.com/composer/satis | 13:41:39 |
Pol | I will see if it can help us. | 13:41:49 |
Gaël Reyrol | hmm I knew that tool but it is an open source alternative to packagist.com | 13:43:08 |
Gaël Reyrol | How would you use it? | 13:43:29 |
Pol | It is doing what we want to do | 13:44:27 |
Pol | It builds a local packagist repo | 13:44:38 |
Pol | This is basically what the python script is doing | 13:44:53 |
Gaël Reyrol | true | 13:46:05 |
Pol | Redacted or Malformed Event | 14:07:14 |
Pol | Redacted or Malformed Event | 14:07:16 |
Jan Tojnar | In reply to @Zevran:matrix.org For now I edited the composer-setup-hook.sh but I get an error at the execution of the script nix-repl> :b pkgs.phpPackages.psalm error: builder for '/nix/store/953mghp1rkxh37m7rka61pfxglijq53f-composer-2.5.5-composer-cache.drv' failed with exit code 127; last 3 log lines: > /nix/store/qxn0wmvji49mawyyr0p7hq2gch965454-composer-create-repository-python: line 2: from: command not found > /nix/store/mciym69qni8j8rzdndkcqjgh8apk8sxw-stdenv-linux/setup: line 703: pop_var_context: head of shell_variables not a function context > /nix/store/mciym69qni8j8rzdndkcqjgh8apk8sxw-stdenv-linux/setup: line 710: pop_var_context: head of shell_variables not a function context For full logs, run 'nix log /nix/store/953mghp1rkxh37m7rka61pfxglijq53f-composer-2.5.5-composer-cache.drv'. I was thinking something like
diff --git a/pkgs/build-support/php/hooks/composer-setup-hook.sh b/pkgs/build-support/php/hooks/composer-setup-hook.sh
index f74ee293b7c..2e59d341e0d 100644
--- a/pkgs/build-support/php/hooks/composer-setup-hook.sh
+++ b/pkgs/build-support/php/hooks/composer-setup-hook.sh
@@ -62,7 +62,7 @@ composerSetupBuildHook() {
COMPOSER_CACHE_DIR=".composer" \
COMPOSER_HTACCESS_PROTECT=0 \
COMPOSER_ROOT_VERSION="${version}" \
- composer install ${argstr[@]}
+ @python@ @composerCreateRepo@ composer.lock "$out"
echo "Finished composerSetupBuildHook"
}
diff --git a/pkgs/build-support/php/hooks/default.nix b/pkgs/build-support/php/hooks/default.nix
index a3be5e80f61..5d1d4a55d81 100644
--- a/pkgs/build-support/php/hooks/default.nix
+++ b/pkgs/build-support/php/hooks/default.nix
@@ -8,6 +8,7 @@
, unzip
, xz
, git
+, python311
}:
{
@@ -15,6 +16,8 @@
name = "composer-setup-hook.sh";
propagatedBuildInputs = [ php unzip xz git jq ];
substitutions = {
+ python = python311;
+ composerCreateRepo = ./composer-create-repository.py;
};
} ./composer-setup-hook.sh;
| 14:13:19 |
Jan Tojnar | In reply to @Zevran:matrix.org For now I edited the composer-setup-hook.sh but I get an error at the execution of the script nix-repl> :b pkgs.phpPackages.psalm error: builder for '/nix/store/953mghp1rkxh37m7rka61pfxglijq53f-composer-2.5.5-composer-cache.drv' failed with exit code 127; last 3 log lines: > /nix/store/qxn0wmvji49mawyyr0p7hq2gch965454-composer-create-repository-python: line 2: from: command not found > /nix/store/mciym69qni8j8rzdndkcqjgh8apk8sxw-stdenv-linux/setup: line 703: pop_var_context: head of shell_variables not a function context > /nix/store/mciym69qni8j8rzdndkcqjgh8apk8sxw-stdenv-linux/setup: line 710: pop_var_context: head of shell_variables not a function context For full logs, run 'nix log /nix/store/953mghp1rkxh37m7rka61pfxglijq53f-composer-2.5.5-composer-cache.drv'. * I was thinking something like
diff --git a/pkgs/build-support/php/hooks/composer-setup-hook.sh b/pkgs/build-support/php/hooks/composer-setup-hook.sh
index f74ee293b7c..2e59d341e0d 100644
--- a/pkgs/build-support/php/hooks/composer-setup-hook.sh
+++ b/pkgs/build-support/php/hooks/composer-setup-hook.sh
@@ -62,7 +62,7 @@ composerSetupBuildHook() {
COMPOSER_CACHE_DIR=".composer" \
COMPOSER_HTACCESS_PROTECT=0 \
COMPOSER_ROOT_VERSION="${version}" \
- composer install ${argstr[@]}
+ @python@ @composerCreateRepo@ composer.lock "$out"
echo "Finished composerSetupBuildHook"
}
diff --git a/pkgs/build-support/php/hooks/default.nix b/pkgs/build-support/php/hooks/default.nix
index a3be5e80f61..5d1d4a55d81 100644
--- a/pkgs/build-support/php/hooks/default.nix
+++ b/pkgs/build-support/php/hooks/default.nix
@@ -8,6 +8,7 @@
, unzip
, xz
, git
+, python311
}:
{
@@ -15,6 +16,8 @@
name = "composer-setup-hook.sh";
propagatedBuildInputs = [ php unzip xz git jq ];
substitutions = {
+ python = python311.interpreter;
+ composerCreateRepo = ./composer-create-repository.py;
};
} ./composer-setup-hook.sh;
| 14:13:47 |
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 |