From ae188b188162bb63161fa35f7cbc80119975f184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20D=C3=B6nszelmann?= Date: Mon, 27 May 2024 16:54:41 +0200 Subject: [PATCH] add nix setups --- .envrc | 1 + .gitignore | 3 ++- flake.nix | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .envrc create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..44610e5 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake; diff --git a/.gitignore b/.gitignore index 083e81b..5ac8096 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,5 @@ Cargo.lock .vscode/ .idea/ -*.dot \ No newline at end of file +*.dot +.direnv \ No newline at end of file diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..f4da116 --- /dev/null +++ b/flake.nix @@ -0,0 +1,32 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + }; + }; + }; + + outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ (import rust-overlay) ]; + }; + in { + devShells.default = pkgs.mkShell rec { + rustToolchain = pkgs.rust-bin.stable.latest.default.override { + targets = [ "wasm32-unknown-unknown" ]; + extensions = [ "rust-src" "rust-analyzer" ]; + }; + RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library"; + + buildInputs = with pkgs; [ trunk rustToolchain cargo-watch ]; + }; + }); +}