diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f828c1b025b7a41388d06ec4ecf2e32d7921f2af..04fd07dcf36416763f02ee7573b7817dece56210 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -151,27 +151,27 @@ CFP:
   tags:
    - nix
 
-build-tarball:
-  stage: tests
+build-distrib-tarball:
+  stage: build
   variables:
     CURRENT: $CI_COMMIT_REF_NAME
     DEFAULT: "master"
     OCAML: "4_05"
     FRAMA_CI_OPT: "--override frama-c:$CI_COMMIT_REF_NAME,$CI_COMMIT_SHA"
   script:
-   - nix/frama-ci.sh build -A frama-c.distrib
+   - nix/frama-ci.sh build -A frama-c.build-distrib-tarball
   tags:
    - nix
 
-tarball-compilation:
-  stage: distrib_and_compatibility
+build-from-distrib-tarball:
+  stage: tests
   variables:
     CURRENT: $CI_COMMIT_REF_NAME
     DEFAULT: "master"
     OCAML: "4_05"
     FRAMA_CI_OPT: "--override frama-c:$CI_COMMIT_REF_NAME,$CI_COMMIT_SHA"
   script:
-   - nix/frama-ci.sh build -A frama-c.tests-distrib
+   - nix/frama-ci.sh build -A frama-c.build-from-distrib-tarball
   tags:
    - nix
 
diff --git a/nix/default.nix b/nix/default.nix
index 7b153a9754fac0fae678c37a3708c2ab47cedd0e..6e3255fb4ed96b601da175e89980e241b578aba0 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -105,10 +105,11 @@ rec {
         '';
   };
 
-  distrib = stdenv.mkDerivation {
-        name = "frama-c-distrib";
+  build-distrib-tarball = stdenv.mkDerivation {
+        name = "frama-c-build-distrib-tarball";
         inherit src;
         buildInputs = buildInputs ++ [ plugins.headache.installed pkgs.file ];
+        outputs = [ "out" ];
         postPatch = ''
                patchShebangs .
         '';
@@ -119,16 +120,19 @@ rec {
         '';
         buildPhase = ''
                 make DISTRIB="frama-c-archive" src-distrib
+                tar -zcf frama-c-tests-archive.tar.gz tests src/plugins/*/tests
         '';
         installPhase = ''
-               tar -C $out --strip-components=1 -xf frama-c-archive.tar.gz
+               tar -C $out --strip-components=1 -xzf frama-c-archive.tar.gz
+               tar -C $out -xzf frama-c-tests-archive.tar.gz
         '';
   };
 
-  tests-distrib = stdenv.mkDerivation {
-        name = "frama-c-tests-distrib";
-        inherit distrib buildInputs;
-        outputs = [ "out" "build_dir" ];
+  build-from-distrib-tarball = stdenv.mkDerivation {
+        name = "frama-c-build-from-distrib-tarball";
+        inherit buildInputs;
+        src = build-distrib-tarball.out ;
+        outputs = [ "out" ];
         configurePhase = ''
                unset CC
                autoconf
@@ -136,10 +140,9 @@ rec {
         '';
         buildPhase = ''
                 make -j 4
-                make tests -j4 PTESTS_OPTS="-error-code -j 4"
         '';
         installPhase = ''
-               make install
+               true
         '';
   };