diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4c5bc87370c3d80ca493fd151351f784533de44a..3661466d0917085a1a23043c43d51072442a2891 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -149,6 +149,14 @@ build-from-distrib-tarball:
   tags:
    - nix
 
+doc:
+  stage: tests
+  script:
+   - nix/frama-ci.sh build -A frama-c.doc
+  tags:
+   - nix
+  allow_failure: true
+
 .build_template: &internal_template
   stage: distrib_and_compatibility
   tags:
diff --git a/nix/default.nix b/nix/default.nix
index 139b30bb8501510da6b1abda14d9f55587286d85..e2bb7214259059f477e0750feec8d882c3d591c5 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -112,6 +112,26 @@ pkgs.lib.makeExtensible
         '';
   };
 
+  doc = mk_deriv {
+        name = "frama-c-doc";
+        buildInputs = self.buildInputs;
+        build_dir = self.main.build_dir;
+        src = self.main.build_dir + "/dir.tar";
+        sourceRoot = ".";
+        postPatch = ''
+               find . \( -name "Makefile*" -or -name ".depend" -o -name "ptests_config" -o -name "config.status" \) -exec bash -c "t=\$(stat -c %y \"\$0\"); sed -i -e \"s&$(cat $build_dir/old_pwd)&$(pwd)&g\" \"\$0\"; touch -d \"\$t\" \"\$0\"" {} \;
+        '';
+        configurePhase = ''
+          true
+        '';
+        buildPhase = ''
+               make doc
+        '';
+        installPhase = ''
+               true
+        '';
+  } // { other-opam-selection = "main";};
+
   tests = mk_deriv {
         name = "frama-c-test";
         buildInputs = self.buildInputs;