Skip to content

Commit

Permalink
Merge pull request #217 from TonyGiorgio/nix-flake
Browse files Browse the repository at this point in the history
Add nix flake
  • Loading branch information
ngutech21 authored Feb 12, 2024
2 parents b823ad9 + b2915d3 commit d16c4e3
Show file tree
Hide file tree
Showing 2 changed files with 175 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 = "Moksha flake";

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.typos
pkgs.sqlx-cli
pkgs.grcov
pkgs.protobuf
pkgs.openssl
pkgs.zlib
pkgs.gcc
pkgs.pkg-config
pkgs.just
pkgs.wasm-pack
pkgs.wasm-bindgen-cli
pkgs.binaryen
pkgs.clang
];
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/"
'';
};
}
);
}

0 comments on commit d16c4e3

Please sign in to comment.