!jngDrdMgndWibPCYsR:nixos.org

Nix PHP

77 Members
A room for PHP developers running on Nix22 Servers

Load older messages


SenderMessageTime
20 May 2023
@drupol:matrix.orgPol
In reply to @jtojnar:matrix.org
I only worry about project that need dev dependencies during build time
yeah... maybe we will discover issue once I will update all the vendorHash in the PR.
16:41:19
@jtojnar:matrix.orgJan Tojnar I would put it into the configure part along with composer update --lock --no-install --no-ansi 16:41:51
@drupol:matrix.orgPol I mean, should we add it in the script building the repo or in the script running composer install ? 16:42:38
@jtojnar:matrix.orgJan Tojnar I mean the division between setup-hook.sh and fetch-deps.nix I used for composition-c4 is still the ideal design IMO 16:43:24
@drupol:matrix.orgPolyeah I noticed, I like it very much16:43:39
@drupol:matrix.orgPol Would you be ok to contribute in drupol/composer-local-repo-plugin and to improve it if you feel like it needs to be improved ? 16:44:20
@drupol:matrix.orgPolI'm going to close the laptop, got friends over today, but I'm happy of this thing ! We can move forward a little bit :)16:45:18
@drupol:matrix.orgPolSee you later!16:45:26
@jtojnar:matrix.orgJan Tojnarnot sure when I will be able to get around it, still have two other projects I wanted to do this week 😸16:45:54
@jtojnar:matrix.orgJan Tojnarenjoy16:46:08
@drupol:matrix.orgPolI mean, feel free to modify it at anytime :)16:54:10
@drupol:matrix.orgPolI think it needs improvements16:54:24
@drupol:matrix.orgPolFor example, 16:54:30
@drupol:matrix.orgPol We should make sure that keys are sorted alphabetically in the produced packages.json 16:54:45
@drupol:matrix.orgPolSo we don't have surprise at some point.16:54:59
@drupol:matrix.orgPol Changing the structure of that single packages.json file and we are good to re-compute all the derivation hashes 16:55:20
@drupol:matrix.orgPolSo we need to fix the structure of that file16:55:27
@drupol:matrix.orgPolAnd avoid modifying it once it's done.16:55:34
@drupol:matrix.orgPolThen we tag that plugin and we're good to go.16:55:43
@drupol:matrix.orgPolWe should also think about where to put that project16:56:47
21 May 2023
@drupol:matrix.orgPol

I've updated the composer plugin with new commands options:

            ->addOption('only-repo', 'r', InputOption::VALUE_NONE, 'Generate only the repository, without the manifest file "packages.json".')
            ->addOption('only-manifest', 'm', InputOption::VALUE_NONE, 'Generate only the manifest "packages.json", without the repository.')
            ->addOption('only-print-manifest', 'p', InputOption::VALUE_NONE, 'Print the manifest for a given arbitrary repository directory.');
10:11:52
@drupol:matrix.orgPol I made those options to reduce the amount of file manipulation in pkgs/build-support/php/hooks/composer-install-hook.sh 10:12:30
@drupol:matrix.orgPol

The package installation procedure is now reduced to:

    # Remove "packages-dev" entries
    jq '."packages-dev" = []' composer.lock > newComposer.lock
    mv newComposer.lock composer.lock
    # Remove "require-dev" dependencies
    jq '."require-dev" = {}' composer.json > newComposer.json
    mv newComposer.json composer.json

    mkdir -p .repo

    # Create the manifest for the local repository
    COMPOSER_PROCESS_TIMEOUT=0 \
    COMPOSER_CACHE_DIR=/dev/null \
    COMPOSER_HOME="${composerVendorCache}/.composer" \
    composer --no-ansi build-local-repo -p $composerVendorCache > .repo/packages.json

    # Configure composer to use the local repository
    composer config repo.packagist false
    composer config repo.composer '{"type": "composer", "url": "file://'"$PWD"'/.repo/packages.json"}'

    # Merge the composer overrides to avoid randomly generated class names
    jq '. * input' "composer.json" "${composerOverrides}/composer.override.json" > newComposer.json
    mv newComposer.json composer.json

    echo "Finished composerInstallConfigureHook"
10:13:09
@drupol:matrix.orgPolI also updated the plugin to output json in alphabetical order10:13:39
22 May 2023
@drupol:matrix.orgPolToday I will most probably write a summary of all the things we tried to get this thing working. 06:58:52
@drupol:matrix.orgPolI've been testing that thing the whole weekend, and I improved it here and there as you can see in the PR.06:59:19
@drupol:matrix.orgPolThere is only ONE single issue with that method.06:59:31
@drupol:matrix.orgPol If by any change you have post-update-cmd in composer.json like in Drupal: https://github.com/drupal/drupal/blob/11.x/composer.json#L111
This is going to fail.
07:00:30
@drupol:matrix.orgPol Why? Because as far as I can see, the update command is expected to be run AFTER the install command and the autoloader needs to be loaded so the update command can run the command properly. 07:01:14
@drupol:matrix.orgPol But in our case, we are running the update command BEFORE the install command: https://github.com/NixOS/nixpkgs/blob/58fed5f92032c4e51286d08a76d9d2bab5443ecb/pkgs/build-support/php/hooks/composer-install-hook.sh#L52 07:02:18

Show newer messages


Back to Room ListRoom Version: 6