File tree Expand file tree Collapse file tree 4 files changed +41
-2
lines changed
repo2docker/buildpacks/nix Expand file tree Collapse file tree 4 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -23,17 +23,22 @@ def get_build_scripts(self):
2323 """
2424 Return series of build-steps common to all nix repositories.
2525 Notice how only root privileges are needed for creating nix
26- directory.
26+ directory and a nix.conf file .
2727
2828 - create nix directory for user nix installation
29+ - disable sandboxing because its unsupported inside a Docker container
2930 - install nix package manager for user
31+
3032 """
3133 return super ().get_build_scripts () + [
3234 (
3335 "root" ,
3436 """
3537 mkdir -m 0755 /nix && \
36- chown -R ${NB_USER}:${NB_USER} /nix /usr/local/bin/nix-shell-wrapper /home/${NB_USER}
38+ chown -R ${NB_USER}:${NB_USER} /nix /usr/local/bin/nix-shell-wrapper /home/${NB_USER} && \
39+ mkdir -p /etc/nix && \
40+ touch /etc/nix/nix.conf && \
41+ echo "sandbox = false" >> /etc/nix/nix.conf
3742 """ ,
3843 ),
3944 (
Original file line number Diff line number Diff line change 1+ Check that we can build
2+ -----------------------
3+
4+ Test that actual building instead of substituting (downloading an existing build) works.
Original file line number Diff line number Diff line change 1+ let
2+ # Pinning nixpkgs to specific release
3+ # To get sha256 use "nix-prefetch-git <url> --rev <commit>"
4+ commitRev = "5574b6a152b1b3ae5f93ba37c4ffd1981f62bf5a" ;
5+ nixpkgs = builtins . fetchTarball {
6+ url = "https://github.com/NixOS/nixpkgs/archive/${ commitRev } .tar.gz" ;
7+ sha256 = "1pqdddp4aiz726c7qs1dwyfzixi14shp0mbzi1jhapl9hrajfsjg" ;
8+ } ;
9+ pkgs = import nixpkgs { config = { allowUnfree = true ; } ; } ;
10+
11+ # Test that we can actually build
12+ test-build = pkgs . runCommand "test-build" { } ''
13+ touch $out
14+ '' ;
15+
16+ in
17+ pkgs . mkShell {
18+ buildInputs = with pkgs ; [
19+ python36Packages . numpy
20+ python36Packages . notebook
21+ test-build
22+ ] ;
23+
24+ shellHook = ''
25+ export NIX_PATH="nixpkgs=${ nixpkgs } :."
26+ '' ;
27+ }
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+
3+ import numpy
You can’t perform that action at this time.
0 commit comments