cargoPublish :: AttrSet → Effect

Deploys package to, the Rust community’s crate repository.


effects.cargoPublish {
  secretName = "cargo-api-token";
  src = ./.;

Example secret:

  "cargo-api-token": {
    "kind": "Secret",
    "data": {
      "token": "..."
    "condition": {
      "and": [
        { "isOwner": "my-github-org" },
        { "isRepo": "my-site-repo" }



The secret that will be looked up in secrets.json.

The data field must contain a "token" field, with a string value that is a Cargo API token. To make one, navigate to API tokens and use New Token.


Extra arguments to pass to the cargo publish invocation.


Example: src = ./.;

Path to the source code of the package to publish.

src is unpacked by the Nixpkgs unpackPhase.


String containing the path to a Cargo.toml, default: Cargo.toml. Relative paths are relative to the unpacked src.

A store path subpath could be passed instead, bypassing unpackPhase.


Optional registry to publish to. Defaults to cargo’s default behavior, which is to publish to package.publish or

If you use an alternate registry or private registry, you are recommended to store this information in Cargo.toml.

Note that this must be the backing git repository URL, not a web or API URL.