diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 50a346987f40a460f38037b3cbc0a8f3a6e568b2..7e7348ffeeca9e8e39a16adabd7ce9b3eed0418f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -67,8 +67,9 @@ unit-tests:
   stage: "build"
   script:
     - |
+      set -x
       # GRID is set in one of the "instantiations" of this job template.
-      nix-shell --run "morph build --show-trace morph/grid/${GRID}/grid.nix"
+      nix-shell --pure --run "morph build --show-trace morph/grid/${GRID}/grid.nix"
 
 
 morph-build-localdev:
@@ -111,7 +112,7 @@ system-tests:
   timeout: "3 hours"
   stage: "build"
   script:
-    - "nix-build --attr system-tests"
+    - "nix-shell --pure --run 'nix-build --attr system-tests'"
 
 # A template for a job that can update one of the grids.
 .update-grid: &UPDATE_GRID
diff --git a/shell.nix b/shell.nix
index b8be3a3a6088a987468329ad29919a6957313c6a..d23d71f2a08f548f9fd95c6a95490f2de7f8b60a 100644
--- a/shell.nix
+++ b/shell.nix
@@ -22,6 +22,8 @@ pkgs.mkShell {
   inputsFrom = [tools];
   buildInputs = [
     tools
+    pkgs.cacert
+    pkgs.nix
     pkgs.morph
     pkgs.jp
   ];