@@ -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 \
new file mode 100644
@@ -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+)))
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