Skip to content

pkgs/id: split dependency compilation out of the Nix build with crane (code#8392 follow-up) #8574

Description

@dezren39

Follow-up to code#8392 (build efficiency). pkgs/id is the one remaining Nix-built Rust package in the repo still compiling monolithically: pkgs/id/default.nix is a single buildRustPackage over src = ./., so any source change recompiles the whole dependency tree in the Nix build (its dependency set is heavy — a cold local cargo test for this workspace measured ~1024s in the 2026-11-10 build-efficiency pass).

The conversion pattern is proven twice over and documented in the two landed PRs: atlas-search (PR #8560 — craneLib ? null arg, two-tier source with fixtures in the package tier only) and fleet (PR #8572 — per-variant deps layers). pkgs/id's shape is the easy case (lockfile at the source root, single package output), with two things to check while converting: the build.rs at the package root, and the separate custom check derivation in default.nix (~line 82) which should keep working unchanged.

Done when: a one-line source change rebuilds only the package derivation (dry-run shows the deps derivation untouched), with before/after times recorded here.

Activity

  1. developing-today commented on Nov 11, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    state: triaged
    lane: any-b, worker: repo-worker-code, task 18692

    Triage verdict for #8574 (checked fresh this shift, 2026-11-17): real, ready, patterned work — routed as a scoped follow-on.

  3. added
    task/small_fixQueue packet kind: implement a small scoped change
    priority/normalOrdinary priority (the default)
    effort/mMedium: expected under 1 day of work
    on Nov 17, 2026
  4. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    Agent note — task 20171 picked up (lane any-k, 2026-11-17)

  5. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 17, 2026
  6. removed their assignment
    on Nov 20, 2026
  7. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Agent note (task 20171, oc-code-03 lane): opened PR #12732 on branch queue/20171-8574-id-crane-fresh from current main b20d539. It adds the crane-based id-crane package, mirroring pkgs/atlas-search (#8560). Local nix build was not completed within the lane budget, so CI on #12732 is the verification path.

  8. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Agent note — task 20171 picked up (lane oc-code-08).

  9. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Lane BE (archer) claiming this task (queue task 20171). Plan: convert pkgs/id/default.nix from the single buildRustPackage to the crane two-tier shape proven by #8560 (atlas-search) and #8572 (fleet) — separate deps derivation so a source-only change rebuilds only the package derivation. Working in a laptop worktree on branch archer-lane-be/8574-crane. Oracle: nix build --dry-run showing the deps derivation untouched after a one-line source change; the custom check derivation keeps working unchanged; before/after build times recorded here.

  10. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Agent note: task 20171 picked up (lane code-i, scheduled), resuming from PR #12732 (branch queue/20171-8574-id-crane-fresh, head c825253).

  11. added a commit that references this issue on Nov 23, 2026
    491030e
  12. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Agent note: task 20171 picked up (lane any-o, scheduled), resuming from PR #12732.

  13. added a commit that references this issue on Nov 23, 2026
  14. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Done — PR #12863 merged (ced8e85f3553360b63329c8246dcca7fee376456). pkgs/id/default.nix is now the crane two-tier shape from #8560/#8572: an id-deps derivation (buildDepsOnly over a manifests+lockfile+crates+vendor fileset, workspace sources stubbed) and the package derivation built against those artifacts from the full tree. Details and design notes are in the PR body; the points that matter here:

    Acceptance evidence

    1. Deps split + dry-run oracle: deps output built at /nix/store/wmij8f8panyay1i9bfmp5npb5x2ffsgr-id-deps-0.1.0. After appending a one-line comment to crates/id-core/src/lib.rs, nix-build default.nix -A default --dry-run listed exactly one derivation to build — the package derivation /nix/store/bi9i2vm860kypv03hq01lxv2lwqn9knx-id-0.1.0.drv — and the id-deps derivation (apk69i991fy2sk2n760j14i0xm9x7521-…) was not in the list. Probe reverted.
    2. Check derivation + build.rs: the standalone check derivation block is byte-identical to the pre-change file (verified by section diff) and still instantiates (id-check-0.1.0.drv in a dry run). The root build.rs is stubbed by crane in the deps tier (deps build green) and runs for real in the package tier, whose source is the full tree exactly as the monolith saw it.
    3. Timings (reference laptop, both builds under concurrent load): monolith baseline 45m16s; first crane build 94m40s — the first build pays the deps tier's build+check+test passes and release-profile test compilation (the crane path runs tests under the release profile instead of the monolith's ci-check checkType; recorded in the file header). The split's payoff is in rebuilds, per the oracle: source changes no longer touch the deps derivation at all.

    One caveat, pre-existing: both builds fail on exactly one test — cli::tests::test_command_lists_cover_all_clap_subcommands ("README CLI Commands table omits walk", id-cli 743 passed / 1 failed) — a defect on main itself, filed as #12772. The failure set is identical before and after this change; when #12772 lands, this build goes green with no further change here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mMedium: expected under 1 day of workpriority/normalOrdinary priority (the default)queue/claimedQueue worker lifecycle statestatus/in-progressQueue worker lifecycle statestatus:donetask/small_fixQueue packet kind: implement a small scoped changework/assignedQueue worker lifecycle state

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions