1 ;;; guix-ui-system-generation.el --- Interface for displaying system generations -*- lexical-binding: t -*-
3 ;; Copyright © 2016 Alex Kost <alezost@gmail.com>
5 ;; This file is part of GNU Guix.
7 ;; GNU Guix is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; GNU Guix is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ;; This file provides an interface for displaying system generations
23 ;; in 'list' and 'info' buffers, and commands for working with them.
30 (require 'guix-ui-generation
)
31 (require 'guix-profiles
)
33 (guix-ui-define-entry-type system-generation
)
35 (defun guix-system-generation-get-display (search-type &rest search-values
)
36 "Search for system generations and show results.
37 See `guix-ui-get-entries' for the meaning of SEARCH-TYPE and
39 (apply #'guix-list-get-display-entries
42 search-type search-values
))
45 ;;; System generation 'info'
47 (guix-ui-info-define-interface system-generation
48 :buffer-name
"*Guix Generation Info*"
49 :format
'((number format guix-generation-info-insert-number
)
50 (label format
(format))
51 (prev-number format
(format))
52 (current format guix-generation-info-insert-current
)
53 (path format
(format guix-file
))
55 (root-device format
(format))
56 (kernel format
(format guix-file
)))
57 :titles guix-generation-info-titles
)
60 ;;; System generation 'list'
62 ;; FIXME It is better to make `guix-generation-list-shared-map' with
63 ;; common keys for both usual and system generations.
64 (defvar guix-system-generation-list-mode-map
65 (copy-keymap guix-generation-list-mode-map
)
66 "Keymap for `guix-system-generation-list-mode' buffers.")
68 (guix-ui-list-define-interface system-generation
69 :buffer-name
"*Guix Generation List*"
70 :format
'((number nil
5 guix-list-sort-numerically-0
:right-align t
)
71 (current guix-generation-list-get-current
10 t
)
73 (time guix-list-get-time
20 t
)
74 (path guix-list-get-file-name
30 t
))
75 :titles guix-generation-list-titles
76 :sort-key
'(number . t
)
77 :marks
'((delete . ?D
)))
80 ;;; Interactive commands
83 (defun guix-system-generations ()
84 "Display information about system generations."
86 (guix-system-generation-get-display 'all
))
89 (defun guix-last-system-generations (number)
90 "Display information about last NUMBER of system generations."
91 (interactive "nThe number of last generations: ")
92 (guix-system-generation-get-display 'last number
))
95 (defun guix-system-generations-by-time (from to
)
96 "Display information about system generations created between FROM and TO."
98 (list (guix-read-date "Find generations (from): ")
99 (guix-read-date "Find generations (to): ")))
100 (guix-system-generation-get-display
101 'time
(float-time from
) (float-time to
)))
103 (provide 'guix-ui-system-generation
)
105 ;;; guix-ui-system-generation.el ends here