2020-02-29 03:11:56 +00:00
|
|
|
{ sources ? import ./sources.nix, pkgs ? import sources.nixpkgs { } }:
|
|
|
|
|
2020-02-29 03:21:47 +00:00
|
|
|
version: shasums:
|
2020-02-29 03:11:56 +00:00
|
|
|
|
|
|
|
let
|
2020-02-29 03:21:47 +00:00
|
|
|
attrs = if pkgs.stdenv.isDarwin then {
|
|
|
|
url = "https://ziglang.org/builds/zig-macos-x86_64-${version}.tar.xz";
|
|
|
|
sha256 = shasums.mac;
|
|
|
|
} else {
|
|
|
|
url = "https://ziglang.org/builds/zig-linux-x86_64-${version}.tar.xz";
|
|
|
|
sha256 = shasums.linux;
|
|
|
|
};
|
2020-02-29 03:11:56 +00:00
|
|
|
|
2020-02-29 03:21:47 +00:00
|
|
|
src = pkgs.fetchurl attrs;
|
2020-02-29 03:17:56 +00:00
|
|
|
|
2020-02-29 03:11:56 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
}
|