Skip to content

Commit

Permalink
Merge pull request #16 from MutinyWallet/add-nix
Browse files Browse the repository at this point in the history
Add nix
  • Loading branch information
benthecarman authored Feb 8, 2024
2 parents 627375a + 69237e7 commit ba6f197
Show file tree
Hide file tree
Showing 3 changed files with 180 additions and 0 deletions.
115 changes: 115 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions flake.nix
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/"
'';
};
}
);
}
5 changes: 5 additions & 0 deletions rust-toolchain.toml
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"

0 comments on commit ba6f197

Please sign in to comment.