Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support git+ dependencies. #11

Open
LordMZTE opened this issue Feb 23, 2024 · 0 comments
Open

Support git+ dependencies. #11

LordMZTE opened this issue Feb 23, 2024 · 0 comments

Comments

@LordMZTE
Copy link

LordMZTE commented Feb 23, 2024

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:

{
  name = "12203ded54c85878eea7f12744066dcb4397177395ac49a7b2aa365bf6047b623829";
  path = fetchgit {
    url = "https://git.mzte.de/mirrors/zig-args.git";
    rev = "89f18a104d9c13763b90e97d6b4ce133da8a3e2b";
    hash = "sha256-JY0UDJSKOh1Cg46/GnhVTNmgr6TJKoHXgt8FponPCPM=";
  };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant