For the issue in the first approach (SSL errors), it looks fixed by adding this in the docker configuration:
config = {
User = "foo";
WorkingDir = "/app";
Env = ["SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"];
};
After adding this, and creating the /tmp
directory during the image setup, running nix develop
worked inside the docker container. Also there were no errors when cloning the git repository. So with that I can reuse the same flake setup packages inside the container.
However, for the node-gyp
issue, I haven’t been able to fix it yet. I will comment if I find a solution. It looks like it is possible to install with npm install --ignore-scripts
, but that skips building some required modules. Running the JS file directly with ./node_modules/.bin/gatsby
doesn’t work due to the shebang inside that file: #!/usr/bin/env node
, since usr/bin/env
doesn’t exist inside the container (but it exists in the host NixOS). If I run node ./node_modules/.bin/gatsby
, it has some other issues (it is missing a module that is built during installation).