1 ;;; guix-profiles.el --- Guix profiles
3 ;; Copyright © 2014 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 (defvar guix-user-profile
23 (expand-file-name "~/.guix-profile")
26 (defvar guix-default-profile
27 (concat (or (getenv "NIX_STATE_DIR") "@guix_localstatedir@/guix")
31 "Default Guix profile.")
33 (defvar guix-current-profile guix-default-profile
36 (defun guix-profile-prompt (&optional default
)
37 "Prompt for profile and return it.
38 Use DEFAULT as a start directory. If it is nil, use
39 `guix-current-profile'."
40 (let* ((path (read-file-name "Profile: "
42 (or default guix-current-profile
))))
43 (path (directory-file-name (expand-file-name path
))))
44 (if (string= path guix-user-profile
)
48 (defun guix-set-current-profile (path)
49 "Set `guix-current-profile' to PATH.
50 Interactively, prompt for PATH. With prefix, use
51 `guix-default-profile'."
53 (list (if current-prefix-arg
55 (guix-profile-prompt))))
56 (setq guix-current-profile path
)
57 (message "Current profile has been set to '%s'."
58 guix-current-profile
))
60 (provide 'guix-profiles
)
62 ;;; guix-profiles.el ends here