nixpkgs/pkgs/zig.nix

22 lines
453 B
Nix

{ sources ? import ./sources.nix, pkgs ? import sources.nixpkgs { } }:
version:
let
src = if pkgs.stdenv.isDarwin then
"https://ziglang.org/builds/zig-macos-x86_64-${version}.tar.xz"
else
"https://ziglang.org/builds/zig-linux-x86_64-${version}.tar.xz";
in pkgs.stdenv.mkDerivation {
name = "zig";
inherit src version;
installPhase = ''
mkdir -p $out
cp -rf * $out
mkdir -p $out/bin
mv $out/zig $out/bin/zig
'';
}