-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Nix build files #497
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ pkgs ? import <nixpkgs> {} | ||
, useLLVMLibcxx ? false | ||
, ... }: | ||
|
||
with pkgs; | ||
|
||
pkgs.llvmPackages.stdenv.mkDerivation rec { | ||
name = "xeus-cling"; | ||
src = ./.; | ||
|
||
nativeBuildInputs = with pkgs; [ | ||
cmake | ||
makeWrapper | ||
]; | ||
|
||
buildInputs = with pkgs; [ | ||
xeus | ||
xeus-zmq | ||
cppzmq | ||
cling.unwrapped | ||
argparse | ||
xtl | ||
pugixml | ||
nlohmann_json | ||
openssl | ||
llvmPackages_9.libllvm | ||
llvmPackages_9.libclang | ||
libuuid | ||
]; | ||
|
||
# Runtime flags for the C++ standard library | ||
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" | ||
]; | ||
Comment on lines
+32
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 |
||
|
||
fixupPhase = '' | ||
wrapProgram $out/bin/xcpp --add-flags "$flags" | ||
''; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nix flakes are basically Nix packages which specify their inputs. The |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ description = "xeus-cling Jupyter kernel"; | ||
|
||
inputs."nixpkgs".url = github:NixOS/nixpkgs; | ||
|
||
outputs = { self, nixpkgs, ... }: | ||
{ packages.x86_64-linux.default = | ||
(import nixpkgs { system="x86_64-linux"; }).callPackage ./default.nix {}; | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 oncxxFlags
below for why it needs to be wrapped.