Skip to content

Instantly share code, notes, and snippets.

@drupol
Created February 6, 2024 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drupol/f1d1f3bb6f0e1cbbcc24fca4f8b2a7ac to your computer and use it in GitHub Desktop.
Save drupol/f1d1f3bb6f0e1cbbcc24fca4f8b2a7ac to your computer and use it in GitHub Desktop.
Nix and rector
❯ nix build .#rector -L
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
source> trying https://github.com/rectorphp/rector/archive/0.19.6.tar.gz
source> % Total % Received % Xferd Average Speed Time Time Time Current
source> Dload Upload Total Spent Left Speed
source> 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
source> 100 1539k 0 1539k 0 0 817k 0 --:--:-- 0:00:01 --:--:-- 5846k
source> unpacking source archive /build/0.19.6.tar.gz
error: hash mismatch in fixed-output derivation '/nix/store/8badxh8mmwx34c6n08996bdbx5wpd9af-source.drv':
specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
got: sha256-Z2oCRbRZ/A7rqw5TJApGe/syXGCf/MwcsDQ0Mk2/Qac=
error: 1 dependencies of derivation '/nix/store/nknyzfc8hbnjp0gihvi64ilmgd5lmvzf-rector-0.19.6.drv' failed to build
❯ nix build .#rector -L
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
rector> Running phase: unpackPhase
rector> unpacking source archive /nix/store/lic3xqawqxqy2z9z2ka66vc4qcdkxs5v-source
rector> source root is source
rector> Running phase: patchPhase
rector> Running phase: updateAutotoolsGnuConfigScriptsPhase
rector> Running phase: configurePhase
rector> Executing composerRepositoryConfigureHook
rector> Loading composer repositories with package information
rector> Updating dependencies
rector> Lock file operations: 1 install, 0 updates, 0 removals
rector> - Locking phpstan/phpstan (1.10.57)
rector> Writing lock file
rector> 23 packages you are using are looking for funding.
rector> Use the `composer fund` command to find out more!
rector> No security vulnerability advisories found.
rector> ERROR: No composer.lock found
rector> No composer.lock file found, consider adding one to your repository to ensure reproducible builds.
rector> In the meantime, a composer.lock file has been generated for you in /nix/store/ipyfkp7xixfrnynic6ahfx5qgpwmvcg0-rector-0.19.6-composer-repository/composer.lock
rector> To fix the issue:
rector> 1. Copy the composer.lock file from /nix/store/ipyfkp7xixfrnynic6ahfx5qgpwmvcg0-rector-0.19.6-composer-repository/composer.lock to the project's source:
rector> cp /nix/store/ipyfkp7xixfrnynic6ahfx5qgpwmvcg0-rector-0.19.6-composer-repository/composer.lock <path>
rector> 2. Add the composerLock attribute, pointing to the copied composer.lock file:
rector> composerLock = ./composer.lock;
error: builder for '/nix/store/abkini5c25grdwvmfi38hyl55plza5bd-rector-0.19.6-composer-repository.drv' failed with exit code 1;
last 25 log lines:
> source root is source
> Running phase: patchPhase
> Running phase: updateAutotoolsGnuConfigScriptsPhase
> Running phase: configurePhase
> Executing composerRepositoryConfigureHook
> Loading composer repositories with package information
> Updating dependencies
> Lock file operations: 1 install, 0 updates, 0 removals
> - Locking phpstan/phpstan (1.10.57)
> Writing lock file
> 23 packages you are using are looking for funding.
> Use the `composer fund` command to find out more!
> No security vulnerability advisories found.
>
> ERROR: No composer.lock found
>
> No composer.lock file found, consider adding one to your repository to ensure reproducible builds.
> In the meantime, a composer.lock file has been generated for you in /nix/store/ipyfkp7xixfrnynic6ahfx5qgpwmvcg0-rector-0.19.6-composer-repository/composer.lock
>
> To fix the issue:
> 1. Copy the composer.lock file from /nix/store/ipyfkp7xixfrnynic6ahfx5qgpwmvcg0-rector-0.19.6-composer-repository/composer.lock to the project's source:
> cp /nix/store/ipyfkp7xixfrnynic6ahfx5qgpwmvcg0-rector-0.19.6-composer-repository/composer.lock <path>
> 2. Add the composerLock attribute, pointing to the copied composer.lock file:
> composerLock = ./composer.lock;
>
For full logs, run 'nix log /nix/store/abkini5c25grdwvmfi38hyl55plza5bd-rector-0.19.6-composer-repository.drv'.
error: 1 dependencies of derivation '/nix/store/yx662aaiyg96n8krhwc15dg368n5rjn1-rector-0.19.6.drv' failed to build
❯ cp /nix/store/ipyfkp7xixfrnynic6ahfx5qgpwmvcg0-rector-0.19.6-composer-repository/composer.lock pkgs/by-name/re/rector/
❯ git add .
❯ nix build .#rector -L
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
rector> Running phase: unpackPhase
rector> unpacking source archive /nix/store/lic3xqawqxqy2z9z2ka66vc4qcdkxs5v-source
rector> source root is source
rector> Running phase: patchPhase
rector> Running phase: updateAutotoolsGnuConfigScriptsPhase
rector> Running phase: configurePhase
rector> Executing composerRepositoryConfigureHook
rector> Finished composerRepositoryConfigureHook
rector> Running phase: buildPhase
rector> Executing composerRepositoryBuildHook
rector> - Downloading phpstan/phpstan (1.10.57)
rector> - Installing phpstan/phpstan (1.10.57): Extracting archive
rector> Local repository has been successfully created in /build/source/repository
rector> Finished composerRepositoryBuildHook
rector> Running phase: checkPhase
rector> Executing composerRepositoryCheckHook
rector> Fatal error: Cannot declare class RectorPrefix202402\Composer\InstalledVersions, because the name is already in use in /build/source/vendor/composer/InstalledVersions.php on line 25
rector> ERROR: composer files validation failed
rector> The validation of the composer.json and composer.lock failed.
rector> Make sure that the file composer.lock is consistent with composer.json.
error: builder for '/nix/store/nl6kmb7n7akr3bv53548s190gsp5jqv8-rector-0.19.6-composer-repository.drv' failed with exit code 1;
last 24 log lines:
> Running phase: unpackPhase
> unpacking source archive /nix/store/lic3xqawqxqy2z9z2ka66vc4qcdkxs5v-source
> source root is source
> Running phase: patchPhase
> Running phase: updateAutotoolsGnuConfigScriptsPhase
> Running phase: configurePhase
> Executing composerRepositoryConfigureHook
> Finished composerRepositoryConfigureHook
> Running phase: buildPhase
> Executing composerRepositoryBuildHook
> - Downloading phpstan/phpstan (1.10.57)
> - Installing phpstan/phpstan (1.10.57): Extracting archive
> Local repository has been successfully created in /build/source/repository
> Finished composerRepositoryBuildHook
> Running phase: checkPhase
> Executing composerRepositoryCheckHook
>
> Fatal error: Cannot declare class RectorPrefix202402\Composer\InstalledVersions, because the name is already in use in /build/source/vendor/composer/InstalledVersions.php on line 25
>
> ERROR: composer files validation failed
>
> The validation of the composer.json and composer.lock failed.
> Make sure that the file composer.lock is consistent with composer.json.
>
For full logs, run 'nix log /nix/store/nl6kmb7n7akr3bv53548s190gsp5jqv8-rector-0.19.6-composer-repository.drv'.
error: 1 dependencies of derivation '/nix/store/ndbvh4bqpp4lc19v0hdj5jiya7hlnqzq-rector-0.19.6.drv' failed to build
~/C/N/nixpkgs > php/rector/init [+] ✘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment