nixpkgs/pkgs/zig.nix

27 lines
534 B
Nix
Raw Normal View History

2020-03-15 13:24:55 +00:00
{ pkgs ? import <nixpkgs> { } }:
2020-02-29 03:11:56 +00:00
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
'';
}