Zigmod v70 Release

Zigmod is my package manager for Zig and I just released a big new version!

  • This is a milestone not only because there’s another 0 in the number but there’s a whole bunch of cool stuff

  • CLI utilities imported to https://aquila.red/ can now be installed to your computer with a single command

  • Run zigmod aq install 1/nektro/discord-archiver to give it a try!

  • zigmod license now prints the full urls of the repositories so that they’re clickable in your terminal

  • I wrote a tutorial that goes over a bunch of different use cases from getting started to advanced usage: https://github.com/nektro/zigmod/blob/master/docs/tutorial.md

  • as always any bugs or requests feel free to ping me or make an issue on Github

Get it here GitHub - nektro/zigmod: 📦 A package manager for the Zig programming language.

7 Likes

Hi @nektro , I need some help using Zigmod with a library project. In my library project Zigstr I depend on my other library Ziglyph. I followed the steps in the tutorial going through zigmod init, adding the Git dependency manually to the zig.mod file, running zigmod fetch, and then adding the required lines to build.zig (the tutorial shows the case of an exe, but I assume it’s the same for a lib? , I changed deps.addAllTo(exe) to deps.addAllTo(lib) ) But when i try @import("ziglyph"); I get

./src/Zigstr.zig:6:17: error: unable to find 'ziglyph'
const Ziglyph = @import("ziglyph");
                ^

ziglyph is the name field value from the Ziglyph library’s zig.mod file. I appreciate any help!

One tricky thing about Zigmod dependencies in the beginning is the differentiation between dependencies and dev_dependencies. Zigmod takes advantage of Zig’s powerful static analysis and thus both of those fields are used in very distinct places. I go over this in the zig.mod reference but didnt move it over to the tutorial.

The exe/lib does not apply to the same exe/lib that Zig init-* does. Zig’s applies to if you are making an executable or a static library (.so, etc). Zigmod’s applies to if you are making an application or a package for others. The other key thing to note is that name and main only apply if you are making a consumable package for others.

  • Deps listed in dev_dependencies will be added as packages to @import("root").
  • Deps listed in dependencies will be added as packages to @import(name).
  • and @import(name) will become available to root.

Hope this helps! If you have any more questions and post your zig.mod i’d be happy to assist further :smiley:

1 Like

Awesome! Putting the dependency under dev_dependencies made it work flawlessly! Thanks @nektro .

1 Like

Upon review, this was happening because you were importing the file instead of the package here zigstr/main.zig at main · jecolon/zigstr · GitHub. Changing the import from Zigstr.zig to zigstr should make the dev_dependecies listing on ziglyph unnecessary.

1 Like

Correct. I made the change and it works. Thanks for the help!

1 Like