build: Make outputs of node-build-system reproducible.
authorLars-Dominik Braun <lars@6xq.net>
Thu, 17 Jun 2021 12:11:19 +0000 (14:11 +0200)
committerLars-Dominik Braun <lars@6xq.net>
Thu, 24 Jun 2021 12:10:29 +0000 (14:10 +0200)
package.json records two hashes of package.tgz, which change for each
build, resulting in non-reproducible builds.

* guix/build/node-build-system.scm (repack): Add reproducibility options
to tar command.

guix/build/node-build-system.scm

index a55cab2..70a3676 100644 (file)
   #t)
 
 (define* (repack #:key inputs #:allow-other-keys)
-  (invoke "tar" "-czf" "../package.tgz" ".")
+  (invoke "tar"
+          ;; Add options suggested by https://reproducible-builds.org/docs/archives/
+          "--sort=name"
+          (string-append "--mtime=@" (getenv "SOURCE_DATE_EPOCH"))
+          "--owner=0"
+          "--group=0"
+          "--numeric-owner"
+          "-czf" "../package.tgz" ".")
   #t)
 
 (define* (install #:key outputs inputs #:allow-other-keys)