-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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 #1542 from juspay/nix
Add a simple nix dev shell
- Loading branch information
Showing
2 changed files
with
310 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,63 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
systems.url = "github:nix-systems/default"; | ||
|
||
rust-overlay.url = "github:oxalica/rust-overlay"; | ||
crane.url = "github:ipetkov/crane"; | ||
crane.inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
|
||
outputs = inputs: | ||
inputs.flake-parts.lib.mkFlake { inherit inputs; } { | ||
systems = import inputs.systems; | ||
|
||
perSystem = { config, self', pkgs, lib, system, ... }: | ||
let | ||
rustToolchain = pkgs.rust-bin.stable.latest.default.override { | ||
extensions = [ | ||
"rust-src" | ||
"rust-analyzer" | ||
"clippy" | ||
]; | ||
}; | ||
rustBuildInputs = [ | ||
pkgs.openssl | ||
pkgs.libiconv | ||
pkgs.pkg-config | ||
] ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ | ||
IOKit | ||
Carbon | ||
WebKit | ||
Security | ||
Cocoa | ||
]); | ||
|
||
# This is useful when building crates as packages | ||
# Note that it does require a `Cargo.lock` which this repo does not have | ||
# craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain; | ||
in | ||
{ | ||
_module.args.pkgs = import inputs.nixpkgs { | ||
inherit system; | ||
overlays = [ | ||
inputs.rust-overlay.overlays.default | ||
]; | ||
}; | ||
|
||
devShells.default = pkgs.mkShell { | ||
name = "dioxus-dev"; | ||
buildInputs = rustBuildInputs; | ||
nativeBuildInputs = [ | ||
# Add shell dependencies here | ||
rustToolchain | ||
]; | ||
shellHook = '' | ||
# For rust-analyzer 'hover' tooltips to work. | ||
export RUST_SRC_PATH="${rustToolchain}/lib/rustlib/src/rust/library"; | ||
''; | ||
}; | ||
}; | ||
}; | ||
} |