summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorMichael Bishop <cleverca22@gmail.com>2018-03-17 21:26:42 -0300
committerMichael Bishop <cleverca22@gmail.com>2018-04-03 11:30:43 -0300
commit3c9e579d1ebdca423766983c3e8fec7ba56407c3 (patch)
tree8ef5d66e1fe48c448d894d648684ec86a7b725a2 /nixos/lib
parent26db7314c85962ac241944a118033f6e8e5ccf4c (diff)
downloadnixlib-3c9e579d1ebdca423766983c3e8fec7ba56407c3.tar
nixlib-3c9e579d1ebdca423766983c3e8fec7ba56407c3.tar.gz
nixlib-3c9e579d1ebdca423766983c3e8fec7ba56407c3.tar.bz2
nixlib-3c9e579d1ebdca423766983c3e8fec7ba56407c3.tar.lz
nixlib-3c9e579d1ebdca423766983c3e8fec7ba56407c3.tar.xz
nixlib-3c9e579d1ebdca423766983c3e8fec7ba56407c3.tar.zst
nixlib-3c9e579d1ebdca423766983c3e8fec7ba56407c3.zip
make-system-tarball: allow alternate compression methods
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/make-system-tarball.nix14
-rw-r--r--nixos/lib/make-system-tarball.sh5
2 files changed, 13 insertions, 6 deletions
diff --git a/nixos/lib/make-system-tarball.nix b/nixos/lib/make-system-tarball.nix
index a2a0340a6bd3..92539235be75 100644
--- a/nixos/lib/make-system-tarball.nix
+++ b/nixos/lib/make-system-tarball.nix
@@ -1,4 +1,4 @@
-{ stdenv, perl, xz, pathsFromGraph
+{ stdenv, perl, pixz, pathsFromGraph
 
 , # The file name of the resulting tarball
   fileName ? "nixos-system-${stdenv.system}"
@@ -21,14 +21,20 @@
 
   # Extra tar arguments
 , extraArgs ? ""
+  # Command used for compression
+, compressCommand ? "pixz"
+  # Extension for the compressed tarball
+, compressionExtension ? ".xz"
+  # extra inputs, like the compressor to use
+, extraInputs ? [ pixz ]
 }:
 
 stdenv.mkDerivation {
   name = "tarball";
   builder = ./make-system-tarball.sh;
-  buildInputs = [perl xz];
+  buildInputs = [ perl ] ++ extraInputs;
 
-  inherit fileName pathsFromGraph extraArgs extraCommands;
+  inherit fileName pathsFromGraph extraArgs extraCommands compressCommand;
 
   # !!! should use XML.
   sources = map (x: x.source) contents;
@@ -41,4 +47,6 @@ stdenv.mkDerivation {
   # For obtaining the closure of `storeContents'.
   exportReferencesGraph =
     map (x: [("closure-" + baseNameOf x.object) x.object]) storeContents;
+
+  extension = compressionExtension;
 }
diff --git a/nixos/lib/make-system-tarball.sh b/nixos/lib/make-system-tarball.sh
index 73a009d8488a..1a52a284a257 100644
--- a/nixos/lib/make-system-tarball.sh
+++ b/nixos/lib/make-system-tarball.sh
@@ -1,5 +1,4 @@
 source $stdenv/setup
-set -x
 
 sources_=($sources)
 targets_=($targets)
@@ -54,8 +53,8 @@ mkdir -p $out/tarball
 
 rm env-vars
 
-tar --sort=name --mtime='@1' --owner=0 --group=0 --numeric-owner -cvJf $out/tarball/$fileName.tar.xz * $extraArgs
+time tar --sort=name --mtime='@1' --owner=0 --group=0 --numeric-owner -c * $extraArgs | $compressCommand > $out/tarball/$fileName.tar${extension}
 
 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
+echo "file system-tarball $out/tarball/$fileName.tar${extension}" > $out/nix-support/hydra-build-products