mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-19 02:44:17 +03:00
Merge pull request #164048 from hqurve/jupyter-extra-paths
Jupyter kernel: link extra paths and fix missing docs in sagemath jupyter
This commit is contained in:
commit
95d4ce2175
@ -143,6 +143,9 @@ in {
|
||||
language = "python";
|
||||
logo32 = "''${env.sitePackages}/ipykernel/resources/logo-32x32.png";
|
||||
logo64 = "''${env.sitePackages}/ipykernel/resources/logo-64x64.png";
|
||||
extraPaths = {
|
||||
"cool.txt" = pkgs.writeText "cool" "cool content";
|
||||
};
|
||||
};
|
||||
}
|
||||
'';
|
||||
|
@ -56,5 +56,14 @@ with lib;
|
||||
Path to 64x64 logo png.
|
||||
'';
|
||||
};
|
||||
|
||||
extraPaths = mkOption {
|
||||
type = types.attrsOf types.path;
|
||||
default = { };
|
||||
example = literalExpression ''"{ examples = ''${env.sitePack}/IRkernel/kernelspec/kernel.js"; }'';
|
||||
description = ''
|
||||
Extra paths to link in kernel directory
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -39,26 +39,22 @@ in
|
||||
|
||||
${concatStringsSep "\n" (mapAttrsToList (kernelName: unfilteredKernel:
|
||||
let
|
||||
allowedKernelKeys = ["argv" "displayName" "language" "interruptMode" "env" "metadata" "logo32" "logo64"];
|
||||
allowedKernelKeys = ["argv" "displayName" "language" "interruptMode" "env" "metadata" "logo32" "logo64" "extraPaths"];
|
||||
kernel = filterAttrs (n: v: (any (x: x == n) allowedKernelKeys)) unfilteredKernel;
|
||||
config = builtins.toJSON (
|
||||
kernel
|
||||
// {display_name = if (kernel.displayName != "") then kernel.displayName else kernelName;}
|
||||
// (optionalAttrs (kernel ? interruptMode) { interrupt_mode = kernel.interruptMode; })
|
||||
);
|
||||
logo32 =
|
||||
if (kernel.logo32 != null)
|
||||
then "ln -s ${kernel.logo32} 'kernels/${kernelName}/logo-32x32.png';"
|
||||
else "";
|
||||
logo64 =
|
||||
if (kernel.logo64 != null)
|
||||
then "ln -s ${kernel.logo64} 'kernels/${kernelName}/logo-64x64.png';"
|
||||
else "";
|
||||
extraPaths = kernel.extraPaths or {}
|
||||
// lib.optionalAttrs (kernel.logo32 != null) { "logo-32x32.png" = kernel.logo32; }
|
||||
// lib.optionalAttrs (kernel.logo64 != null) { "logo-64x64.png" = kernel.logo64; }
|
||||
;
|
||||
linkExtraPaths = lib.mapAttrsToList (name: value: "ln -s ${value} 'kernels/${kernelName}/${name}';") extraPaths;
|
||||
in ''
|
||||
mkdir 'kernels/${kernelName}';
|
||||
echo '${config}' > 'kernels/${kernelName}/kernel.json';
|
||||
${logo32}
|
||||
${logo64}
|
||||
${lib.concatStringsSep "\n" linkExtraPaths}
|
||||
'') definitions)}
|
||||
|
||||
mkdir $out
|
||||
|
@ -9,7 +9,7 @@
|
||||
# is always preferred, see `sage-src.nix` for that.
|
||||
|
||||
let
|
||||
inherit (pkgs) symlinkJoin callPackage nodePackages;
|
||||
inherit (pkgs) symlinkJoin callPackage nodePackages lib;
|
||||
|
||||
python3 = pkgs.python3.override {
|
||||
packageOverrides = self: super: {
|
||||
@ -46,7 +46,7 @@ let
|
||||
# just one 16x16 logo is available
|
||||
logo32 = "${sage-src}/src/doc/common/themes/sage/static/sageicon.png";
|
||||
logo64 = "${sage-src}/src/doc/common/themes/sage/static/sageicon.png";
|
||||
};
|
||||
} // lib.optionalAttrs withDoc { extraPaths = { "doc" = "${sagedoc}/share/doc/sage/html/en"; }; };
|
||||
|
||||
jupyter-kernel-specs = pkgs.jupyter-kernel.create {
|
||||
definitions = pkgs.jupyter-kernel.default // {
|
||||
|
Loading…
Reference in New Issue
Block a user