nixpkgs/pkgs/development/compilers/zig/hook.nix
figsoda 3b6bef448e zig.hook: clean up
- remove noop `lib.concatStringsSep`
- reformat `releaseType`
- inline `cpu`
2023-08-22 10:09:56 +00:00

30 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