biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / applications / editors / jupyter-kernels / xeus-cling / default.nix
blob4158fc3dff0a24d2eae80028d6184c902358f93a
1 { callPackage
2 , cling
3 , fetchurl
4 , stdenv
5 }:
7 # Jupyter console:
8 # nix run --impure --expr 'with import <nixpkgs> {}; jupyter-console.withSingleKernel cpp17-kernel'
10 # Jupyter notebook:
11 # nix run --impure --expr 'with import <nixpkgs> {}; jupyter.override { definitions = { cpp17 = cpp17-kernel; }; }'
13 let
14   xeus-cling = callPackage ./xeus-cling.nix {};
16   mkDefinition = std:
17     let
18       versionSuffix =
19         if std == "c++11" then " 11"
20         else if std == "c++14" then " 14"
21         else if std == "c++17" then " 17"
22         else if std == "c++17" then " 17"
23         else if std == "c++2a" then " 2a"
24         else throw "Unexpected C++ std for cling: ${std}";
25     in
26       {
27         displayName = "C++" + versionSuffix;
28         argv = [
29           "${xeus-cling}/bin/xcpp"
30         ]
31         ++ cling.flags
32         ++ [
33           "-resource-dir" "${cling.unwrapped}"
34           "-L" "${cling.unwrapped}/lib"
35           "-l" "${cling.unwrapped}/lib/cling.so"
36           "-std=${std}"
37           # "-v"
38           "-f" "{connection_file}"
39         ];
40         language = "cpp";
41         logo32 = fetchurl {
42           url = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/ISO_C%2B%2B_Logo.svg/32px-ISO_C%2B%2B_Logo.svg.png";
43           hash = "sha256-cr0TB8/j2mkcFhfCkz9F7ZANOuTlWA2OcWtDcXyOjHw=";
44         };
45         logo64 = fetchurl {
46           url = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/ISO_C%2B%2B_Logo.svg/64px-ISO_C%2B%2B_Logo.svg.png";
47           hash = "sha256-nZtJ4bR7GmQttvqEJC9KejOxphrjjxT36L9yOIITFLk=";
48         };
49       };
54   cpp11-kernel = mkDefinition "c++11";
55   cpp14-kernel = mkDefinition "c++14";
56   cpp17-kernel = mkDefinition "c++17";
57   cpp2a-kernel = mkDefinition "c++2a";