zigmod.yml Reference
zigmod.yml is the main manifest that Zigmod will read to learn all about your application or package.
zig.mod is a valid legacy alternative.
id
- Type:
string - Required
idis a randomly generated string used to identify your package coming from multiple sources. Sources here meaning various git repositories, http archive downloads, etc.
name
- Type:
string - Required
This is the value that users of your package will
@importyou by.
main
- Type:
stringThe is the local path to the entry point of your package and the file that will be returned when users run@importon your package.
license
- Type:
stringThis is an optional field that may be set to specify the license that your package code is covered by. This field is read by thezigmod licensecommand to show the licenses used by all of a project’s dependencies. If the value oflicenseis set to a SPDX Identifier then a link to the license will also be printed for the user to learn more about it. Check the command reference for more info.
c_include_dirs
- Type:
[]stringThis is a list of relative paths to folders which are a root search path for.hfiles when compiling C code in a project.
c_source_flags
- Type:
[]stringThis is a list ofclangC source flags that will be passed to all of the C files listed under thec_source_filesfor this project.
c_source_files
- Type:
[]stringThis is a list of relative paths to C source files to compile along with this project. This will be required if you use Zig’s@cImport,extern, etc.
files
- Type:
[]stringThis accepts a list of local directories to embed static assets. These files will be provided through afiles.zigfiles in the module root. It generates a list of@embedFilecalls.
root_files
- Type:
[]stringThis accepts a list of local directories to embed static assets. These files will be provided through afiles.zigfiles in the package root. It generates a list of@embedFilecalls.
dependencies
- Type:
[]DepThis is a list ofDepobjects.Depobjects are how you include the other people’s code in your project. See theDepdocumentation below to learn more about the attributes available here.
root_dependencies
- Type:
[]DepSimilar todependenciesbut will only get added to the project if the currentzigmod.ymlis the root module.
build_dependencies
- Type:
[]DepSimilar todependenciesbut will only get added to the project if the currentzigmod.ymlis the root module. Exposed indeps.zigthrough thedeps.importsdecl.
min_zig_version
- Type:
stringParsed as astd.SemanticVersion, this attribute refers to the minimum compatible Zig version for this package/application and will causezig buildto panic if violated.
Dep Object
This is the object used in the top-level dependencies attribute and used to add external code to your project.
Dep src
- Type:
type path ?version - Example:
git https://github.com/Hejsil/zig-clap - Required
This is the base attribute used to reference external code for use in your project.
typeis an enum and only allows certain values.pathis the URL or other identifier used to locate the contents of this package based on thetype.
The available types are:
localsystem_libframeworkgithghttp
For the full details on Dep types, you can check out the source where the enum is defined: https://github.com/nektro/zigmod/blob/master/src/util/dep_type.zig.
Note: the
localtype modifies the input behavior to be shorthand for<name> <main>rather thanpath versionsince the latter fields don’t make sense for local files.
Dep version
- Type:
string-string - Example:
commit-2c21764 - Example:
sha256-8ff0b79fd9118af7a760f1f6a98cac3e69daed325c8f9f0a581ecb62f797fd64This attribute is used to reference thetype/pathcombo by a specific revision, specific to thetype. Specifying aversionis ideal when possible because it ensures the immutability of the package contents being referenced, and thus Zigmod can skip going to the network if the package is already located on disk.
Version types available to each Dep type:
system_lib- Not affected by
version.
- Not affected by
framework- Not affected by
version.
- Not affected by
gitcommittagbranch
hg- Not currently affected by
version.
- Not currently affected by
httpblake3sha256sha512
Dep only_os
- Type:
comma-split string[] - Example:
windows - Example:
macos,tvos,iosThis attribute specifies a way to filter when the dependency will be generated into the contents ofdeps.zig.only_osis an inclusive filter in which the dependency will only be in the output if the host target operating system is in the list specified or if this field is omitted.
Dep except_os
- Type:
comma-split string[] - Example:
linuxThis attribute specifies a way to filter when the dependency will be generated into the contents ofdeps.zig.except_osis an exclusive filter in which the dependency will only be in the output if the host target operating is *not* in the list specified or if the field is omitted.
Dep keep
- Type:
string - Example:
true|any This attribute is a manual override for having an external repo that contains no Zig or C code but other files be managed through Zigmod anddeps.zig.trueis the only value that will enable this flag.
Dep Overrides
There are a number of fields you can add to a Dep object that will override it’s top-level value. This is most useful in the case where a project you want to use does not have a zigmod.yml manifest. You can then use overrides to define the values for them. The only top-level value you can not override is dependencies.