!jngDrdMgndWibPCYsR:nixos.org

Nix PHP

73 Members
A room for PHP developers running on Nix21 Servers

Load older messages


SenderMessageTime
5 May 2024
@drupol:matrix.orgPolI made further improvements12:09:47
@drupol:matrix.orgPolDefinitely much better than before, and also faster.12:09:59
@drupol:matrix.orgPol Jan Tojnar: I implemented the changes you suggested from https://github.com/NixOS/nixpkgs/pull/308608 in https://github.com/NixOS/nixpkgs/pull/308059
In the last commit, I'm trying to make the upgrade of psysh, but I end up in a infinite recursion.
I've been spending the last hour trying to figure out workarounds, but I'm running out of ideas, do you think you could have a look?
12:23:11
@drupol:matrix.orgPol

The overriding part is:

  composerRepository = finalAttrs.composerRepository.overrideAttrs (oldAttrs: {
    preBuild = ''
      setComposeRootVersion
      composer config platform.php 7.4
      composer require --no-update symfony/polyfill-iconv symfony/polyfill-mbstring
      composer require --no-update --dev roave/security-advisories:dev-latest
    '';
  });
14:38:07
@drupol:matrix.orgPolWhen I remove it, I don't have the infinite recursion. something must be wrong somewhere, I can't figure it out.14:38:33
@jtojnar:matrix.orgJan Tojnar Pol: right, you finalAttrs.composerRepository in physh ends up pointing to the composerRepository attribute in buildComposerProjectOverride, and the previousAttrs.composerRepository in that points to the composerRepository in physh 14:52:20
@jtojnar:matrix.orgJan Tojnar * Pol: right, the finalAttrs.composerRepository in physh ends up pointing to the composerRepository attribute in buildComposerProjectOverride, and the previousAttrs.composerRepository in that points to the composerRepository in physh 14:52:30
@drupol:matrix.orgPolLet me re-read that slowly.14:52:43
@drupol:matrix.orgPolOK got it.14:53:04
@drupol:matrix.orgPolWhat should we do to fix that?14:53:13
@drupol:matrix.orgPolThis is the part where I'm totally insecure in the PHP Composer Builder14:55:27
@jtojnar:matrix.orgJan Tojnar I guess the cleanest solution would be just using composerRepository = mkComposerRepositoryNext { … }; when more advanced usage is needed 15:01:06
@drupol:matrix.orgPolArgh15:02:03
@drupol:matrix.orgPol
In reply to @drupol:matrix.org

The overriding part is:

  composerRepository = finalAttrs.composerRepository.overrideAttrs (oldAttrs: {
    preBuild = ''
      setComposeRootVersion
      composer config platform.php 7.4
      composer require --no-update symfony/polyfill-iconv symfony/polyfill-mbstring
      composer require --no-update --dev roave/security-advisories:dev-latest
    '';
  });
There's no way to override it cleanly like that?
15:02:31
@jtojnar:matrix.orgJan Tojnar You could do (php.buildComposerProjectNext (finalAttrs: {})).overrideAttrs (_finalAttrs: prevAttrs: {composerRepository = prevAttrs.composerRepository.overrideAttrs (oldAttrs: { }); } but that is ugly too 15:04:33
@drupol:matrix.orgPolOh boy yeah... 15:05:02
@jtojnar:matrix.orgJan Tojnar the issue is that the attribute set passed to buildComposerProjectNext is level 0, and overrides can only refer to either level n - 1 or the final level 15:05:54
@jtojnar:matrix.orgJan Tojnar * the issue is that the attribute set passed to buildComposerProjectNext is level 0, and overrides can only refer to either level n - 1 or the final level 15:06:04
@jtojnar:matrix.orgJan Tojnarand final level will not work since that would be a cycle15:06:17
@drupol:matrix.orgPolCan we do some nice things in the new version of the PHP Composer Builder ? I would like to sort those things.15:06:56
@jtojnar:matrix.orgJan Tojnar you could maybe add extra composerRepositoryArgs argument that could be passed in level 0 but there are issues with that as well 15:08:10
@drupol:matrix.orgPolIndeed, I've been thinking about that... but yeah it's ugly :(15:08:29
@drupol:matrix.orgPolI will check other builders how they do15:10:06
@jtojnar:matrix.orgJan Tojnar
  • it would be confusing if you added that and e.g. composerNoDev – which should take precedence, especially with multiple levels of overrides
  • you would have to filter it out of arguments passed to mkDerivation since attribute sets are not allowed, but then it would disappear from the fix point (maybe it would work in passthru, not sure)
15:10:09
@jtojnar:matrix.orgJan Tojnar other builders did not really bother to support or predated the finalAttrs pattern, buildComposerProject is unique here 15:11:24
@drupol:matrix.orgPolYeah I noticed :S15:11:39
@drupol:matrix.orgPolhence, the added complexity to override some stuff15:11:49
@jtojnar:matrix.orgJan Tojnar well, there is no shame in leaving advanced use cases to explicit mkComposerRepository 15:13:11
@drupol:matrix.orgPolI will see the things to do to override the preBuild step.15:13:56
@jtojnar:matrix.orgJan Tojnar btw, might be a good idea to clone the old infrastructure first and then apply the changes in a new commit so the differences are easier to review. Also maybe use 2 suffix instead of Next so that further evolution has space to grow into 15:14:56

Show newer messages


Back to Room ListRoom Version: 6