mitchellh / mitchellh/zig-overlay

The overlay is not a proper overlay

Open
#44 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Nix
Stars
548
Forks
63
PR merge metrics
No merged PRs in 30d

Description

One of the usescases for overlays is using nixpkgs' splicing for cross-compilation. However, as the overlay exports a static package that doesn't use final.callPackage from overlays, the splicing is lost.

nix-repl> pkgs = import <nixpkgs> { overlays = [(builtins.getFlake "github:mitchellh/zig-overlay").overlays.default]; }

nix-repl> :b pkgs.pkgsCross.aarch64-multiplatform.zigpkgs.master
error: a 'aarch64-linux' with features {} is required to build '/nix/store/p9shafw43vf4a1508z5sn0a3fsm3dj9k-zig-linux-aarch64-0.12.0-dev.3533+e5d900268.tar.xz.drv', but I am a 'x86_64-linux' with features {benchmark, big-parallel, kvm, nixos-test}

nix-repl> :b pkgs.pkgsCross.aarch64-multiplatform.stdenv.cc

This derivation produced the following outputs:
  info -> /nix/store/0wb6b7lz1xndy419ffi5vdfwl7lhj5hw-aarch64-unknown-linux-gnu-gcc-wrapper-13.2.0-info
  man -> /nix/store/f01dvcx0dd5ikwj7ycm83fm3rcgcxamg-aarch64-unknown-linux-gnu-gcc-wrapper-13.2.0-man
  out -> /nix/store/pic9zq502bybas3l0z0ymqdzkacx2h6l-aarch64-unknown-linux-gnu-gcc-wrapper-13.2.0

Note that I don't plan to use this (in fact I haven't even started my Zig journey), but just wanted to inform about this nix thing

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at overlays.default and trace how the static Zig package is exported, comparing it with the final.callPackage path. Reproduce the pkgs.pkgsCross.aarch64-multiplatform.zigpkgs.master command and verify that the resulting derivation preserves the requested target instead of requiring aarch64-linux on an x86_64-linux host. Done means cross-compilation splicing works through the overlay.

Written by the indexing model from the issue text.

Assessment

Tech stack
zig
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.