diff options
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6edab71 --- /dev/null +++ b/flake.nix | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | { | ||
| 2 | description = "ngit-grasp - A GRASP implementation in Rust"; | ||
| 3 | |||
| 4 | inputs = { | ||
| 5 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
| 6 | rust-overlay.url = "github:oxalica/rust-overlay"; | ||
| 7 | flake-utils.url = "github:numtide/flake-utils"; | ||
| 8 | }; | ||
| 9 | |||
| 10 | outputs = { self, nixpkgs, rust-overlay, flake-utils }: | ||
| 11 | flake-utils.lib.eachDefaultSystem (system: | ||
| 12 | let | ||
| 13 | overlays = [ (import rust-overlay) ]; | ||
| 14 | pkgs = import nixpkgs { | ||
| 15 | inherit system overlays; | ||
| 16 | }; | ||
| 17 | |||
| 18 | rustToolchain = pkgs.rust-bin.stable.latest.default.override { | ||
| 19 | extensions = [ "rust-src" "rust-analyzer" ]; | ||
| 20 | }; | ||
| 21 | in | ||
| 22 | { | ||
| 23 | devShells.default = pkgs.mkShell { | ||
| 24 | buildInputs = with pkgs; [ | ||
| 25 | rustToolchain | ||
| 26 | pkg-config | ||
| 27 | openssl | ||
| 28 | git | ||
| 29 | ]; | ||
| 30 | |||
| 31 | RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library"; | ||
| 32 | |||
| 33 | shellHook = '' | ||
| 34 | echo "🚀 ngit-grasp development environment" | ||
| 35 | echo "Rust version: $(rustc --version)" | ||
| 36 | echo "" | ||
| 37 | echo "Quick commands:" | ||
| 38 | echo " cargo build - Build the project" | ||
| 39 | echo " cargo test - Run unit tests" | ||
| 40 | echo " cargo run - Run the relay" | ||
| 41 | echo "" | ||
| 42 | ''; | ||
| 43 | }; | ||
| 44 | |||
| 45 | packages.default = pkgs.rustPlatform.buildRustPackage { | ||
| 46 | pname = "ngit-grasp"; | ||
| 47 | version = "0.1.0"; | ||
| 48 | src = ./.; | ||
| 49 | cargoLock.lockFile = ./Cargo.lock; | ||
| 50 | |||
| 51 | nativeBuildInputs = with pkgs; [ | ||
| 52 | pkg-config | ||
| 53 | ]; | ||
| 54 | |||
| 55 | buildInputs = with pkgs; [ | ||
| 56 | openssl | ||
| 57 | ]; | ||
| 58 | }; | ||
| 59 | } | ||
| 60 | ); | ||
| 61 | } | ||