cachix/git-hooks.nix

Ansible-lint is broken when using nixpkgs 22.11

PierreR opened this issue · 1 comments

When using github:nixos/nixpkgs?rev=758f7e454abb3752eee99414a923223abd54e425 ( https://releases.nixos.org/nixos/23.11-small/nixos-23.11.2423.758f7e454abb), the current version of ansible-lint from pre-commit-hooks at the most recent commit (44493e2) will fail with

pre-commit run --all-files
ansible-lint.............................................................Failed
- hook id: ansible-lint
- exit code: 1

Traceback (most recent call last):
  File "/nix/store/mqqzdasbhl1kqrbaf8g4qhmdip69i0bx-ansible-lint-6.17.1/bin/.ansible-lint-wrapped", line 6, in <module>
    from ansiblelint.__main__ import _run_cli_entrypoint
  File "/nix/store/xys78w45g441glkza0ssz58i5dglw8n1-ansible-lint-6.21.1/lib/python3.11/site-packages/ansiblelint/__main__.py", line 39, in <module>
    from ansiblelint import cli
  File "/nix/store/xys78w45g441glkza0ssz58i5dglw8n1-ansible-lint-6.21.1/lib/python3.11/site-packages/ansiblelint/cli.py", line 28, in <module>
    from ansiblelint.schemas.main import validate_file_schema
  File "/nix/store/xys78w45g441glkza0ssz58i5dglw8n1-ansible-lint-6.21.1/lib/python3.11/site-packages/ansiblelint/schemas/main.py", line 10, in <module>
    import jsonschema
  File "/nix/store/s4b06081wams32ds2x13bnp66mli5n8c-python3.11-jsonschema-4.19.0/lib/python3.11/site-packages/jsonschema/__init__.py", line 13, in <module>
    from jsonschema._format import FormatChecker
  File "/nix/store/s4b06081wams32ds2x13bnp66mli5n8c-python3.11-jsonschema-4.19.0/lib/python3.11/site-packages/jsonschema/_format.py", line 11, in <module>
    from jsonschema.exceptions import FormatError
  File "/nix/store/s4b06081wams32ds2x13bnp66mli5n8c-python3.11-jsonschema-4.19.0/lib/python3.11/site-packages/jsonschema/exceptions.py", line 15, in <module>
    from referencing.exceptions import Unresolvable as _Unresolvable
  File "/nix/store/mygjryz0y0vkdcs3xf6rf94jv7jv0lkw-python3.11-referencing-0.30.2/lib/python3.11/site-packages/referencing/__init__.py", line 4, in <module>
    from referencing._core import Anchor, Registry, Resource, Specification
  File "/nix/store/mygjryz0y0vkdcs3xf6rf94jv7jv0lkw-python3.11-referencing-0.30.2/lib/python3.11/site-packages/referencing/_core.py", line 8, in <module>
    from rpds import HashTrieMap, HashTrieSet, List
  File "/nix/store/b6wnvy6y3z93rhwnywspqcykl93yi00q-python3.11-rpds-py-0.10.3/lib/python3.11/site-packages/rpds/__init__.py", line 1, in <module>
    from .rpds import *
ModuleNotFoundError: No module named 'rpds.rpds'

When using the version of ansible-lint that comes with 23.11.2423.758f7e454abb, everything works as expected (no error message).

It looks like the version of ansible-lint used by pre-commit-hook is not compatible with the latest branch 23.11 of nixpkgs ?

We've bumped the nixpkgs version. You can also now override the hooks package directly to work around issues like this in the future.