Emacs/Guix: Add system installation command.

master
Pierre Neidhardt 2020-06-11 16:00:58 +02:00
parent b10dd1942a
commit 3855f45cec
1 changed files with 23 additions and 1 deletions

View File

@ -193,7 +193,8 @@ If MANIFEST is nil, it is queried from the manifests found in `ambrevar/guix-man
(require 'init-eshell) ; For `ambrevar/prefer-eshell'.
(let* ((guix (if channel
(let ((dest (expand-file-name
manifest-name
;; TODO: What name should we use with multiple manifests?
(first (first manifests))
ambrevar/guix-extra-channels)))
(make-directory dest 'parents)
(format "guix pull --channels=%s --profile=%s/guix && %s/guix/bin/guix"
@ -276,6 +277,27 @@ With a prefix argument, query for a channel specification file."
(dolist (mode '(normal insert))
(evil-global-set-key mode (kbd "C-x c G") #'ambrevar/guix-install-manifests)))
(defun ambrevar/guix-install-system (&optional system)
"Install Guix system.
System is queried from those found in `ambrevar/guix-system-directory'. "
(interactive)
(let* ((system-pair (ambrevar/guix-query-system system))
(system-name (first system-pair))
(system (second system-pair)))
(funcall (if ambrevar/prefer-eshell
'ambrevar/run-in-eshell
'ambrevar/run-in-shell)
(string-join
(list "sudo" "-E" "guix" "system" "-L" ambrevar/guix-system-directory
"reconfigure" system)
" "))))
(global-set-key (kbd "C-x c S") #'ambrevar/guix-install-system)
(with-eval-after-load 'evil
;; For some reason `global-set-key' does not work for Evil at this point.
(dolist (mode '(normal insert))
(evil-global-set-key mode (kbd "C-x c S") #'ambrevar/guix-install-system)))
;; TODO: See `guix-apply-manifest' and expand on it.
;; TODO: Use --max-jobs=N.