summary refs log tree commit diff
path: root/emacs/guix-base.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2016-01-04 19:11:30 +0300
committerAlex Kost <alezost@gmail.com>2016-01-16 13:02:21 +0300
commit2df17bd0eeed1e29e64cf21ecec61413af19ba65 (patch)
tree60145cfe020c9eaa539ca4fc0bb1367d7aa214c0 /emacs/guix-base.el
parenta0ad8ab01e839f3d3dbea0da84efbe51e8b67589 (diff)
downloadguix-2df17bd0eeed1e29e64cf21ecec61413af19ba65.tar.gz
emacs: Find packages in system profiles.
For a usual profile, packages are placed in a profile directory itself,
but for a system profile, packages are placed in 'profile'
sub-directory.  So we need to do some special cases for system profiles
to find packages there as well.

* emacs/guix-base.el (guix-packages-profile): New procedure.
  (guix-manifest-file): Use it.  Add optional 'system?' argument.
* emacs/guix-ui-generation.el (guix-system-generation?)
  (guix-generation-current-packages-profile):  New procedures.
  (guix-generation-packages, guix-generation-insert-packages): Remove
  'generation' argument.
  (guix-generation-packages-buffer): Add optional 'system?' argument.
  (guix-profile-generation-manifest-file)
  (guix-profile-generation-packages-buffer): Adjust accordingly.
* emacs/guix-main.scm (generation-package-specifications+paths): Rename to...
  (profile->specifications+paths): ... this.  Use a single 'profile' argument.
Diffstat (limited to 'emacs/guix-base.el')
-rw-r--r--emacs/guix-base.el25
1 files changed, 18 insertions, 7 deletions
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index dae658ebfa..d720a87833 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -1,6 +1,6 @@
 ;;; guix-base.el --- Common definitions   -*- lexical-binding: t -*-
 
-;; Copyright © 2014, 2015 Alex Kost <alezost@gmail.com>
+;; Copyright © 2014, 2015, 2016 Alex Kost <alezost@gmail.com>
 
 ;; This file is part of GNU Guix.
 
@@ -91,14 +91,25 @@ For the meaning of location, see `guix-find-location'."
   "Return the file name of a PROFILE's GENERATION."
   (format "%s-%s-link" profile generation))
 
-(defun guix-manifest-file (profile &optional generation)
+(defun guix-packages-profile (profile &optional generation system?)
+  "Return a directory where packages are installed for the
+PROFILE's GENERATION.
+
+If SYSTEM? is non-nil, then PROFILE is considered to be a system
+profile.  Unlike usual profiles, for a system profile, packages
+are placed in 'profile' subdirectory."
+  (let ((profile (if generation
+                     (guix-generation-file profile generation)
+                   profile)))
+    (if system?
+        (expand-file-name "profile" profile)
+      profile)))
+
+(defun guix-manifest-file (profile &optional generation system?)
   "Return the file name of a PROFILE's manifest.
-If GENERATION number is specified, return manifest file name for
-this generation."
+See `guix-packages-profile'."
   (expand-file-name "manifest"
-                    (if generation
-                        (guix-generation-file profile generation)
-                      profile)))
+                    (guix-packages-profile profile generation system?)))
 
 ;;;###autoload
 (defun guix-edit (id-or-name)