From 362d07fc526d15e956d12e487e958388173bb789 Mon Sep 17 00:00:00 2001 From: Malte Poll <1780588+malt3@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:21:33 +0100 Subject: [PATCH] nix: allow dev setup via direnv --- .envrc | 1 + .gitignore | 3 +++ bazel/ci/shellcheck.sh.in | 1 + dev-docs/workflows/build-develop-deploy.md | 21 +++++++++++++++------ 4 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..3550a30f2 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index ee46abb50..27a599676 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,6 @@ s3proxy-ca.crt # Lychee link checker .lycheecache + +# direnv +.direnv \ No newline at end of file diff --git a/bazel/ci/shellcheck.sh.in b/bazel/ci/shellcheck.sh.in index e68e82a32..1b07981a2 100644 --- a/bazel/ci/shellcheck.sh.in +++ b/bazel/ci/shellcheck.sh.in @@ -25,6 +25,7 @@ readarray -t <<< "${scriptsStr}" scripts=("${MAPFILE[@]}") excludeDirs=( + ".direnv" "internal/constellation/helm/charts/cilium" "build" "docs/node_modules" diff --git a/dev-docs/workflows/build-develop-deploy.md b/dev-docs/workflows/build-develop-deploy.md index cc43f6b1a..4f596ddcb 100644 --- a/dev-docs/workflows/build-develop-deploy.md +++ b/dev-docs/workflows/build-develop-deploy.md @@ -15,13 +15,22 @@ Prerequisites: ### Linux -* If you don't want to perform any setup, you can get a shell with Bazel and all required dependencies by running: +If you don't want to perform any setup, you can get a shell with Bazel and all required dependencies by running: - ```sh - # better would be: nix develop -i - # but this doesn't play nice with bashrc, colored output and non-hermetic tools - nix develop - ``` +```sh +# better would be: nix develop -i +# but this doesn't play nice with bashrc, colored output and non-hermetic tools +nix develop +``` + +Or activate [direnv](https://direnv.net/) to automatically enter the nix shell. +It is recommended to use [nix-direnv](https://github.com/nix-community/nix-direnv). +If your system ships outdated bash, [install direnv](https://direnv.net/docs/installation.html) via package manager. +Additionally, you may want to add the [vscode extension](https://github.com/direnv/direnv-vscode). + +```sh +direnv allow +``` ### Mac