summary refs log tree commit diff
path: root/gnu/build/vm.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/build/vm.scm')
-rw-r--r--gnu/build/vm.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index 7d5e613956..d0bc8c3033 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -46,6 +46,7 @@
             partition-flags
             partition-initializer
 
+            estimated-partition-size
             root-partition-initializer
             initialize-partition-table
             initialize-hard-disk))
@@ -150,6 +151,12 @@ the #:references-graphs parameter of 'derivation'."
   (flags       partition-flags (default '()))
   (initializer partition-initializer (default (const #t))))
 
+(define (estimated-partition-size graphs)
+  "Return the estimated size of a partition that can store the store items
+given by GRAPHS, a list of file names produced by #:references-graphs."
+  ;; Simply add a 20% overhead.
+  (round (* 1.2 (closure-size graphs))))
+
 (define (fold2 proc seed1 seed2 lst)              ;TODO: factorize
   "Like `fold', but with a single list and two seeds."
   (let loop ((result1 seed1)