Repository navigation
Description
Describe the bug
I am using fetchFromGitHub with fetchSubmodules within a buildDunePackage call to pull all git modules for a build and was working well previously.
However, after updating my nixpkgs unstable channel from ad416d066ca1222956472ab7d0555a6946746a80 to 1925c603f17fc89f4c8f6bf6f631a802ad85d784, I have been running into an error relating to missing CA certificates when rebuilding the derivation after configuring an alternate nix store (store = xxx in ~/.config/nix/nix.conf) due to how caching works within my CI environment.
+nix-store-export-outpath-oidc-s3 *failed* | /nix/store/qng2izmydb5x2rf7as8cwlx442ax5fyd-ocaml5.2.0-semgrep-core-1.89.0.drv
+nix-store-export-outpath-oidc-s3 *failed* | building '/nix/store/mk81q6nzyzjhf7v9pvm2zcrx4q6wa73z-source.drv'...
+nix-store-export-outpath-oidc-s3 *failed* | error: builder for '/nix/store/mk81q6nzyzjhf7v9pvm2zcrx4q6wa73z-source.drv' failed with exit code 1;
+nix-store-export-outpath-oidc-s3 *failed* | last 7 log lines:
+nix-store-export-outpath-oidc-s3 *failed* | > exporting https://github.com/semgrep/semgrep.git (rev v1.89.0) into /nix/store/ibn8xawg0yjc8c49zg2xyf4630klgrv4-source
+nix-store-export-outpath-oidc-s3 *failed* | > Initialized empty Git repository in /nix/store/ibn8xawg0yjc8c49zg2xyf4630klgrv4-source/.git/
+nix-store-export-outpath-oidc-s3 *failed* | > fatal: unable to access 'https://github.com/semgrep/semgrep.git/': OpenSSL/3.0.14: error:16000069:STORE routines::unregistered scheme
+nix-store-export-outpath-oidc-s3 *failed* | > fatal: unable to access 'https://github.com/semgrep/semgrep.git/': OpenSSL/3.0.14: error:16000069:STORE routines::unregistered scheme
+nix-store-export-outpath-oidc-s3 *failed* | > fatal: unable to access 'https://github.com/semgrep/semgrep.git/': OpenSSL/3.0.14: error:16000069:STORE routines::unregistered scheme
+nix-store-export-outpath-oidc-s3 *failed* | > fatal: unable to access 'https://github.com/semgrep/semgrep.git/': OpenSSL/3.0.14: error:16000069:STORE routines::unregistered scheme
+nix-store-export-outpath-oidc-s3 *failed* | > Unable to checkout refs/tags/v1.89.0 from https://github.com/semgrep/semgrep.git.
+nix-store-export-outpath-oidc-s3 *failed* | For full logs, run 'nix log /nix/store/mk81q6nzyzjhf7v9pvm2zcrx4q6wa73z-source.drv'.
+nix-store-export-outpath-oidc-s3 *failed* | error: 1 dependencies of derivation '/nix/store/qng2izmydb5x2rf7as8cwlx442ax5fyd-ocaml5.2.0-semgrep-core-1.89.0.drv' failed to build
Steps To Reproduce
Steps to reproduce the behavior:
docker run -it --rm nixos/nix:2.23.3nix-env -iA nixpkgs.cacerts ...- Configure
store = /tmp/storein~/.config/nix/nix.conf - Build derivation that uses
fetchFromGitHubwithfetchSubmodules = true - Error
Expected behavior
Source should be fetchFromGitHub-ed without errors.
Additional context
I believe this bug was due to a change to fetchGit as part of #303307
Notify maintainers
@lukegb - not sure who to ping but you since you were the approver
Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 6.10.0-linuxkit`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.23.3`
- channels(root): `"nixpkgs, nixpkgs_24_05-24.05"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`Add a 👍 reaction to issues you find important.
Activity
dustyhorizon commentedon Sep 29, 2024
911aa1440f40405f13f9252e2eb8ffc12f269090is definitely the cause, pinning to the parent commitc455cc3170d68f05b4614c41883a7d417d1c16e0has no issues when building the derivation.Nevermind, seems like911aa1440f40405f13f9252e2eb8ffc12f269090is fine too, seems like I am grasping at straws right now.Retested with a clean cache again, and that seems to point that
911aa1440f40405f13f9252e2eb8ffc12f269090is the cause per the initial comment. I thought it was not working but turns out it was reusing the cached source left from a previous run.lukegb commentedon Sep 29, 2024
@timbertson I think we need to make the change suggested in #303307 (comment) to check whether the file actually exists and is readable before using it.
dustyhorizon commentedon Sep 29, 2024
After hours of attempting to override fetchgit and several amateur hour moments, I can confirm that
NIX_SSL_CERT_FILEset withinnixos/nix:2.23.3is the culprit.Specifically,
NIX_SSL_CERT_FILEgets inherited bynix build ...and because it still points to the original nix store within my chroot-ed store build, the file essentially does not exists (broken symlink) and the config gets propagated towards the various fetchers which breaksfetchgitin my case.A file existence check (in both symlinks and non symlinks conditions) should work but not too sure where is appropriate for this check.EDIT: Just saw @lukegb 's proposed fix, really appreciate it!
timbertson commentedon Sep 30, 2024
Thanks for the detailed report, I'll make a PR soon 👍
Edit Just saw yours @lukegb , thanks!
PedroHLC commentedon Nov 3, 2024
Getting the same result with
nixpkgs/cachix-flakes:latest, started around the time of this issue, and still affects it.