9 propagatedBuildInputs = [ zig ];
12 # This zig_default_flags below is meant to avoid CPU feature impurity in
13 # Nixpkgs. However, this flagset is "unstable": it is specifically meant to
14 # be controlled by the upstream development team - being up to that team
15 # exposing or not that flags to the outside (especially the package manager
18 # Because of this hurdle, @andrewrk from Zig Software Foundation proposed
19 # some solutions for this issue. Hopefully they will be implemented in
20 # future releases of Zig. When this happens, this flagset should be
21 # revisited accordingly.
23 # Below are some useful links describing the discovery process of this 'bug'
26 # https://github.com/NixOS/nixpkgs/issues/169461
27 # https://github.com/NixOS/nixpkgs/issues/185644
28 # https://github.com/NixOS/nixpkgs/pull/197046
29 # https://github.com/NixOS/nixpkgs/pull/241741#issuecomment-1624227485
30 # https://github.com/ziglang/zig/issues/14281#issuecomment-1624220653
35 if lib.versionAtLeast zig.version "0.12" then
37 else if lib.versionAtLeast zig.version "0.11" then
38 "-Doptimize=ReleaseSafe"
40 "-Drelease-safe=true";
42 [ "-Dcpu=baseline" releaseType ];
45 passthru = { inherit zig; };
48 description = "Setup hook for using the Zig compiler in Nixpkgs";
49 inherit (zig.meta) maintainers platforms broken;