2023-07-15 03:57:49 +00:00
|
|
|
{ lib
|
|
|
|
, makeSetupHook
|
|
|
|
, zig
|
|
|
|
}:
|
|
|
|
|
|
|
|
makeSetupHook {
|
|
|
|
name = "zig-hook";
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ zig ];
|
|
|
|
|
2023-08-06 02:41:13 +00:00
|
|
|
substitutions = {
|
|
|
|
zig_default_flags =
|
2023-08-21 11:38:30 +00:00
|
|
|
let
|
2023-08-22 02:35:01 +00:00
|
|
|
releaseType =
|
|
|
|
if lib.versionAtLeast zig.version "0.11" then
|
|
|
|
"-Doptimize=ReleaseSafe"
|
|
|
|
else
|
|
|
|
"-Drelease-safe=true";
|
2023-08-21 11:38:30 +00:00
|
|
|
in
|
2023-08-22 02:35:01 +00:00
|
|
|
[ "-Dcpu=baseline" releaseType ];
|
2023-08-06 02:41:13 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 03:57:49 +00:00
|
|
|
passthru = { inherit zig; };
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A setup hook for using the Zig compiler in Nixpkgs";
|
2023-08-01 02:23:20 +00:00
|
|
|
inherit (zig.meta) maintainers platforms broken;
|
2023-07-15 03:57:49 +00:00
|
|
|
};
|
|
|
|
} ./setup-hook.sh
|