-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
249 additions
and
0 deletions.
There are no files selected for viewing
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 @@ | ||
use flake |
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/pkg | ||
Cargo.lock | ||
|
||
/.direnv |
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,58 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
systems.url = "github:nix-systems/default"; | ||
rust-overlay.url = "github:oxalica/rust-overlay"; | ||
|
||
# Dev tools | ||
treefmt-nix.url = "github:numtide/treefmt-nix"; | ||
}; | ||
|
||
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } { | ||
systems = import inputs.systems; | ||
imports = [ | ||
inputs.treefmt-nix.flakeModule | ||
]; | ||
perSystem = { config, self', pkgs, lib, system, rust-overlay, ... }: | ||
let | ||
rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; | ||
in { | ||
_module.args.pkgs = import inputs.nixpkgs { | ||
inherit system; | ||
overlays = [ (import inputs.rust-overlay) ]; | ||
}; | ||
|
||
# Rust dev environment | ||
devShells.default = pkgs.mkShell { | ||
inputsFrom = [ | ||
config.treefmt.build.devShell | ||
]; | ||
shellHook = '' | ||
# For rust-analyzer 'hover' tooltips to work. | ||
export RUST_SRC_PATH=${rust-toolchain.availableComponents.rust-src} | ||
export PATH=~/.cargo/bin:$PATH | ||
''; | ||
nativeBuildInputs = with pkgs; [ | ||
rust-toolchain | ||
rust-analyzer | ||
]; | ||
|
||
buildInputs = with pkgs; [ | ||
pkg-config | ||
openssl | ||
]; | ||
}; | ||
|
||
# Add your auto-formatters here. | ||
# cf. https://numtide.github.io/treefmt/ | ||
treefmt.config = { | ||
projectRootFile = "flake.nix"; | ||
programs = { | ||
nixpkgs-fmt.enable = true; | ||
rustfmt.enable = true; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
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,5 @@ | ||
[toolchain] | ||
channel = "nightly-2024-01-24" | ||
components = [ "clippy", "rustfmt", "rust-src" ] | ||
targets = [ "wasm32-unknown-unknown" ] | ||
profile = "minimal" |