Add optional Jupyter kernelspec options from the spec (#55989)

This commit is contained in:
Tom McLaughlin 2019-07-11 01:29:36 -07:00 committed by Frederik Rietdijk
parent 0426ae63f8
commit f72d7c49d5

View File

@ -37,15 +37,15 @@ in
installPhase = ''
mkdir kernels
${concatStringsSep "\n" (mapAttrsToList (kernelName: kernel:
${concatStringsSep "\n" (mapAttrsToList (kernelName: unfilteredKernel:
let
config = builtins.toJSON {
display_name = if (kernel.displayName != "")
then kernel.displayName
else kernelName;
argv = kernel.argv;
language = kernel.language;
};
allowedKernelKeys = ["argv" "displayName" "language" "interruptMode" "env" "metadata" "logo32" "logo64"];
kernel = traceVal (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';"