summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorKonrad Hinsen <konrad.hinsen@fastmail.net>2018-02-09 20:33:12 +0100
committerLudovic Courtès <ludo@gnu.org>2018-02-15 15:40:36 +0100
commit4a979afe1b320efcdb3236eb3c8e6c889eb73f38 (patch)
tree48d243293501ceeade1ddd07a565b8ad24f4a3f7 /guix
parent47551a761bb110e0ae2402eaf014076fbe67af0f (diff)
downloadguix-patches-4a979afe1b320efcdb3236eb3c8e6c889eb73f38.tar
guix-patches-4a979afe1b320efcdb3236eb3c8e6c889eb73f38.tar.gz
pack: Add '--manifest'.
* guix/scripts/pack.scm (%options, show-help): Add --manifest. (guix-pack)[manifest-from-args]: New procedure. Use it. * doc/guix.texi (Invoking guix pack): Document --manifest. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/pack.scm22
1 files changed, 20 insertions, 2 deletions
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index a22258d5a6..a1b839e9ae 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2015, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -292,6 +293,9 @@ the image."
(option '(#\e "expression") #t #f
(lambda (opt name arg result)
(alist-cons 'expression arg result)))
+ (option '(#\m "manifest") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'manifest arg result)))
(option '(#\s "system") #t #f
(lambda (opt name arg result)
(alist-cons 'system arg
@@ -345,6 +349,9 @@ Create a bundle of PACKAGE.\n"))
(display (G_ "
-S, --symlink=SPEC create symlinks to the profile according to SPEC"))
(display (G_ "
+ -m, --manifest=FILE create a new profile generation with the manifest
+ from FILE"))
+ (display (G_ "
--localstatedir include /var/guix in the resulting pack"))
(newline)
(display (G_ "
@@ -375,10 +382,21 @@ Create a bundle of PACKAGE.\n"))
(read/eval-package-expression exp))
(x #f)))
+ (define (manifest-from-args opts)
+ (let ((packages (filter-map maybe-package-argument opts))
+ (manifest-file (assoc-ref opts 'manifest)))
+ (cond
+ ((and manifest-file (not (null? packages)))
+ (leave (G_ "both a manifest and a package list were given~%")))
+ (manifest-file
+ (let ((user-module (make-user-module '((guix profiles) (gnu)))))
+ (load* manifest-file user-module)))
+ (else (packages->manifest packages)))))
+
(with-error-handling
(parameterize ((%graft? (assoc-ref opts 'graft?)))
(let* ((dry-run? (assoc-ref opts 'dry-run?))
- (packages (filter-map maybe-package-argument opts))
+ (manifest (manifest-from-args opts))
(pack-format (assoc-ref opts 'format))
(name (string-append (symbol->string pack-format)
"-pack"))
@@ -397,7 +415,7 @@ Create a bundle of PACKAGE.\n"))
(run-with-store store
(mlet* %store-monad ((profile (profile-derivation
- (packages->manifest packages)
+ manifest
#:target target))
(drv (build-image name profile
#:target