about summary refs log tree commit diff
path: root/corepkgs/nar/nar.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'corepkgs/nar/nar.sh.in')
-rw-r--r--corepkgs/nar/nar.sh.in7
1 files changed, 6 insertions, 1 deletions
diff --git a/corepkgs/nar/nar.sh.in b/corepkgs/nar/nar.sh.in
index bffbbaf5e1df..d21668553777 100644
--- a/corepkgs/nar/nar.sh.in
+++ b/corepkgs/nar/nar.sh.in
@@ -1,5 +1,10 @@
 #! /bin/sh
 
 echo "packing $path into $out..."
-@bindir@/nix --dump --file "$path" | bzip2 > $out || exit 1
+mkdir $out || exit 1
+tmp=$out/tmp
+@bindir@/nix --dump --path "$path" | bzip2 > $out/tmp || exit 1
 
+md5=$(md5sum -b $tmp | cut -c1-32)
+if test $? != 0; then exit 1; fi
+mv $out/tmp $out/$md5-`basename $path`.nar.bz2 || exit 1