all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: zimoun <zimon.toutoune@gmail.com>, 58339@debbugs.gnu.org
Subject: [bug#58339] [PATCH 2/2] gnu: Add guix-example.
Date: Thu, 06 Oct 2022 21:58:20 +0200	[thread overview]
Message-ID: <e94febb946fbcf7eb662e3e349889c978e80b604.camel@gmail.com> (raw)
In-Reply-To: <20221006163935.2282212-2-zimon.toutoune@gmail.com>

Am Donnerstag, dem 06.10.2022 um 18:39 +0200 schrieb zimoun:
> * gnu/packages/guix-extensions.scm (guix-example): New variable.
> ---
>  gnu/packages/guix-extensions.scm | 39
> +++++++++++++++++++++++++++++++-
>  1 file changed, 38 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/guix-extensions.scm b/gnu/packages/guix-
> extensions.scm
> index 6294c15f3d..6541630ddd 100644
> --- a/gnu/packages/guix-extensions.scm
> +++ b/gnu/packages/guix-extensions.scm
> @@ -19,7 +19,44 @@ (define-module (gnu packages guix-extensions)
>    #:use-module (guix gexp)
>    #:use-module (guix packages)
>    #:use-module (guix build-system trivial)
> -  #:use-module (gnu packages base))
> +  #:use-module (guix build-system guile)
> +  #:use-module (guix git-download)
> +  #:use-module (gnu packages base)
> +  #:use-module (gnu packages package-management))
> +
> +(define-public guix-example
> +  (let ((commit "d600bd742dae9df86e980a25cf1d0ac71ee01438")
> +        (revision "0"))
> +    (package
> +      (name "guix-example")
> +      (version (git-version "0" revision commit))
> +      (source
> +       (origin
> +         (method git-fetch)
> +         (uri (git-reference
> +               (url "https://gitlab.com/zimoun/guix-example")
> +               (commit commit)))
> +         (file-name (string-append name version "-checkout"))
> +         (sha256
> +          (base32
> +          
> "0s48b5a1i0vkx5lq7jn9b46zzqv2g3dli7b54sd9365dszqjqzmx"))))
> +      (build-system guile-build-system)
> +      (arguments
> +       '(#:phases (modify-phases %standard-phases
> +                    (add-after 'install 'move-to-extension-directory
> +                      (lambda* (#:key outputs #:allow-other-keys)
> +                        (let* ((out (assoc-ref outputs "out"))
> +                               (target (string-append
> +                                        out
> +                                       
> "/share/guix/extensions/example.scm")))
> +                          (mkdir-p (dirname target))
> +                          (rename-file (car (find-files out
> "example.scm"))
> +                                       target)))))))
> +      (native-inputs (list (lookup-package-input guix "guile")
> guix))
> +      (home-page "") ; Should be documentation location for
> GUIX_EXTENSIONS_PATH
Note that this example has a home-page.
> +      (synopsis "Example of Guix sub-command extension")
> +      (description "This Guix extension provides a simple example to
> extend Guix subcommands.")
> +      (license license:gpl3+))))
While Ludo said "Maybe we should just keep it as an example in the
source tree?", I'm really not sure whether that's the best course of
action.  It will simultaneously act as a package that users won't know
how to use (as evidenced by some people now and then asking how to run
gwl) *and* as not that great of an example on how to write extension,
because people only have the history of the Guix repo to go by.

For a proper guide, I think we should walk through:

1. Writing a sample extension (e.g. one simply printing hello world)
2. Testing the extension via `guix shell'
3. (Pointers on) submitting the extension to Guix proper or managing it
in one's own channel

For now, we barely cover 1.

Cheers

  reply	other threads:[~2022-10-06 19:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 16:36 [bug#58339] [PATCH 0/2] Add simple Guix extensions as example zimoun
2022-10-06 16:39 ` [bug#58339] [PATCH 1/2] gnu: Add guix-hello zimoun
2022-10-06 16:39   ` [bug#58339] [PATCH 2/2] gnu: Add guix-example zimoun
2022-10-06 19:58     ` Liliana Marie Prikler [this message]
2022-10-07  8:21       ` [bug#58339] ’guix shell’ not working with GUIX_EXTENSIONS_PATH zimoun
2022-10-07 18:21         ` Liliana Marie Prikler
2022-10-07 18:49           ` zimoun
2022-10-07 19:28             ` Liliana Marie Prikler
2022-10-08  8:35               ` zimoun
2022-10-08  9:43                 ` Liliana Marie Prikler

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

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

  git send-email \
    --in-reply-to=e94febb946fbcf7eb662e3e349889c978e80b604.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=58339@debbugs.gnu.org \
    --cc=zimon.toutoune@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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.