kopia lustrzana https://github.com/jupyterhub/repo2docker
Add test and support for binder sub-directory
rodzic
046b744785
commit
d427fdfd52
|
@ -57,8 +57,8 @@ class NixBuildPack(BaseImage):
|
|||
('${NB_USER}', """
|
||||
nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs && \
|
||||
nix-channel --update && \
|
||||
nix-shell default.nix
|
||||
""")
|
||||
nix-shell {}
|
||||
""".format(self.binder_path('default.nix')))
|
||||
]
|
||||
|
||||
def get_start_script(self):
|
||||
|
|
|
@ -8,20 +8,25 @@ _term() {
|
|||
|
||||
trap _term SIGTERM
|
||||
|
||||
echo 'command:' "$@"
|
||||
|
||||
# a script in the binder sub-directory take precedence
|
||||
if [ -f ./binder/start ]; then
|
||||
chmod u+x ./binder/start
|
||||
nix-shell default.nix --command "./binder/start $@" &
|
||||
elif [ -f ./start ]; then
|
||||
chmod u+x ./start
|
||||
nix-shell default.nix --command "./start $@" &
|
||||
# if there is a binder/ sub-directory it takes precedence
|
||||
# files outside it are ignored
|
||||
if [ -e ./binder ]; then
|
||||
nixpath="./binder/default.nix";
|
||||
if [ -f ./binder/start ]; then
|
||||
chmod u+x ./binder/start
|
||||
nix-shell $nixpath --command "./binder/start $*" &
|
||||
else
|
||||
nix-shell $nixpath --command "$*" &
|
||||
fi
|
||||
else
|
||||
nix-shell default.nix --command "$@" &
|
||||
nixpath="./default.nix";
|
||||
if [ -f ./start ]; then
|
||||
chmod u+x ./start
|
||||
nix-shell $nixpath --command "./start $*" &
|
||||
else
|
||||
nix-shell $nixpath --command "$*" &
|
||||
fi
|
||||
fi
|
||||
|
||||
PID=$!
|
||||
echo 'waiting'
|
||||
|
||||
wait "$PID"
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
<<<<<<< HEAD
|
||||
default.nix in a binder/ directory
|
||||
----------------------------------
|
||||
|
||||
Check we find and use `default.nix` when it is in a `binder/` sub-directory.
|
||||
=======
|
||||
Nix environment - default.nix
|
||||
-----------------------------
|
||||
|
||||
You can install a nix shell environment using the traditional default.nix.
|
||||
|
||||
Documentation on the syntax and typical setup of a ``nix-shell`` environment can be found `here <https://nixos.org/nix/manual/#sec-nix-shell>`_.
|
||||
>>>>>>> 983b7f5... Add test and support for binder sub-directory
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
let
|
||||
# Pinning nixpkgs to specific release
|
||||
# To get sha256 use "nix-prefetch-git <url> --rev <commit>"
|
||||
commitRev="5574b6a152b1b3ae5f93ba37c4ffd1981f62bf5a";
|
||||
nixpkgs = builtins.fetchTarball {
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/${commitRev}.tar.gz";
|
||||
sha256 = "1pqdddp4aiz726c7qs1dwyfzixi14shp0mbzi1jhapl9hrajfsjg";
|
||||
};
|
||||
pkgs = import nixpkgs { config = { allowUnfree = true; }; };
|
||||
in
|
||||
pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
python36Packages.numpy
|
||||
python36Packages.notebook
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export NIX_PATH="nixpkgs=${nixpkgs}:."
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import numpy
|
|
@ -11,6 +11,7 @@ in
|
|||
pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
python36Packages.numpy
|
||||
python36Packages.notebook
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
|
|
|
@ -11,6 +11,7 @@ in
|
|||
pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
python36Packages.numpy
|
||||
python36Packages.notebook
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
|
|
Ładowanie…
Reference in New Issue