From 0498ec787fec357202f5001ce079a2161e5e090c Mon Sep 17 00:00:00 2001 From: Jonathan Zacsh Date: Sun, 12 Jan 2025 22:49:47 -0600 Subject: [PATCH] noop(ci/cd) share nix config to let develop in same env --- README.md | 4 ++++ rust-toolchain.toml | 2 ++ shell.nix | 48 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 rust-toolchain.toml create mode 100644 shell.nix diff --git a/README.md b/README.md index bf4f517..14fb7be 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,10 @@ $ RUSTFLAGS='-Ddeprecated -Dwarnings' cargo watch \ # there's compiler errors you're trying to read. ``` +NOTE: running `nix-shell` at the root of this repo will enter you in to you +subshell with all the necessary dev tools (see `./shell.nix`). This will let you +easily run anything you find in the ci/cd yaml scripts (`./.gitlab-ci.yml`). + ### Tests e2e tests of the CLI binary, in `vcsq-cli/tests/`, are the strategy for the moment; diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..292fe49 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "stable" diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..a5addd9 --- /dev/null +++ b/shell.nix @@ -0,0 +1,48 @@ +{ + pkgs ? import { }, +}: +let + overrides = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml)); +in +pkgs.callPackage ( + { + stdenv, + mkShell, + rustup, + rustPlatform, + + + # + # Packages specific to vcsq + # + + # + # Packages specific to vcsq's domain + # + git, + mercurial, + jujutsu, + + # + # Packages specific to vcsq's ci/cd tasks + # + cargo-llvm-cov, # for test coverage + cargo-binutils, + }: + mkShell { + strictDeps = true; + nativeBuildInputs = [ + rustup + rustPlatform.bindgenHook + ]; + # libraries here + buildInputs = [ + ]; + RUSTC_VERSION = overrides.toolchain.channel; + # https://github.com/rust-lang/rust-bindgen#environment-variables + shellHook = '' + export PATH="''${CARGO_HOME:-~/.cargo}/bin":"$PATH" + export PATH="''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-${stdenv.hostPlatform.rust.rustcTarget}/bin":"$PATH" + ''; + } +) { }