depot/third_party/nixpkgs/pkgs/development/compilers/zig/hook.nix
Default email c7f94ff3ce Project import generated by Copybara.
GitOrigin-RevId: b85ed9dcbf187b909ef7964774f8847d554fab3b
2023-08-22 22:05:09 +02:00

29 lines
571 B
Nix

{ lib
, makeSetupHook
, zig
}:
makeSetupHook {
name = "zig-hook";
propagatedBuildInputs = [ zig ];
substitutions = {
zig_default_flags =
let
releaseType =
if lib.versionAtLeast zig.version "0.11" then
"-Doptimize=ReleaseSafe"
else
"-Drelease-safe=true";
in
[ "-Dcpu=baseline" releaseType ];
};
passthru = { inherit zig; };
meta = {
description = "A setup hook for using the Zig compiler in Nixpkgs";
inherit (zig.meta) maintainers platforms broken;
};
} ./setup-hook.sh