summaryrefslogtreecommitdiff
path: root/emacs/guix-main.scm
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2016-01-07 23:01:26 +0300
committerAlex Kost <alezost@gmail.com>2016-01-16 13:02:21 +0300
commit67cedc4ba69ec90b2d9d94646b861ba6821f342d (patch)
treea0d542e00e883c106c02e2fe7dfa698e7e5f67a2 /emacs/guix-main.scm
parent56728668485dfcba457e64748ab709eacf39b6ce (diff)
downloadpatches-67cedc4ba69ec90b2d9d94646b861ba6821f342d.tar
patches-67cedc4ba69ec90b2d9d94646b861ba6821f342d.tar.gz
emacs: Add interface for system generations.
* emacs/guix-main.scm (system-generation-boot-parameters) (system-generation-param-alist, system-generation-sexps): New procedures. (entries): Add 'system-generation' entry type. * emacs/guix-messages.el (guix-result-message): Use the same messages for 'generation' and 'system-generation' entry types. * emacs/guix-ui-system-generation.el: New file. * emacs.am (ELFILES): Add it. * doc/emacs.texi (Emacs Commands): Document new commands. * NEWS: Mention new interface.
Diffstat (limited to 'emacs/guix-main.scm')
-rw-r--r--emacs/guix-main.scm38
1 files changed, 37 insertions, 1 deletions
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 1199679975..236c882e3c 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -61,7 +61,8 @@
(guix scripts lint)
(guix scripts package)
(guix scripts pull)
- (gnu packages))
+ (gnu packages)
+ (gnu system))
(define-syntax-rule (first-or-false lst)
(and (not (null? lst))
@@ -758,6 +759,38 @@ See 'entry-sexps' for details."
params)))
(map ->sexp generations)))
+(define system-generation-boot-parameters
+ (memoize
+ (lambda (profile generation)
+ "Return boot parameters for PROFILE's system GENERATION."
+ (let* ((gen-file (generation-file-name profile generation))
+ (param-file (string-append gen-file "/parameters")))
+ (call-with-input-file param-file read-boot-parameters)))))
+
+(define (system-generation-param-alist profile)
+ "Return an alist of system generation parameters and procedures for
+PROFILE."
+ (append (generation-param-alist profile)
+ `((label . ,(lambda (gen)
+ (boot-parameters-label
+ (system-generation-boot-parameters
+ profile gen))))
+ (root-device . ,(lambda (gen)
+ (boot-parameters-root-device
+ (system-generation-boot-parameters
+ profile gen))))
+ (kernel . ,(lambda (gen)
+ (boot-parameters-kernel
+ (system-generation-boot-parameters
+ profile gen)))))))
+
+(define (system-generation-sexps profile params search-type search-vals)
+ "Return an alist with information about system generations."
+ (let ((generations (find-generations profile search-type search-vals))
+ (->sexp (object-transformer (system-generation-param-alist profile)
+ params)))
+ (map ->sexp generations)))
+
;;; Getting package/output/generation entries (alists).
@@ -802,6 +835,9 @@ parameter/value pairs."
((generation)
(generation-sexps profile params
search-type search-vals))
+ ((system-generation)
+ (system-generation-sexps profile params
+ search-type search-vals))
(else (entry-type-error entry-type))))