about summary refs log tree commit diff
path: root/src/nix-instantiate
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-instantiate')
-rwxr-xr-xsrc/nix-instantiate23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/nix-instantiate b/src/nix-instantiate
new file mode 100755
index 000000000000..242bcfaf9332
--- /dev/null
+++ b/src/nix-instantiate
@@ -0,0 +1,23 @@
+#! /usr/bin/perl -w
+
+my $descr = $ARGV[0];
+
+open DESCR, "< $descr";
+
+while (<DESCR>) {
+    chomp;
+
+    if (/^(\w+)\s*=\s*([\w\d\.\/-]+)\s*(\#.*)?$/) {
+	my $name = $1;
+	my $file = $2;
+	my $out = `md5sum $file`;
+	$out =~ /^([0-9a-f]+)\s/;
+	my $hash = $1;
+        print "$name = $hash\n";
+    } else {
+	print "$_\n";
+    }
+
+}
+
+close DESCR;