mirror of
https://github.com/roc-lang/roc.git
synced 2024-08-17 06:41:22 +03:00
Update Nix zig version & build from source instructions
This commit is contained in:
parent
c11d85b41f
commit
7b143f6329
@ -40,11 +40,16 @@ sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
|
||||
```
|
||||
|
||||
### Zig
|
||||
**version: 0.7.x**
|
||||
**version: 0.8.0**
|
||||
|
||||
If you're on MacOS, you can install with `brew install zig`
|
||||
If you're on Ubuntu and use Snap, you can install with `snap install zig --classic --beta`
|
||||
For any other OS, checkout the [Zig installation page](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager)
|
||||
For any OS, you can use [`zigup`](https://github.com/marler8997/zigup) to manage zig installations.
|
||||
|
||||
If you prefer a package manager, you can try the following:
|
||||
- For MacOS, you can install with `brew install zig`
|
||||
- For, Ubuntu, you can use Snap, you can install with `snap install zig --classic --beta`
|
||||
- For other systems, checkout this [page](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager)
|
||||
|
||||
If you want to install it manually, you can also download Zig directly [here](https://ziglang.org/download/). Just make sure you download the right version, the bleeding edge master build is the first download link on this page.
|
||||
|
||||
### LLVM
|
||||
**version: 10.0.x**
|
||||
|
@ -1,50 +0,0 @@
|
||||
{ pkgs }:
|
||||
|
||||
let
|
||||
# system helpers
|
||||
splitSystem = builtins.split "-" builtins.currentSystem;
|
||||
arch = builtins.elemAt splitSystem 0;
|
||||
isAarch64 = arch == "aarch64";
|
||||
setForSystem = { darwin, darwinAarch64, linux, linuxAarch64 }:
|
||||
if pkgs.stdenv.isDarwin
|
||||
then (
|
||||
if isAarch64
|
||||
then darwinAarch64
|
||||
else darwin
|
||||
)
|
||||
else (
|
||||
if isAarch64
|
||||
then linuxAarch64
|
||||
else linux
|
||||
);
|
||||
|
||||
version = "0.8.0-dev.2711+11ae6c42c";
|
||||
osName =
|
||||
if pkgs.stdenv.isDarwin
|
||||
then "macos" else "linux";
|
||||
archiveName = "zig-${osName}-${arch}-${version}";
|
||||
sha256 = setForSystem {
|
||||
darwin = "bf2a4cd1516d202cfbbcaa7b1308d36aa21a9f9284b39297e70f98c003f479e3";
|
||||
darwinAarch64 = "6bc35c3b40b853cd351c890c94c4a6043f5ca492ff6d704bdb1544fe1fe54d9a";
|
||||
linux = "b443cc2259fe7712ffc954745266e3ec846e27854713d817bcec35fefd655a8c";
|
||||
linuxAarch64 = "229830e6dc92f641a1106af3a8ee96fdef379ffd3a3d7db7ed62d2b46bd8ed45";
|
||||
};
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "zig-unstable";
|
||||
version = version;
|
||||
src = pkgs.fetchurl {
|
||||
inherit sha256;
|
||||
name = "${archiveName}.tar.xz";
|
||||
url = "https://ziglang.org/builds/${archiveName}.tar.xz";
|
||||
};
|
||||
phases = [ "unpackPhase" ];
|
||||
unpackPhase = ''
|
||||
mkdir -p $out/bin
|
||||
tar -xf $src
|
||||
cp ${archiveName}/zig $out/zig
|
||||
cp -r ${archiveName}/lib $out/lib
|
||||
ln -s "$out/zig" "$out/bin/zig"
|
||||
chmod +x $out/bin/zig
|
||||
'';
|
||||
}
|
72
nix/zig.nix
72
nix/zig.nix
@ -1,28 +1,48 @@
|
||||
{ pkgs }:
|
||||
|
||||
if pkgs.stdenv.isDarwin then
|
||||
let
|
||||
version = "0.7.1";
|
||||
archiveName = "zig-macos-x86_64-${version}";
|
||||
sha256 = "845cb17562978af0cf67e3993f4e33330525eaf01ead9386df9105111e3bc519";
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "zig";
|
||||
version = version;
|
||||
src = pkgs.fetchurl {
|
||||
inherit sha256;
|
||||
name = "${archiveName}.tar.xz";
|
||||
url = "https://ziglang.org/download/${version}/${archiveName}.tar.xz";
|
||||
};
|
||||
phases = [ "unpackPhase" ];
|
||||
unpackPhase = ''
|
||||
mkdir -p $out/bin
|
||||
tar -xf $src
|
||||
cp ${archiveName}/zig $out/zig
|
||||
cp -r ${archiveName}/lib $out/lib
|
||||
ln -s "$out/zig" "$out/bin/zig"
|
||||
chmod +x $out/bin/zig
|
||||
'';
|
||||
}
|
||||
else
|
||||
pkgs.zig
|
||||
let
|
||||
version = "0.8.0";
|
||||
|
||||
osName =
|
||||
if pkgs.stdenv.isDarwin then
|
||||
"macos"
|
||||
else
|
||||
"linux";
|
||||
|
||||
splitSystem = builtins.split "-" builtins.currentSystem;
|
||||
arch = builtins.elemAt splitSystem 0;
|
||||
isAarch64 = arch == "aarch64";
|
||||
|
||||
archiveName = "zig-${osName}-${arch}-${version}";
|
||||
|
||||
# If you're system is not aarch64, we assume it's x86_64
|
||||
sha256 =
|
||||
if pkgs.stdenv.isDarwin then
|
||||
if isAarch64 then
|
||||
"b32d13f66d0e1ff740b3326d66a469ee6baddbd7211fa111c066d3bd57683111"
|
||||
else
|
||||
"279f9360b5cb23103f0395dc4d3d0d30626e699b1b4be55e98fd985b62bc6fbe"
|
||||
else
|
||||
if isAarch64 then
|
||||
"ee204ca2c2037952cf3f8b10c609373a08a291efa4af7b3c73be0f2b27720470"
|
||||
else
|
||||
"502625d3da3ae595c5f44a809a87714320b7a40e6dff4a895b5fa7df3391d01e";
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "zig";
|
||||
version = version;
|
||||
src = pkgs.fetchurl {
|
||||
inherit sha256;
|
||||
name = "${archiveName}.tar.xz";
|
||||
url = "https://ziglang.org/download/${version}/${archiveName}.tar.xz";
|
||||
};
|
||||
phases = [ "unpackPhase" ];
|
||||
unpackPhase = ''
|
||||
mkdir -p $out/bin
|
||||
tar -xf $src
|
||||
cp ${archiveName}/zig $out/zig
|
||||
cp -r ${archiveName}/lib $out/lib
|
||||
ln -s "$out/zig" "$out/bin/zig"
|
||||
chmod +x $out/bin/zig
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user