From: zimoun <zimon.toutoune@gmail.com>
To: 58339@debbugs.gnu.org
Cc: Efraim Flashner <efraim@flashner.co.il>,
zimoun <zimon.toutoune@gmail.com>
Subject: [bug#58339] [PATCH 1/2] gnu: Add guix-hello.
Date: Thu, 6 Oct 2022 18:39:34 +0200 [thread overview]
Message-ID: <20221006163935.2282212-1-zimon.toutoune@gmail.com> (raw)
In-Reply-To: <20221006163609.2280960-1-zimon.toutoune@gmail.com>
From: Efraim Flashner <efraim@flashner.co.il>
* gnu/packages/guix-extensions.scm (guix-hello): New variable.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add guix-extensions.
Co-authored-by: zimoun <zimon.toutoune@gmail.com>
---
gnu/local.mk | 1 +
gnu/packages/guix-extensions.scm | 60 ++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+)
create mode 100644 gnu/packages/guix-extensions.scm
diff --git a/gnu/local.mk b/gnu/local.mk
index 5976cbe90c..7bf1c34995 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -299,6 +299,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/guile.scm \
%D%/packages/guile-wm.scm \
%D%/packages/guile-xyz.scm \
+ %D%/packages/guix-extensions.scm \
%D%/packages/gv.scm \
%D%/packages/gxmessage.scm \
%D%/packages/hardware.scm \
diff --git a/gnu/packages/guix-extensions.scm b/gnu/packages/guix-extensions.scm
new file mode 100644
index 0000000000..6294c15f3d
--- /dev/null
+++ b/gnu/packages/guix-extensions.scm
@@ -0,0 +1,60 @@
+;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2022 Simon Tournier <zimon.toutoune@gmail.com>
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages guix-extensions)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix gexp)
+ #:use-module (guix packages)
+ #:use-module (guix build-system trivial)
+ #:use-module (gnu packages base))
+
+(define-public guix-hello
+ (package
+ (name "guix-hello")
+ (version "0")
+ (source #f)
+ (build-system trivial-build-system)
+ (arguments
+ (list
+ #:modules '((guix build utils))
+ #:builder
+ #~(begin
+ (use-modules (guix build utils))
+ (let ((dest (string-append #$output
+ "/share/guix/extensions/hello.scm"))
+ (hello #$(this-package-input "hello")))
+ (mkdir-p (dirname dest))
+ (with-output-to-file dest
+ (lambda ()
+ (format #t
+ "(define-module (guix extensions hello)~@
+ #:use-module (guix scripts)~@
+ #:export (guix-hello))~@
+~@
+(define-command (guix-hello . args)~@
+ (category extension)~@
+ (synopsis \"world\")~@
+ (apply system* \"~a/bin/hello\" args))~%"
+ hello)))))))
+ (home-page "") ; Should be documentation location for GUIX_EXTENSIONS_PATH
+ (inputs
+ (list hello))
+ (synopsis "Example of Guix sub-command extension")
+ (description "This Guix extension provides a shell redirection from
+@code{guix hello} to @code{hello}.")
+ ;; The package definition is longer than the code;
+ ;; let this serve as the declaration of the license.
+ (license license:gpl3+)))
--
2.36.0
next prev parent reply other threads:[~2022-10-06 17:36 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 ` zimoun [this message]
2022-10-06 16:39 ` [bug#58339] [PATCH 2/2] gnu: Add guix-example zimoun
2022-10-06 19:58 ` Liliana Marie Prikler
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
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=20221006163935.2282212-1-zimon.toutoune@gmail.com \
--to=zimon.toutoune@gmail.com \
--cc=58339@debbugs.gnu.org \
--cc=efraim@flashner.co.il \
/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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
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).