unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Feng Shu" <tumashu@163.com>
To: Alex Kost <alezost@gmail.com>
Cc: guix-devel <guix-devel@gnu.org>, Feng Shu <tumashu@163.com>
Subject: Re: How to install a package in guile
Date: Thu, 27 Jul 2017 20:43:28 +0800	[thread overview]
Message-ID: <87vame124v.fsf@163.com> (raw)
In-Reply-To: <877eyvgcmo.fsf@gmail.com> (Alex Kost's message of "Wed, 26 Jul 2017 23:35:27 +0300")

Alex Kost <alezost@gmail.com> writes:

> Feng Shu (2017-07-26 20:44 +0800) wrote:
>
>> ludo@gnu.org (Ludovic Courtès) writes:
> [...]
>>> The rest (setting up the symlink) is a little less convenient though.
>>> See (guix scripts package) or the equivalent Emacs-Guix code for how
>>> this works.
>>
>> (build-and-use-profile store "~/.guix-profile" $2)
>>
>> How can I get the "store"?
>
> For example, like this:
>
> (with-store store
>   (build-and-use-profile ...))

guix's code seem to hard for me, I use a emacs command to solve my
problem:

-----------------

  (defvar guix-export-directory "~/myguix/")

  (defun guix-export-package ()
    (interactive)
    (let* ((directory (file-name-as-directory guix-export-directory))
           (current-module (guix-guile-current-module))
           (define-public-string
             (save-excursion
               (end-of-defun)
               (let ((end (point)))
                 (beginning-of-defun)
                 (buffer-substring (point) end))))
           (package-name
            (progn (string-match "\\(define-public +\\)\\([a-z-]+\\)\n+"
                                 define-public-string)
                   (match-string 2 define-public-string)))
           (define-module-string
             (replace-regexp-in-string
              " *(define-module.*\n"
              (format (concat "(define-module (%s)\n"
                              "  #:use-module %s\n")
                      package-name current-module)
              (save-excursion
                (goto-char (point-min))
                (search-forward "(define-module")
                (end-of-defun)
                (let ((end (point)))
                  (beginning-of-defun)
                  (buffer-substring (point) end)))))
           (command (format "guix package --load-path='%s' -i %s "
                            directory package-name)))
      (unless (file-directory-p directory)
        (make-directory directory t))
      (with-temp-buffer
        (insert define-module-string)
        (insert "\n")
        (insert define-public-string)
        (write-file (concat directory package-name ".scm"))
        (kill-new command)
        (message command)))

------------



-- 

      reply	other threads:[~2017-07-27 12:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25 13:36 How to install a package in guile Feng Shu
2017-07-25 15:49 ` ng0
2017-07-25 21:14 ` Ludovic Courtès
2017-07-26 12:44   ` Feng Shu
2017-07-26 20:35     ` Alex Kost
2017-07-27 12:43       ` Feng Shu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vame124v.fsf@163.com \
    --to=tumashu@163.com \
    --cc=alezost@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).