NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.95k stars 13.97k forks source link

Documentation: buildComposerProject fails due to a missing plug-in #326835

Closed jtojnar closed 3 months ago

jtojnar commented 3 months ago

Problem

I am trying to migrate my local packages from composition-c4 to buildComposerPackage but package fails to build:

Running phase: unpackPhase
unpacking source archive /nix/store/s8g454a7mk5xyhmly27hp3jmc06v5zf7-source
calling 'unpackCmd' function hook '_defaultUnpack' /nix/store/s8g454a7mk5xyhmly27hp3jmc06v5zf7-source
source root is source
calling 'postUnpack' function hook '_updateSourceDateEpochFromSourceRoot'
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
calling 'preConfigure' function hook 'composerRepositoryConfigureHook'
Executing composerRepositoryConfigureHook
Finished composerRepositoryConfigureHook
calling 'preConfigure' function hook '_multioutConfig'
Running phase: buildPhase
calling 'preBuild' function hook 'composerRepositoryBuildHook'
Executing composerRepositoryBuildHook
Setting COMPOSER_ROOT_VERSION to 0-unstable-2022-05-28

  Command "build-local-repo-lock" is not defined.  

I based the code on the example from the manual:

```nix { fetchFromGitHub, php }: php.buildComposerProject { pname = "flarum-webhooks-telegram-bridge"; version = "unstable-2022-05-28"; src = fetchFromGitHub { owner = "ogioncz"; repo = "flarum-webhooks-telegram-bridge"; rev = "ad47c3d19c69a1f2f8c6fb01f1d9d149aee74a5c"; hash = "sha256-Wzf9sYujjksDwcQ1Ax/IBjw8wJeg0JBh5A1rCyvRIAs="; }; vendorHash = "sha256-0zf9sYujjksDwcQ1Ax/IBjw8wJeg0JBh5A1rCyvRIAs="; } ```

The example using the hooks in mkDerivation appears to be incomplete as well – it fails with:

       error: mkComposerRepository expects version argument.

Checklist

cc @drupol


Add a :+1: reaction to issues you find important.

drupol commented 3 months ago

Hi Jan,

Can you try to replace the version string unstable-2022-05-28 to something like 0.0.1 ?

jtojnar commented 3 months ago

Thanks, that does appear to get me further (I would not guess that from the error):

Running phase: unpackPhase
unpacking source archive /nix/store/s8g454a7mk5xyhmly27hp3jmc06v5zf7-source
calling 'unpackCmd' function hook '_defaultUnpack' /nix/store/s8g454a7mk5xyhmly27hp3jmc06v5zf7-source
source root is source
calling 'postUnpack' function hook '_updateSourceDateEpochFromSourceRoot'
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
calling 'preConfigure' function hook 'composerRepositoryConfigureHook'
Executing composerRepositoryConfigureHook
Finished composerRepositoryConfigureHook
calling 'preConfigure' function hook '_multioutConfig'
Running phase: buildPhase
calling 'preBuild' function hook 'composerRepositoryBuildHook'
Executing composerRepositoryBuildHook
Setting COMPOSER_ROOT_VERSION to 0.0.1
  - Downloading guzzlehttp/guzzle (7.4.3)
  - Installing guzzlehttp/guzzle (7.4.3): Extracting archive
  - Downloading guzzlehttp/promises (1.5.1)
  - Installing guzzlehttp/promises (1.5.1): Extracting archive
  - Downloading guzzlehttp/psr7 (2.2.1)
  - Installing guzzlehttp/psr7 (2.2.1): Extracting archive
  - Downloading longman/telegram-bot (0.77.1)
  - Installing longman/telegram-bot (0.77.1): Extracting archive
  - Downloading psr/http-client (1.0.1)
  - Installing psr/http-client (1.0.1): Extracting archive
  - Downloading psr/http-factory (1.0.1)
  - Installing psr/http-factory (1.0.1): Extracting archive
  - Downloading psr/http-message (1.0.1)
  - Installing psr/http-message (1.0.1): Extracting archive
  - Downloading psr/log (3.0.0)
  - Installing psr/log (3.0.0): Extracting archive
  - Downloading ralouphie/getallheaders (3.0.3)
  - Installing ralouphie/getallheaders (3.0.3): Extracting archive
  - Downloading symfony/deprecation-contracts (v3.0.1)
  - Installing symfony/deprecation-contracts (v3.0.1): Extracting archive
Local repository has been successfully created in /build/source/repository
Finished composerRepositoryBuildHook
Running phase: checkPhase
calling 'preCheck' function hook 'composerRepositoryCheckHook'
Executing composerRepositoryCheckHook
Setting COMPOSER_ROOT_VERSION to 0.0.1

ERROR: composer files validation failed

The validation of the composer.json failed.
Make sure that the file composer.json is valid.

To address the issue efficiently, follow one of these steps:
  1. File an issue in the project's issue tracker with detailed information, and apply any available remote patches as a temporary solution (with fetchpatch).
  2. If an immediate fix is needed or if reporting upstream isn't suitable, develop a temporary local patch.
jtojnar commented 3 months ago

composer diagnose said that composer.json but composer validate did not like the lack of description. After adding that, it appears to work.

drupol commented 3 months ago

Good news :-)

jtojnar commented 3 months ago

Okay, no more fire hazard on my server.

Probably not worth the effort of doing anything about the version number when the plug-in is going away. So I at least opened a PR fixing the mkComposerRepository example.

drupol commented 3 months ago

@jtojnar Are you OK if I close this issue now?