unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Gary Johnson <lambdatronic@disroot.org>
To: Rodrigo Morales <moralesrodrigo1100@gmail.com>
Cc: help-guix@gnu.org
Subject: Re: Newbie user: Feedback on custom package definition
Date: Thu, 02 Mar 2023 10:10:38 -0500	[thread overview]
Message-ID: <87sfen9nma.fsf@disroot.org> (raw)
In-Reply-To: <CAGxMbPZEpgzbT4PMU3xVtFJuQ1MtnLSRK2JmZ8DfKAJ0W46gDQ@mail.gmail.com>

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


  parent reply	other threads:[~2023-03-02 15:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-28 22:06 Newbie user: Feedback on custom package definition Rodrigo Morales
2023-03-01  1:12 ` 宋文武
2023-03-02 15:10 ` Gary Johnson [this message]
2023-03-02 18:54   ` Vagrant Cascadian
2023-03-02 19:57     ` (
2023-03-07 13:41       ` Simon Tournier

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=87sfen9nma.fsf@disroot.org \
    --to=lambdatronic@disroot.org \
    --cc=help-guix@gnu.org \
    --cc=moralesrodrigo1100@gmail.com \
    /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.
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).