Can't use cmdstan because of a read only file system

Hi everyone,

Hope this is appropriate here, please correct me if not.
I installed cmdstan (a cli to mc-stan) and I wanted to compile a model in the examples dir, which is included in the distribution. I copied the dir from the nix store to my home dir, changed the permissions, installed gcc and then finally did stan bernoulli/bernoulli which results in an error:

In file included from <command-line>:
/nix/store/c9l946swbx2v67mwamd3vrypha4l9nz0-glibc-2.30-dev/include/stdc-predef.h:1: fatal error: can’t create precompiled header stan/src/stan/model/model_header.hpp.gch: Read-only file system
    1 | /* Copyright (C) 1991-2019 Free Software Foundation, Inc.
      |
compilation terminated.
make: *** [make/models:10: stan/src/stan/model/model_header.hpp.gch] Error 1
make: Leaving directory '/nix/store/v7qjafrwrsvb3ljqh42n78rq39gn79hp-cmdstan-2.17.1/opt/cmdstan'

stan is just an alias to make -C <cmdstan-nix-store-path> so I am not surprised it’s not working. I tried also downloading the program from the dev site but it’s using /bin/bash so it’s not working either. Does anyone have an idea how can I make it work?