From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Feng Shu" Subject: Re: How to install a package in guile Date: Thu, 27 Jul 2017 20:43:28 +0800 Message-ID: <87vame124v.fsf@163.com> References: <87mv7s3agv.fsf@163.com> <87y3rcb4nj.fsf@gnu.org> <87mv7rs6zb.fsf@163.com> <877eyvgcmo.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dai8i-0005nP-HS for guix-devel@gnu.org; Thu, 27 Jul 2017 08:43:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dai8e-0007Gy-JB for guix-devel@gnu.org; Thu, 27 Jul 2017 08:43:40 -0400 Received: from m12-14.163.com ([220.181.12.14]:47699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dai8e-0007CY-0L for guix-devel@gnu.org; Thu, 27 Jul 2017 08:43:36 -0400 In-Reply-To: <877eyvgcmo.fsf@gmail.com> (Alex Kost's message of "Wed, 26 Jul 2017 23:35:27 +0300") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Alex Kost Cc: guix-devel , Feng Shu Alex Kost writes: > Feng Shu (2017-07-26 20:44 +0800) wrote: > >> ludo@gnu.org (Ludovic Court=E8s) 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=3D'%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))) ------------ --=20