help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Newbie user: Feedback on custom package definition


From: Rodrigo Morales
Subject: Newbie user: Feedback on custom package definition
Date: Tue, 28 Feb 2023 17:06:29 -0500

Table of Contents
_________________

1. The context
2. The package I wrote
3. The questions


1 The context
=============

  Newbie user here. I'm learning how to write my own Guix packages. I've
  written the following package (please see next section). I have been
  able to successfully install it. However, I'm opening this thread so
  that any of you could give me some feedback as I'm not experienced
  with defining packages.

  I'm aware of Emacs being able to download packages from repositories
  through the functions defined in `package.el'. However, that package
  is not available neither in ELPA nor MELPA, so I thought defining a
  GUIX package for it would come in handy.


2 The package I wrote
=====================

  ,----
  | (define-module (my-simple-package)
  |   #:use-module (guix licenses)
  |   #:use-module (guix packages)
  |   #:use-module (guix gexp)
  |   #:use-module (guix build-system trivial)
  |   #:use-module (guix git-download))
  |
  | (define-public my-simple-package-org-recoll
  |   (package
  |    (name "my-simple-package-org-recoll")
  |    (version "1.0")
  |    (source (origin
  |             (method git-fetch)
  |             (uri (git-reference
  |                   (url "https://github.com/alraban/org-recoll";)
  |                   (commit "1e21fbc70b5e31b746257c12d00acba3dcc1dd5c")))
  |             (file-name (git-file-name name version))
  |             (sha256
  |              (base32
  |               "09bixzl8ky7scsahb50wwkdcz335gy257m80z9rpqqhjy6q9023c"))))
  |    (build-system trivial-build-system)
  |    (arguments
  |     (list
  |      ;; Module that defines install-file. Read "(guix) Build
  |      ;; Utilities" for more information.
  |      #:modules `((guix build utils))
  |      #:builder
  |      #~(begin
  |          (use-modules (guix build utils))
  |          (chdir (assoc-ref %build-inputs "source"))
  |          (install-file "org-recoll.el"
  |                        (string-append
  |                         #$output
  |                         "/.config/emacs/libs")))))
  |    (synopsis "My synopsis")
  |    (description "My description")
  |    (home-page "https://example.org/";)
  |    (license gpl3+)))
  `----

  The package I wrote downloads an Emacs package from a git repository
  and saves it into a directory

  ,----
  | guix package -i my-simple-package-org-recoll
  | echo Exit code: $?
  `----

  ,----
  | The following package will be installed:
  |    my-simple-package-org-recoll 1.0
  |
  | substitute: updating substitutes from 'https://ci.guix.gnu.org'...
100.0%
  | substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'...
100.0%
  | The following derivations will be built:
  |   /gnu/store/zm9hs6wp6v24qy8cr27dgh6ajfixirdf-profile.drv
  |
/gnu/store/iqxb2m5lz7k0mj8gklnrxg01q5572w6w-my-simple-package-org-recoll-1.0.drv
  |
/gnu/store/a29ymip131j67wq2rhzf9lr9kidqk7fq-my-simple-package-org-recoll-1.0-checkout.drv
  |
  | building
/gnu/store/a29ymip131j67wq2rhzf9lr9kidqk7fq-my-simple-package-org-recoll-1.0-checkout.drv...
  | building
/gnu/store/iqxb2m5lz7k0mj8gklnrxg01q5572w6w-my-simple-package-org-recoll-1.0.drv...
  | building CA certificate bundle...
  | listing Emacs sub-directories...
  | building fonts directory...
  | building directory of Info manuals...
  | building profile with 2 packages...
  | Exit code: 0
  `----

  By using the following commad, we can see that the file was installed
  under my home directory

  ,----
  | find ~/.guix-profile/.config/emacs/libs
  | realpath ~/.guix-profile/.config/emacs/libs/org-recoll.el
  `----

  ,----
  | /home/rdrg/.guix-profile/.config/emacs/libs
  | /home/rdrg/.guix-profile/.config/emacs/libs/org-recoll.el
  |
/gnu/store/67sw7m0ww2jw6vz0phhxrj1fphlqc414-my-simple-package-org-recoll-1.0/.config/emacs/libs/org-recoll.el
  `----

  By using the following command, we can see the file structure under
  `/gnu/store'.

  ,----
  | find
/gnu/store/67sw7m0ww2jw6vz0phhxrj1fphlqc414-my-simple-package-org-recoll-1.0/
  `----

  ,----
  |
/gnu/store/67sw7m0ww2jw6vz0phhxrj1fphlqc414-my-simple-package-org-recoll-1.0/
  |
/gnu/store/67sw7m0ww2jw6vz0phhxrj1fphlqc414-my-simple-package-org-recoll-1.0/.config
  |
/gnu/store/67sw7m0ww2jw6vz0phhxrj1fphlqc414-my-simple-package-org-recoll-1.0/.config/emacs
  |
/gnu/store/67sw7m0ww2jw6vz0phhxrj1fphlqc414-my-simple-package-org-recoll-1.0/.config/emacs/libs
  |
/gnu/store/67sw7m0ww2jw6vz0phhxrj1fphlqc414-my-simple-package-org-recoll-1.0/.config/emacs/libs/org-recoll.el
  `----


3 The questions
===============

  + What changes would you do to improve the definition of the package
    that I wrote?
  + Do you manage your Emacs packages with GUIX? Could you briefly
    describe your workflow or point me to references/documentation?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]