Zig supports pulling packages from git with this syntax in a dependencies' .url field: git+https://git.mzte.de/mirrors/zig-args.git#89f18a104d9c13763b90e97d6b4ce133da8a3e2b.
zon2nix will naively prepend tarball+ here, resulting in a completely invalid URL for nix flake prefetch. We can fix this by detecting the git+ prefix and converting this to a valid URL for nix, which in my example would be: git+https://git.mzte.de/mirrors/zig-args.git?rev=89f18a104d9c13763b90e97d6b4ce133da8a3e2b.
In the generated deps.nix, we'd then also have to use fetchgit instead of fetchzip. The generated code would look like this in my example:
Zig supports pulling packages from git with this syntax in a dependencies'
.url
field:git+https://git.mzte.de/mirrors/zig-args.git#89f18a104d9c13763b90e97d6b4ce133da8a3e2b
.zon2nix
will naively prependtarball+
here, resulting in a completely invalid URL fornix flake prefetch
. We can fix this by detecting thegit+
prefix and converting this to a valid URL for nix, which in my example would be:git+https://git.mzte.de/mirrors/zig-args.git?rev=89f18a104d9c13763b90e97d6b4ce133da8a3e2b
.In the generated
deps.nix
, we'd then also have to usefetchgit
instead offetchzip
. The generated code would look like this in my example: