From 168fe999e71efa89326ce1df75e0df249e454ab2 Mon Sep 17 00:00:00 2001 From: Joachim Fasting Date: Tue, 20 Dec 2016 15:15:06 +0100 Subject: [PATCH] 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 --- nixos/lib/make-system-tarball.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nixos/lib/make-system-tarball.sh b/nixos/lib/make-system-tarball.sh index e04455e889b0..efb83d914287 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 -