Skip to content

chore(nix): modernize crane overrideToolchain to function form (nexus + agency) #222

Description

@joeldsouzax

Update the crane toolchain override in both nexus and agency flakes to the current function form.

What is old

crane v0.18.0 (2024-07-05) changed overrideToolchain to require a function that constructs the toolchain for a given pkgs instantiation (for correct cross-compilation splicing), instead of a bare toolchain derivation.

Both repos still use the old bare-derivation form:

# nexus/flake.nix  and  agency/flake.nix
craneLib = (crane.mkLib pkgs).overrideToolchain
  (fenix.packages.${system}.complete.toolchain);

It still evaluates today, but is the deprecated form per crane's docs.

What to do

Switch to the function form, e.g.:

craneLib = (crane.mkLib pkgs).overrideToolchain
  (p: fenix.packages.${p.stdenv.hostPlatform.system}.complete.toolchain);
# or, if not cross-compiling, simply: (_: fenix.packages.${system}.complete.toolchain)

Apply to:

  • nexus/flake.nix
  • agency/flake.nix

While in there (quick audit, likely no-ops)

Recent crane breaking changes — confirm none apply:

  • v0.23.0: remapPathPrefixHook now opt-in via doRemapPathPrefix
  • v0.23.3: mkCargoDerivation no longer overrides stdenv via attrs (use craneLib-level stdenvSelector)

Context

Discovered while standing up bombay's Nix flake (which was modeled on nexus/agency and already uses the function form). Refs: crane API https://crane.dev/API.html, CHANGELOG https://crane.dev/CHANGELOG.html.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: metarepo-wide (build/toolchain/deps/CI)

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions