-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# JupyterWith Nix | ||
|
||
The Nix kernel can be used as follows: | ||
|
||
```nix | ||
{ | ||
iNix = jupyter.kernels.iNixKernel { | ||
# Identifier that will appear on the Jupyter interface. | ||
name = "Nix-kernel"; | ||
}; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ python3 | ||
, stdenv | ||
, name ? "nixpkgs" | ||
, callPackage | ||
, nix | ||
, writeScriptBin | ||
}: | ||
|
||
let | ||
nix-kernel = callPackage ./nix-kernel {}; | ||
kernelEnv = (python3.withPackages (p: (with p; [ | ||
nix-kernel | ||
]) | ||
)); | ||
|
||
kernelFile = { | ||
display_name = "Nix - ${name}"; | ||
language = "Nix"; | ||
argv = [ | ||
"${nix-bin}/bin/nix-kernel" | ||
"-f" | ||
"{connection_file}" | ||
]; | ||
logo64 = "logo-64x64.png"; | ||
}; | ||
|
||
nix-bin = writeScriptBin "nix-kernel" '' | ||
#! ${stdenv.shell} | ||
PATH=${nix}/bin/:${kernelEnv}/bin:$PATH | ||
exec python -m nix-kernel $@ | ||
''; | ||
|
||
iNixKernel = stdenv.mkDerivation { | ||
name = "inix-${name}"; | ||
src = ./nix.png; | ||
phases = "installPhase"; | ||
installPhase = '' | ||
mkdir -p $out/kernels/inix_${name} | ||
cp $src $out/kernels/inix_${name}/logo-64x64.png | ||
echo '${builtins.toJSON kernelFile}' > $out/kernels/inix_${name}/kernel.json | ||
''; | ||
}; | ||
in | ||
{ | ||
spec = iNixKernel; | ||
runtimePackages = [ | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ stdenv | ||
, python3Packages | ||
, python3 | ||
, pkgs | ||
, fetchFromGitHub | ||
}: | ||
with python3.pkgs; | ||
python3Packages.buildPythonPackage rec { | ||
pname = "nix-kernel"; | ||
version = "0.1"; | ||
src = fetchFromGitHub { | ||
owner = "GTrunSec"; | ||
repo = "nix-kernel"; | ||
rev = "dfa42d0812d508ded99f690ee1a83281d900a3ec"; | ||
sha256 = "1lf4rbbxjmq9h6g3wrdzx3v3dn1bndfmiybxiy0sjavgb6lzc8kq"; | ||
}; | ||
doCheck = false; | ||
preBuild = '' | ||
export HOME=$(pwd) | ||
''; | ||
propagatedBuildInputs = with python3Packages; [ pexpect notebook ] ; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.