Files
nixpkgs/pkgs/development/compilers/zig/passthru.nix
Jared Baur 1dfa285940 zig: use setupHook attribute on zig derivation
By moving the zig setup hook to the zig derivation itself, we allow for
zig to splice correctly with `callPackage`, meaning that the correct zig
can be pulled in during builds when zig is in `nativeBuildInputs` (for
example).

This change retains the `zig.hook` attribute for backward compatibility
by just pointing to the zig derivation. This also removes
`zig_default_flags`, since now the setup hook is not a derivation that
can be overridden. Overriding the build flags can now be done by setting
`dontSetZigDefaultFlags = true`.
2026-01-09 14:07:46 -08:00

32 lines
724 B
Nix

{
stdenv,
zig,
callPackage,
wrapCCWith,
wrapBintoolsWith,
overrideCC,
}:
{
# Provided for backward compatibility, as the `zig` derivation now sets
# setupHook.
hook = zig;
bintools-unwrapped = callPackage ./bintools.nix { inherit zig; };
bintools = wrapBintoolsWith { bintools = zig.bintools-unwrapped; };
cc-unwrapped = callPackage ./cc.nix { inherit zig; };
cc = wrapCCWith {
cc = zig.cc-unwrapped;
bintools = zig.bintools;
extraPackages = [ ];
nixSupport.cc-cflags = [
"-target"
"${stdenv.targetPlatform.system}-${stdenv.targetPlatform.parsed.abi.name}"
];
};
stdenv = overrideCC stdenv zig.cc;
fetchDeps = callPackage ./fetcher.nix { inherit zig; };
}