nixpkgs/pkgs/development/compilers/zig/0.10/hook.nix
Alexis Hildebrandt 755b915a15 treewide: Remove indefinite article from meta.description
nix run nixpkgs#silver-searcher -- -G '\.nix$' -0l 'description.*"[Aa]n?' pkgs \
  | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee 's/(description.*")[Aa]n? (.)/\1\U\2/'
2024-06-09 23:07:45 +02:00

48 lines
1.4 KiB
Nix

{
lib,
makeSetupHook,
zig,
}:
makeSetupHook {
name = "zig-hook";
propagatedBuildInputs = [ zig ];
substitutions = {
# This zig_default_flags below is meant to avoid CPU feature impurity in
# Nixpkgs. However, this flagset is "unstable": it is specifically meant to
# be controlled by the upstream development team - being up to that team
# exposing or not that flags to the outside (especially the package manager
# teams).
# Because of this hurdle, @andrewrk from Zig Software Foundation proposed
# some solutions for this issue. Hopefully they will be implemented in
# future releases of Zig. When this happens, this flagset should be
# revisited accordingly.
# Below are some useful links describing the discovery process of this 'bug'
# in Nixpkgs:
# https://github.com/NixOS/nixpkgs/issues/169461
# https://github.com/NixOS/nixpkgs/issues/185644
# https://github.com/NixOS/nixpkgs/pull/197046
# https://github.com/NixOS/nixpkgs/pull/241741#issuecomment-1624227485
# https://github.com/ziglang/zig/issues/14281#issuecomment-1624220653
zig_default_flags = [
"-Dcpu=baseline"
"-Drelease-safe=true"
];
};
passthru = {
inherit zig;
};
meta = {
description = "Setup hook for using the Zig compiler in Nixpkgs";
inherit (zig.meta) maintainers platforms broken;
};
} ./setup-hook.sh