Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix: add wasm tooling to the default dev shell #4495

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nix/all-engines.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let
src = srcPath;
name = "prisma-engines-source";
};
craneLib = (flakeInputs.crane.mkLib pkgs).overrideToolchain rustToolchain.default;
craneLib = (flakeInputs.crane.mkLib pkgs).overrideToolchain rustToolchain;
deps = craneLib.vendorCargoDeps { inherit src; };
libSuffix = stdenv.hostPlatform.extensions.sharedLibrary;
in
Expand Down
4 changes: 3 additions & 1 deletion nix/args.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
in rec
{
pkgs = import flakeInputs.nixpkgs { inherit system overlays; };
rustToolchain = pkgs.rust-bin.stable.latest;
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
targets = ["wasm32-unknown-unknown"];
Copy link
Member Author

@aqrln aqrln Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also put this into rust-toolchain.toml for rustup to automatically handle this for everyone not using nix, and change this to pkgs.rust-bin.fromRustupToolchainFile ../rust-toolchain.toml.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please (non blocking)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do in a follow-up PR, need to merge it now to avoid a merge conflict in another one

};
};
}
11 changes: 8 additions & 3 deletions nix/shell.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
{ self', pkgs, rustToolchain, ... }:

let
devToolchain = rustToolchain.default.override { extensions = [ "rust-analyzer" "rust-src" ]; };
devToolchain = rustToolchain.override { extensions = [ "rust-analyzer" "rust-src" ]; };
nodejs = pkgs.nodejs_latest;
in
{
devShells.default = pkgs.mkShell {
packages = [
packages = with pkgs; [
devToolchain
pkgs.llvmPackages_latest.bintools
llvmPackages_latest.bintools

nodejs
nodejs.pkgs.typescript-language-server
nodejs.pkgs.pnpm

jq
wasm-bindgen-cli
wasm-pack
];

inputsFrom = [ self'.packages.prisma-engines ];
shellHook = pkgs.lib.optionalString pkgs.stdenv.isLinux
"export RUSTFLAGS='-C link-arg=-fuse-ld=lld'";
Expand Down
Loading