Conversation
| xeus | ||
| xeus-zmq | ||
| cppzmq | ||
| cling.unwrapped |
There was a problem hiding this comment.
The default cling package is meant for use by end-users directly, so it only provides the /bin/cling script which feeds arguments to the unwrapped version. See my comment on cxxFlags below for why it needs to be wrapped.
| cxxFlags = if useLLVMLibcxx then [ | ||
| "-I" "${lib.getDev llvmPackages_9.libcxx}/include/c++/v1" | ||
| "-L" "${llvmPackages_9.libcxx}/lib" | ||
| "-l" "${llvmPackages_9.libcxx}/lib/libc++.so" | ||
| ] else [ | ||
| "-I" "${gcc-unwrapped}/include/c++/${gcc-unwrapped.version}" | ||
| "-I" "${gcc-unwrapped}/include/c++/${gcc-unwrapped.version}/x86_64-unknown-linux-gnu" | ||
| ]; | ||
|
|
||
| flags = [ | ||
| "-nostdinc" | ||
| "-nostdinc++" | ||
| "-isystem" "${cling.unwrapped}/lib/clang/9.0.1/include" | ||
| ] ++ cxxFlags ++ [ | ||
| "-isystem" "${lib.getDev stdenv.cc.libc}/include" | ||
| "-isystem" "${cling.unwrapped}/include" | ||
| ]; |
There was a problem hiding this comment.
The funny thing about Nix is that it's optimized for prebuilt packages, meaning it stores dev outputs (headers, etc...) in a different path than default outputs (executables). This breaks the assumption that they exist at the same prefix, so we force xcpp to run with those flags set to our development paths.
There was a problem hiding this comment.
Nix flakes are basically Nix packages which specify their inputs. The flake.lock file locks those inputs to a specific commit, allowing for reproducible builds.
|
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? |
|
Merge this PR atop your patches and override |
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-clingwith 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/kernelsinto~/.local/share/jupyter/kernels.(another approach for installing kernel defs would be a tiny script like
xcpp-installthat writes kernel defs in the user's Jupyter data directory.)As long as
flake.lockis 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: runningnix develop, which opens a shell with the build environment Nix itself would use to build a release ofxeus-cling.This change does not interfere with the rest of the project.