2020-10-24 22:22:51 +03:00
|
|
|
{ }:
|
|
|
|
|
|
|
|
with {
|
2020-09-05 23:58:33 +03:00
|
|
|
# Look here for information about how pin version of nixpkgs
|
2020-01-07 15:27:34 +03:00
|
|
|
# → https://nixos.wiki/wiki/FAQ/Pinning_Nixpkgs
|
2020-10-24 22:22:51 +03:00
|
|
|
pkgs = import (builtins.fetchGit {
|
|
|
|
name = "nixpkgs-2020-10-24";
|
|
|
|
url = "https://github.com/nixos/nixpkgs-channels/";
|
|
|
|
ref = "refs/heads/nixpkgs-unstable";
|
|
|
|
rev = "502845c3e31ef3de0e424f3fcb09217df2ce6df6";
|
2020-01-07 15:27:34 +03:00
|
|
|
}) { };
|
2020-10-26 00:50:31 +03:00
|
|
|
|
|
|
|
isMacOS = builtins.currentSystem == "x86_64-darwin";
|
2020-10-24 22:22:51 +03:00
|
|
|
};
|
2020-01-07 15:27:34 +03:00
|
|
|
|
2020-11-10 22:03:04 +03:00
|
|
|
with (pkgs);
|
|
|
|
|
2020-01-07 15:27:34 +03:00
|
|
|
let
|
2020-11-11 20:55:00 +03:00
|
|
|
darwin-frameworks = if isMacOS then
|
|
|
|
with pkgs.darwin.apple_sdk.frameworks; [
|
|
|
|
AppKit
|
|
|
|
CoreFoundation
|
|
|
|
CoreServices
|
|
|
|
CoreVideo
|
|
|
|
Foundation
|
|
|
|
Metal
|
|
|
|
Security
|
|
|
|
]
|
|
|
|
else
|
|
|
|
[ ];
|
|
|
|
|
|
|
|
linux-only = if !isMacOS then [
|
|
|
|
vulkan-headers
|
|
|
|
vulkan-loader
|
|
|
|
vulkan-tools
|
|
|
|
vulkan-validation-layers
|
|
|
|
xorg.libX11
|
|
|
|
xorg.libXcursor
|
|
|
|
xorg.libXrandr
|
|
|
|
xorg.libXi
|
|
|
|
] else
|
|
|
|
[ ];
|
|
|
|
|
2020-11-10 22:03:04 +03:00
|
|
|
llvmPkg = pkgs.llvm_10;
|
|
|
|
lldPkg = pkgs.lld_10; # this should match llvm's version
|
|
|
|
clangPkg = pkgs.clang_10; # this should match llvm's version
|
2020-10-26 00:50:31 +03:00
|
|
|
zig = import ./nix/zig.nix { inherit pkgs isMacOS; };
|
2020-11-11 20:55:00 +03:00
|
|
|
inputs = [
|
|
|
|
# build libraries
|
|
|
|
rustc
|
|
|
|
cargo
|
|
|
|
clippy
|
|
|
|
rustfmt
|
|
|
|
cmake
|
|
|
|
git
|
|
|
|
python3
|
|
|
|
llvmPkg
|
|
|
|
clangPkg
|
|
|
|
valgrind
|
|
|
|
pkg-config
|
|
|
|
zig
|
|
|
|
# llb deps
|
|
|
|
libffi
|
|
|
|
libxml2
|
|
|
|
zlib
|
|
|
|
# faster builds - see https://github.com/rtfeldman/roc/blob/trunk/BUILDING_FROM_SOURCE.md#use-lld-for-the-linker
|
|
|
|
lldPkg
|
|
|
|
# dev tools
|
|
|
|
rust-analyzer
|
|
|
|
# (import ./nix/zls.nix { inherit pkgs zig; })
|
|
|
|
ccls
|
|
|
|
];
|
|
|
|
|
2020-11-10 22:03:04 +03:00
|
|
|
in mkShell {
|
2020-11-11 20:55:00 +03:00
|
|
|
buildInputs = inputs ++ darwin-frameworks ++ linux-only;
|
2020-11-10 22:03:04 +03:00
|
|
|
LLVM_SYS_100_PREFIX = "${llvmPkg}";
|
2020-10-29 04:22:54 +03:00
|
|
|
|
2020-11-11 20:55:00 +03:00
|
|
|
APPEND_LIBRARY_PATH = stdenv.lib.makeLibraryPath
|
|
|
|
([ pkgconfig libcxx libcxxabi libunwind ] ++ linux-only);
|
2020-11-10 20:22:11 +03:00
|
|
|
|
2020-10-29 04:22:54 +03:00
|
|
|
# Aliases don't work cross shell, so we do this
|
2020-10-29 04:17:58 +03:00
|
|
|
shellHook = ''
|
2020-11-10 20:22:11 +03:00
|
|
|
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$APPEND_LIBRARY_PATH"
|
2020-10-29 04:20:56 +03:00
|
|
|
export PATH="$PATH:$PWD/nix/bin"
|
2020-10-29 04:17:58 +03:00
|
|
|
'';
|
2020-09-05 23:58:33 +03:00
|
|
|
}
|
|
|
|
|