jupyter-xeus / xeus-cling

Jupyter kernel for the C++ programming language
BSD 3-Clause "New" or "Revised" License
3.01k stars 294 forks source link

Added Nix build files #497

Open Thesola10 opened 9 months ago

Thesola10 commented 9 months ago

This PR proposal adds build files for the Nix package manager, effectively turning this project into a "Nix Flake". The rationale is that C/C++ projects usually induce a lot of interference with the local build environment, which the Nix package manager alleviates.

These files let Nix build xeus-cling with all required dependencies, allowing one to install the kernel with a single command: nix profile install github:jupyter-xeus/xeus-cling, and copying/linking the kernel definition files in ~/.nix-profile/share/jupyter/kernels into ~/.local/share/jupyter/kernels.

(another approach for installing kernel defs would be a tiny script like xcpp-install that writes kernel defs in the user's Jupyter data directory.)

As long as flake.lock is committed, all dependencies are pinned to a strict version from the upstream NixOS project. Not committing it will let dependencies update automatically, but this may make builds less reliable.

This also provides another way to create a dev environment for working on xeus-cling: running nix develop, which opens a shell with the build environment Nix itself would use to build a release of xeus-cling.

This change does not interfere with the rest of the project.

detuur commented 1 month ago

I'm not a nix expert, but I do want a bleeding-edge cling in my jupyter without having to mess with conda dev environments. This flake is built against nixpkgs' cling, which is still stuck on 0.9. Given there exist some patches to make xeus-cling compatible with upstream cling, how can I make a flake that builds against a git version of cling?

Thesola10 commented 1 month ago

Merge this PR atop your patches and override cling from nixpkgs to point to the latest source URL