help-guix
[Top][All Lists]
Advanced

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

Re: Newbie user: Feedback on custom package definition


From: Gary Johnson
Subject: Re: Newbie user: Feedback on custom package definition
Date: Thu, 02 Mar 2023 10:10:38 -0500

Rodrigo Morales <moralesrodrigo1100@gmail.com> writes:

> 8<-----------------------------------
> 8<    ...Text elided...
> 8<-----------------------------------
>
>
> 3 The questions
> ===============
>
>   + What changes would you do to improve the definition of the package
>     that I wrote?

Whenever possible, you should not be using the `trivial-build-system`.
Guix comes with a wealth of built-in build systems that will take care
of building and installing packages written in many different languages.
For Emacs Lisp packages, you should use the `emacs-build-system`. Here
is an example:

```
(define-public emacs-vcard
  (package
   (name "emacs-vcard")
   (version "0.2.1")
   (source
    (origin
     (method url-fetch)
     (uri (string-append
           "https://elpa.gnu.org/packages/vcard-";
           version
           ".tar"))
     (sha256
      (base32 "0nfrh1mz2h7h259kf7sj13z30kmjywfvs83ax5qjkfwxhqm03abf"))))
   (build-system emacs-build-system)
   (home-page "https://elpa.gnu.org/packages/vcard.html";)
   (synopsis "Package for handling vCard files")
   (description
    "This file contains `vcard-mode', for viewing vCard files.  Other files in 
this
package contain functions for parsing and writing vCard data.")
   (license gpl3+)))
```

This will download and validate the source, build the package, install
it under /gnu/store, and symlink it into the profile that you installed
it into. It will take care of adding these directories to these
environment variables, which ensure that Emacs can require them later:

- EMACSLOADPATH
- EMACSNATIVELOADPATH

>   + Do you manage your Emacs packages with GUIX? Could you briefly
>     describe your workflow or point me to references/documentation?

I do manage all of my Emacs packages with Guix. I list `emacs` and all
of its packages in a manifest file (emacs.scm). It looks like this with
my custom packages elided:

```
(use-modules ((gnu packages) #:select (specifications->manifest)))

(specifications->manifest
 (list "emacs"
       "emacs-adoc-mode"
       "emacs-alsamixer-el"
       "emacs-async"
       "emacs-calibredb"
       "emacs-cider"
       "emacs-clojure-mode"
       "emacs-company"
       "emacs-crdt"
       "emacs-csv-mode"
       "emacs-elpher"
       "emacs-emms"
       "emacs-eww-lnum"
       "emacs-exwm"
       "emacs-flycheck"
       "emacs-flymake-kondor"
       "emacs-flyspell-correct"
       "emacs-forge"
       "emacs-geiser"
       "emacs-geiser-guile"
       "emacs-gnuplot"
       "emacs-google-translate"
       "emacs-helm"
       "emacs-helm-ag"
       "emacs-helm-descbinds"
       "emacs-helm-swoop"
       "emacs-htmlize"
       "emacs-magit"
       "emacs-markdown-mode"
       "emacs-nov-el"
       "emacs-ob-async"
       "emacs-org"
       "emacs-org-pomodoro"
       "emacs-ox-gfm"
       "emacs-paredit"
       "emacs-pdf-tools"
       "emacs-pinentry"
       "emacs-rjsx-mode"
       "emacs-shroud"
       "emacs-telephone-line"
       "emacs-treemacs"
       "emacs-vterm"
       "emacs-web-mode"
       "emacs-which-key"
       "mu"))
```

I actually split up all the user packages on my system into manifests
and isntall each one into its own profile, which I then activate on
startup. However, that's not really necessary for this example. You can
install the manifest packages above into your user profile with this
command:

```
guix package -m emacs.scm
```

If you want to include packages that you wrote yourself, you can either
add them to your GUIX_PACKAGE_PATH environment variable or you can
create your own Guix channel, add it to your ~/.config/guix/channels.scm
file, and run `guix pull`.

To get help in writing new Guix packages for Emacs, try out the `guix
import elpa` command like so:

```
guix import elpa --archive=melpa gemini-mode
```

Alright. That's it for now. Good luck and happy hacking!

 ~Gary

-- 
Protect yourself from surveillance: https://emailselfdefense.fsf.org
=======================================================================
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

Why is HTML email a security nightmare? See https://useplaintext.email/

Please avoid sending me MS-Office attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html



reply via email to

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