0

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?

1

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.

  • Thanks! I'd wondered how shebangs were handled. Also I gotta remember to look in the PRs first before starting something like this. – Jonathan Dec 6 '19 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.