-
Notifications
You must be signed in to change notification settings - Fork 24
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 #217 from TonyGiorgio/nix-flake
Add nix flake
- Loading branch information
Showing
2 changed files
with
175 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 = "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/" | ||
''; | ||
}; | ||
} | ||
); | ||
} |