Running make from nix-shell throws permission denied error

Dear community,

I’m trying to compile a pico-sdk project in my NixOS machine. I got as far as compiling with cmake but when I run make I get the following error:

/bin/sh: line 1: pioasm-install/pioasm/pioasm: Permission denied
make[2]: *** [CMakeFiles/pifosti_ws2812_pio_h.dir/build.make:73: /home/me/work/pifosti/piFosti2350/pifosti/generated/ws2812.pio.h] Error 126
make[1]: *** [CMakeFiles/Makefile2:1836: CMakeFiles/pifosti_ws2812_pio_h.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I checked the permissions and they look correct:

$ ls -l pioasm-install/pioasm/pioasm
-rwxr-xr-x 1 me users 368944 de jul.  12 12:04 pioasm-install/pioasm/pioasm

I little research revealed this might have to do with trying to perform operations that require writing to the store, which is immutable. I’ve read that, to work around this, I can try copying the necessary files to a writable directory and then performing the operations there. But they already are in a writable subdirectory inside the build directroy form which I am runing make.

I’m stuck and I don’t have a clue on how to proceed. Any ideas?

My nix-shell script looks like this:

{ pkgs ? import <nixpkgs> {} }:

with pkgs;

mkShell {
  buildInputs = [
    pkgs.python3Full
    pkgs.pico-sdk
    pkgs.gcc-arm-embedded
    pkgs.figlet
  ];
  shellHook = ''
    export PICO_SDK_PATH="${pkgs.pico-sdk}/lib/pico-sdk"
    figlet "pifosti"
  '';
}

This might be related to this (unsolved) thread:

I guess this pioasm-install/pioasm/pioasm file is a script with a wrong shebang.
Can you check the file type (file pioasm-install/pioasm/pioasm), and if that is text, look at the first lines (head pioasm-install/pioasm/pioasm) ?

I managed to get passed the Permissions denied error by compiling when running the nix-shell with mkDerivation. But now I get an error that it doesn’t find the errors.h files, which I’ve checked they do exist. I’m trying to figure that out.