mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
made nix flake work for darwin-aarch64(M1)
This commit is contained in:
parent
f8156ffd53
commit
30c8cbc620
2 changed files with 139 additions and 56 deletions
69
flake.lock
generated
69
flake.lock
generated
|
@ -1,5 +1,35 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1649676176,
|
||||
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1629481132,
|
||||
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1647282937,
|
||||
|
@ -32,10 +62,47 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1631288242,
|
||||
"narHash": "sha256-sXm4KiKs7qSIf5oTAmrlsEvBW193sFj+tKYVirBaXz0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0e24c87754430cb6ad2f8c8c8021b29834a8845e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"zig": "zig"
|
||||
}
|
||||
},
|
||||
"zig": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1650415318,
|
||||
"narHash": "sha256-HZDhiEELVjhZf9pR0Y3cYVFI7SZVCiSc1g3yqvMYdFk=",
|
||||
"owner": "roarkanize",
|
||||
"repo": "zig-overlay",
|
||||
"rev": "da3b287c1d29761e576ad81ac94aed260744d20d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "roarkanize",
|
||||
"repo": "zig-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
40
flake.nix
40
flake.nix
|
@ -4,16 +4,19 @@
|
|||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
|
||||
nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
|
||||
# zig = { url = "github:roarkanize/zig-overlay"; };
|
||||
zig = { url = "github:roarkanize/zig-overlay"; };
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable }:
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, zig, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
unstable-pkgs = nixpkgs-unstable.legacyPackages.x86_64-linux;
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
unstable-pkgs = nixpkgs-unstable.legacyPackages.${system};
|
||||
llvmPkgs = pkgs.llvmPackages_12;
|
||||
|
||||
linuxInputs = with pkgs; [
|
||||
linuxInputs = with pkgs;
|
||||
lib.optionals stdenv.isLinux [
|
||||
valgrind # used in cli tests, see cli/tests/cli_run.rs
|
||||
vulkan-headers
|
||||
vulkan-loader
|
||||
|
@ -27,6 +30,20 @@
|
|||
alsa-lib
|
||||
];
|
||||
|
||||
darwinInputs = with pkgs;
|
||||
lib.optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [
|
||||
AppKit
|
||||
CoreFoundation
|
||||
CoreServices
|
||||
CoreVideo
|
||||
Foundation
|
||||
Metal
|
||||
Security
|
||||
]);
|
||||
|
||||
# zig 0.8.1 from pkgs is broken on aarch64-darwin, hence the workaround
|
||||
zig-toolchain = zig.packages.${system}."0.8.1";
|
||||
|
||||
sharedInputs = (with pkgs; [
|
||||
# build libraries
|
||||
cmake
|
||||
|
@ -36,7 +53,7 @@
|
|||
llvmPkgs.clang
|
||||
libxkbcommon
|
||||
pkg-config
|
||||
zig # roc builtins are implemented in zig, see compiler/builtins/bitcode/
|
||||
zig-toolchain # roc builtins are implemented in zig, see compiler/builtins/bitcode/
|
||||
|
||||
# lib deps
|
||||
libffi
|
||||
|
@ -55,16 +72,15 @@
|
|||
rustfmt
|
||||
]);
|
||||
in {
|
||||
|
||||
devShell.x86_64-linux = pkgs.mkShell {
|
||||
buildInputs = sharedInputs ++ linuxInputs;
|
||||
devShell = pkgs.mkShell {
|
||||
buildInputs = sharedInputs ++ darwinInputs ++ linuxInputs;
|
||||
|
||||
LLVM_SYS_120_PREFIX = "${llvmPkgs.llvm.dev}";
|
||||
NIX_GLIBC_PATH = if pkgs.stdenv.isLinux then "${pkgs.glibc_multi.out}/lib" else "";
|
||||
LD_LIBRARY_PATH = with pkgs;
|
||||
lib.makeLibraryPath
|
||||
([ pkg-config stdenv.cc.cc.lib libffi ncurses zlib ] ++ linuxInputs);
|
||||
};
|
||||
|
||||
([ pkg-config stdenv.cc.cc.lib libffi ncurses zlib ]);
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue