-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from MutinyWallet/add-nix
Add nix
- Loading branch information
Showing
3 changed files
with
180 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
description = "Minimal rust wasm32-unknown-unknown example"; | ||
|
||
inputs = { | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
rust-overlay = { | ||
url = "github:oxalica/rust-overlay"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
nixpkgs.url = "nixpkgs/nixos-unstable"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils, rust-overlay }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
overlays = [ rust-overlay.overlays.default ]; | ||
pkgs = import nixpkgs { inherit system overlays; }; | ||
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; | ||
inputs = [ | ||
rust | ||
pkgs.rust-analyzer | ||
pkgs.openssl | ||
pkgs.zlib | ||
pkgs.gcc | ||
pkgs.pkg-config | ||
pkgs.just | ||
pkgs.wasm-pack | ||
pkgs.wasm-bindgen-cli | ||
pkgs.binaryen | ||
pkgs.clang | ||
pkgs.corepack_20 | ||
pkgs.nodejs_20 | ||
pkgs.firefox | ||
pkgs.geckodriver | ||
]; | ||
in | ||
{ | ||
defaultPackage = pkgs.rustPlatform.buildRustPackage { | ||
src = ./.; | ||
|
||
cargoLock = { | ||
lockFile = ./Cargo.lock; | ||
}; | ||
|
||
nativeBuildInputs = inputs; | ||
}; | ||
|
||
|
||
devShell = pkgs.mkShell { | ||
packages = inputs; | ||
shellHook = '' | ||
export LIBCLANG_PATH=${pkgs.libclang.lib}/lib/ | ||
export LD_LIBRARY_PATH=${pkgs.openssl}/lib:$LD_LIBRARY_PATH | ||
export CC_wasm32_unknown_unknown=${pkgs.llvmPackages_14.clang-unwrapped}/bin/clang-14 | ||
export CFLAGS_wasm32_unknown_unknown="-I ${pkgs.llvmPackages_14.libclang.lib}/lib/clang/14.0.6/include/" | ||
''; | ||
}; | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[toolchain] | ||
channel = "nightly-2023-10-24" | ||
components = ["rustfmt", "clippy"] | ||
targets = [ "wasm32-unknown-unknown" ] | ||
profile = "default" |