jdx/mise · error
cannot export version pin
Error message
cannot export version pin '{spec}' = '{version}': pin nixpkgs in the importing NixOS configuration instead What it means
The Nix export renders packages as bare `pkgs.<attribute>` entries in a NixOS module; attribute entries carry no version, so a pinned version cannot be represented. mise throws this when a `nix:` bootstrap package has a version other than `latest`, telling you to pin nixpkgs in the importing NixOS configuration instead.
Solutions
- Change the package entry in `[bootstrap.packages]` to version `latest` before exporting.
- Pin the nixpkgs revision (e.g. via `nixpkgs.url` / an overlay) in the importing NixOS configuration to control versions there.
- Keep the version-pinned package managed by mise/Nix outside of the exported module rather than via bootstrap packages.
Example fix
# before (mise.toml) [bootstrap.packages] "nix:hello" = "1.2" # after [bootstrap.packages] "nix:hello" = "latest"
Defensive patterns
Strategy: validation
Validate before calling
// Only 'latest' versions can be exported for nix packages
const pinned = Object.entries(packages)
.filter(([k, v]) => k.startsWith("nix:") && v !== "latest");
if (pinned.length) throw new Error(`unpin these before export: ${pinned.map(([k]) => k).join(", ")}`); Type guard
const isExportableNixEntry = ([spec, version]) =>
spec.startsWith("nix:") && version === "latest"; Prevention
- Keep nix bootstrap packages at version "latest" in mise.toml.
- Pin versions at the nixpkgs level (nixpkgs input revision) instead of per-package pins.
- Run export with a dry review of [bootstrap.packages] versions first.
When it happens
Trigger: Running `mise bootstrap packages export --format nix` while `[bootstrap.packages]` contains an entry like `"nix:hello" = "1.2"` (any non-`latest` version string).
Common situations: A user pinned a nix package version in mise.toml for reproducibility and then runs export to generate a NixOS module; the pin has no equivalent in `environment.systemPackages`.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- cannot export ' ': use a shorthand attribute such as…
- a branch name is required
- a glob is required
- a repository preview directory requires a dry run
- a repository url is required
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/15b13a66e8ce4ef9.
Report an issue: GitHub.
Appendix: source
Thrown at src/cli/system/export.rs:61
miseprint!("{module}")?;
Ok(())
}
}
fn render<'a>(packages: impl IntoIterator<Item = (&'a str, &'a str)>) -> Result<String> {
let mut attributes = std::collections::BTreeSet::new();
for (spec, version) in packages {
let name = spec
.strip_prefix("nix:")
.ok_or_else(|| eyre::eyre!("expected a nix: package: {spec}"))?;
let request = Installable::parse(name)?;
if request.explicit {
bail!(
"cannot export '{spec}': use a shorthand attribute such as nix:ripgrep; the importing NixOS configuration owns the package source"
);
}
if version != "latest" {
bail!(
"cannot export version pin '{spec}' = '{version}': pin nixpkgs in the importing NixOS configuration instead"
);
}
attributes.insert(
request
.attribute
.split('.')
.map(nix_string)
.collect::<Vec<_>>()
.join("."),
);
}
let mut output = String::from(
"# Generated by mise bootstrap packages export --format nix\n{ pkgs, ... }:\n{\n environment.systemPackages = [\n",
);
for attribute in attributes {
output.push_str(&format!(" pkgs.{attribute}\n"));
}View on GitHub (pinned to 533346cc37)