nixpkgs/pkgs/development/compilers/zig/hook.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
617 B
Nix
Raw Normal View History

{ 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
cpu = "-Dcpu=baseline";
releaseType = if lib.versionAtLeast zig.version "0.11"
then "-Doptimize=ReleaseSafe"
else "-Drelease-safe=true";
in
lib.concatStringsSep " " [ cpu releaseType ];
2023-08-06 02:41:13 +00:00
};
passthru = { inherit zig; };
meta = {
description = "A setup hook for using the Zig compiler in Nixpkgs";
inherit (zig.meta) maintainers platforms broken;
};
} ./setup-hook.sh