-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add nix flake for dev shell (#6412)
* chore: add nix flake for dev shell * chore: use same flake-utils input for solc overlay * chore: add macOS deps to nix flake
- Loading branch information
Showing
2 changed files
with
165 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,56 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
rust-overlay = { | ||
url = "github:oxalica/rust-overlay"; | ||
inputs = { | ||
nixpkgs.follows = "nixpkgs"; | ||
flake-utils.follows = "flake-utils"; | ||
}; | ||
}; | ||
solc = { | ||
url = "github:hellwolf/solc.nix"; | ||
inputs = { | ||
nixpkgs.follows = "nixpkgs"; | ||
flake-utils.follows = "flake-utils"; | ||
}; | ||
}; | ||
}; | ||
|
||
outputs = { self, nixpkgs, rust-overlay, flake-utils, solc }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
overlays = [ (import rust-overlay) ]; | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
overlays = [ rust-overlay.overlays.default solc.overlay ]; | ||
}; | ||
lib = pkgs.lib; | ||
toolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override { | ||
extensions = [ "rustfmt" "clippy" "rust-src" ]; | ||
}); | ||
in | ||
{ | ||
devShells.default = pkgs.mkShell { | ||
nativeBuildInputs = with pkgs; [ | ||
pkg-config | ||
libusb1 | ||
] ++ lib.optionals pkgs.stdenv.isDarwin [ | ||
pkgs.darwin.apple_sdk.frameworks.AppKit | ||
]; | ||
buildInputs = [ | ||
pkgs.rust-analyzer-unwrapped | ||
toolchain | ||
]; | ||
packages = with pkgs; [ | ||
solc_0_8_20 | ||
(solc.mkDefault pkgs solc_0_8_20) | ||
]; | ||
|
||
# Environment variables | ||
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library"; | ||
LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.libusb1 ]; | ||
}; | ||
}); | ||
} |