From 3930ee416a277706d8e0baeba1275cd88ed02e3c Mon Sep 17 00:00:00 2001 From: Alejandro Cabeza Romero Date: Wed, 17 Jun 2026 19:07:56 +0200 Subject: [PATCH] Re-document and Nix integration with IDEs. --- CONTRIBUTING.md | 39 +++++++++++++++++++++++++++++++++++++++ justfile | 4 ++++ 2 files changed, 43 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..c299dd9 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# Contributing + +## Nix + IDE Integration + +If your IDE reports that a file doesn't belong to the project or that files cannot be found, the CMake cache is likely +missing the Nix-provided paths. + +This may happen when the IDE runs CMake on its own, outside the Nix environment, leaving the required paths empty. + +#### Preferred fix: launch the IDE from inside the Nix dev shell + +This makes the IDE inherit required environment variables directly, so every CMake reload it triggers has the right +environment, not just a one-off cache snapshot. + +Example: +```bash +nix develop -c ... +``` + +Or, if you're using CLion, there's already a shortcut for that: +```bash +just clion +``` + +#### Alternative: regenerate the cache, then reload without resetting it + +If you don't want to launch the IDE from inside the Nix dev shell, you can try to reuse an existing `CMakeCache.txt` on +reload instead of always re-running `cmake` with its own environment. + +To do that, you first need to regenerate the cache. This can be done by running: +```bash +nix develop -c just configure +``` + +Then reload the CMake project without resetting the cache (resetting it would wipe the paths you just wrote): + +> JetBrains: **View → Tool Windows → CMake** → **Reload** ↺ + +This won't help on an IDE that always re-invokes `cmake` with its own (non-Nix) environment on reload. diff --git a/justfile b/justfile index d35b6da..bddc96e 100644 --- a/justfile +++ b/justfile @@ -17,6 +17,10 @@ rebuild: clean build nix: nix develop +# Launch CLion inside the Nix dev shell so it inherits required variables and fully integrates with Nix. +clion: + nix develop -c "$HOME/.local/share/JetBrains/Toolbox/apps/clion/bin/clion.sh" . >/dev/null 2>&1 & + prettify: nix shell nixpkgs#clang-tools -c clang-format -i src/**.cpp src/**.h