0

I am using nixOS and I have a flake.nix. I use pre-commit to run ruff.

my pre-commit config:

-   repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.3.4
    hooks:
    -   id: ruff
        alias: autoformat
        args: [--fix]

Now when committing .py files I get this error:

[Errno 2] No such file or directory: '/home/{username}/.cache/pre-commit/repoo90awvpu/py_env-python3.11/bin/ruff'

But the file exists! I checked it. My ls command (with a full path) gives me:

.rwxr-xr-x 23M {username} 28 Mär 00:26 /home/{username}/.cache/pre-commit/repoo90awvpu/py_env-python3.11/bin/ruff

file outputs:

> file ruff
ruff: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=5703233b90c05154cbdd5c3f44975b02579aad23, for GNU/Linux 2.6.32, stripped

Does anyone know why I get the error, that my file does not exists, when it actually exists and is executable.

7
  • In what directory were you when you ran the ls command? Try the ls with the full pathname as given in the error message from the commit. Commented Mar 28 at 19:47
  • @Paul_Pedant see my edit please. I posted the output of ls with the full pathname. Commented Mar 28 at 20:13
  • Does {username} contain any unusual characters, or is any part of that path a symlink? Commented Mar 28 at 23:30
  • @JohnGordon No, my username is xunil. There is no symlink. Commented Mar 29 at 0:24
  • What is the output of file -L /lib64/ld-linux-x86-64.so.2? Commented Mar 29 at 5:47

0

You must log in to answer this question.

Browse other questions tagged .