Artificial intelligent assistant

In Nix, how can I build a package that has a Python post-install script? I'm trying to make a Nix derivation for Foliate, and this is my first real derivation, so I don't really know what I'm doing yet. Here's what I have so far. It builds and installs, but fails with this error: Running custom install script '/build/source/build-aux/meson/postinstall.py' Failed to run install script '/build/source/build-aux/meson/postinstall.py' FAILED: meson-install /nix/store/2b4cdbcs1xbqjna5dr4qrr1p9p9bgm98-meson-0.51.2/bin/meson install --no-rebuild ninja: build stopped: subcommand failed. builder for '/nix/store/32vn9xlxlk9zb7vmpm90bz5i5qq59fjc-foliate-1.5.3.drv' failed with exit code 1 error: build of '/nix/store/32vn9xlxlk9zb7vmpm90bz5i5qq59fjc-foliate-1.5.3.drv' failed I tried adding `python3` as a build dependency, but that didn't seem to work. What am I missing? Also, is there any other way I can improve or simplify this derivation?

This error occurs because the shebang of the file points to something like `/usr/bin/env`, which is not available in the Nix sandbox.

We typically solve this by calling `patchShebangs` on the file in the `postPatch` section.

Sometimes the file is not executable so you might need to make it so; it is not a problem here though.


postPatch = ''
chmod +x build-aux/meson/postinstall.py # not necessary here
patchShebangs build-aux/meson/postinstall.py
'';


Also note that we already have an (incomplete) PR adding Foliate, you might want to take a look at that.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 46ded50077644d4ad5db037b32e7705f