From 79f40a3f72a0003610d9944baa2c92b21dd02eef Mon Sep 17 00:00:00 2001
From: Allan Blanchard <allan.blanchard@cea.fr>
Date: Thu, 23 Nov 2023 09:06:52 +0100
Subject: [PATCH] [ci] fix hello.tar.gz build

---
 doc/developer/Makefile | 16 +++++++++++-----
 nix/manuals.nix        |  2 --
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/doc/developer/Makefile b/doc/developer/Makefile
index ecfd16b4728..ade59e570a6 100644
--- a/doc/developer/Makefile
+++ b/doc/developer/Makefile
@@ -144,8 +144,13 @@ check-viewcfg-v5:
 check-viewcfg-v6:
 	cd tutorial/viewcfg/v6-* && $(duneb) @install
 
-hello.tar: FILES= $(shell cd tutorial/hello/v7-doc && git ls-files)
+ifdef NIX_BUILD_TOP
+# - in Nix CI we expect the directory to be clean
+hello.tar: FILES= $(shell cd tutorial/hello/v7-doc && find *)
+else
 # - use 'git ls-files' to avoid including extraneous files in archive
+hello.tar: FILES= $(shell cd tutorial/hello/v7-doc && git ls-files)
+endif
 # - use several tar options to improve build reproducibility
 hello.tar:
 	cd tutorial/hello && \
@@ -153,12 +158,13 @@ hello.tar:
 	cp -r v7-doc hello && \
 	tar -cf $@ $(addprefix hello/,$(FILES)) \
 	  --numeric-owner --owner=0 --group=0 --sort=name \
-	  --mtime="$$(date +"%F") Z" --mode='a+rw'
+	  --mtime="$$(date +"%F") Z" --mode='a+rw' && \
+	rm -rf hello && \
+	mv hello.tar ../../hello.tar
 
 hello.tar.gz: hello.tar
-	cd tutorial/hello && \
-	gzip -9 -n hello.tar > ../../hello.tar.gz && \
-	rm -rf hello hello.tar
+	gzip -9 -ncf hello.tar > hello.tar.gz && \
+	rm -rf hello.tar
 
 ###########
 
diff --git a/nix/manuals.nix b/nix/manuals.nix
index 23d21eb871f..30bdbd93afd 100644
--- a/nix/manuals.nix
+++ b/nix/manuals.nix
@@ -1,7 +1,6 @@
 { lib
 , stdenv
 , frama-c
-, git
 , headache
 , texlive
 } :
@@ -26,7 +25,6 @@ stdenv.mkDerivation rec {
 
   buildInputs = frama-c.buildInputs ++ [
     frama-c
-    git
     headache
     texlive.combined.scheme-full
   ];
-- 
GitLab