diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bbd14724b570a02d027a098906229d434504200a..7e7348ffeeca9e8e39a16adabd7ce9b3eed0418f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -112,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