about summary refs log tree commit diff
path: root/nixos/lib/make-system-tarball.sh
diff options
context:
space:
mode:
authorJoachim Fasting <joachifm@fastmail.fm>2016-12-20 15:15:06 +0100
committerJoachim Fasting <joachifm@fastmail.fm>2016-12-20 15:26:21 +0100
commit168fe999e71efa89326ce1df75e0df249e454ab2 (patch)
tree8e3c80544ea6f4e0deccecfc4b2bef507dff0d66 /nixos/lib/make-system-tarball.sh
parentb9d3898995f2a86f0b11c84d3b68bb12bb08d090 (diff)
make-system-tarball: create reproducible tarballs
Ensure that archive members are added in sorted order with a fixed
mtime.  This allows `nix-build --check` to succeed (when building a
tarball of a simple system configuration).

We also remove env-vars which doesn't appear to do much apart from
capture a bunch of store paths we probably don't want.

This is an alternative to
https://github.com/NixOS/nixpkgs/pull/2281/commits/4b78a5b5fb8584347999832b3c67d1276488140b
Diffstat (limited to 'nixos/lib/make-system-tarball.sh')
-rw-r--r--nixos/lib/make-system-tarball.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/lib/make-system-tarball.sh b/nixos/lib/make-system-tarball.sh
index e04455e889b01..efb83d914287a 100644
--- a/nixos/lib/make-system-tarball.sh
+++ b/nixos/lib/make-system-tarball.sh
@@ -52,9 +52,10 @@ $extraCommands
 
 mkdir -p $out/tarball
 
-tar cvJf $out/tarball/$fileName.tar.xz * $extraArgs
+rm env-vars
+
+tar --sort=name --mtime='1970-01-01' -cvJf $out/tarball/$fileName.tar.xz * $extraArgs
 
 mkdir -p $out/nix-support
 echo $system > $out/nix-support/system
 echo "file system-tarball $out/tarball/$fileName.tar.xz" > $out/nix-support/hydra-build-products
-