guix-patches
[Top][All Lists]
Advanced

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

[bug#76699] [PATCH 4/5] Use a development channel instead of guix.scm


From: Nicolas Graves
Subject: [bug#76699] [PATCH 4/5] Use a development channel instead of guix.scm
Date: Mon, 3 Mar 2025 03:09:19 +0100

---
 .guix-channel                              |   3 +
 guix.scm => channel/emacs-guix-channel.scm |  69 ++++++--------
 channel/emacs-guix-channel.scm.next        | 104 +++++++++++++++++++++
 3 files changed, 137 insertions(+), 39 deletions(-)
 create mode 100644 .guix-channel
 rename guix.scm => channel/emacs-guix-channel.scm (50%)
 create mode 100644 channel/emacs-guix-channel.scm.next

diff --git a/.guix-channel b/.guix-channel
new file mode 100644
index 0000000..bb2ac66
--- /dev/null
+++ b/.guix-channel
@@ -0,0 +1,3 @@
+(channel
+ (version 0)
+ (directory "channel"))
diff --git a/guix.scm b/channel/emacs-guix-channel.scm
similarity index 50%
rename from guix.scm
rename to channel/emacs-guix-channel.scm
index d35b0ba..ea8a6e7 100644
--- a/guix.scm
+++ b/channel/emacs-guix-channel.scm
@@ -2,6 +2,7 @@
 
 ;; Copyright © 2017 Alex Kost <alezost@gmail.com>
 ;; Copyright © 2019 Oleg Pykhalov <go.wigust@gmail.com>
+;; Copyright © 2025 Nicolas Graves <ngraves@ngraves.fr>
 
 ;; This file is part of Emacs-Guix.
 
@@ -21,72 +22,62 @@
 ;;; Commentary:
 
 ;; This file contains Guix package for development version of
-;; Emacs-Guix.  To build or install, run:
+;; Emacs-Guix.  To build it, you need guile-git in your profile.
+;; Then, in the parent directory, run or install:
 ;;
-;;   guix build --file=guix.scm
-;;   guix package --install-from-file=guix.scm
+;;   guix build -L channel emacs-guix-devel
+;;   guix install -L channel emacs-guix-devel
 
 ;; The main purpose of this file though is to make a development
 ;; environment for building Emacs-Guix:
 ;;
-;;   guix environment --pure --load=guix.scm
+;;   guix shell -L channel -D --pure emacs-guix-devel
 ;;   ./autogen.sh
 ;;   ./configure
 ;;   make
 
 ;;; Code:
 
+(define-module (emacs-guix-channel))
+
 (use-modules
+ (git)
  (ice-9 popen)
  (ice-9 rdelim)
  (guix build utils)
  (guix gexp)
  (guix git-download)
  (guix packages)
+ (guix utils)
  (gnu packages autotools)
  (gnu packages emacs)
  (gnu packages emacs-xyz)
+ (gnu packages guile-xyz)
  (gnu packages pkg-config)
  (gnu packages texinfo))
 
-(define %source-dir (dirname (current-filename)))
-
-(define (git-output . args)
-  "Execute 'git ARGS ...' command and return its output without trailing
-newspace."
-  (with-directory-excursion %source-dir
-    (let* ((port   (apply open-pipe* OPEN_READ "git" args))
-           (output (read-string port)))
-      (close-pipe port)
-      (string-trim-right output #\newline))))
-
-(define (current-commit)
-  (git-output "log" "-n" "1" "--pretty=format:%H"))
-
-(define emacs-guix-devel
-  (let ((commit (current-commit)))
+(define-public emacs-guix/devel
+  (let* ((source-dir (dirname (dirname (current-filename))))
+         (repo (repository-open source-dir))
+         (commit (oid->string (object-id (revparse-single repo "HEAD")))))
     (package
       (inherit emacs-guix)
-      (version (string-append (package-version emacs-guix)
-                              "-" (string-take commit 7)))
-      (source (local-file %source-dir
+      (name "emacs-guix-devel")
+      (version (string-append
+                (string-drop-right (package-version emacs-guix) 7)
+                (string-take commit 7)))
+      (source (local-file source-dir
                           #:recursive? #t
-                          #:select? (git-predicate %source-dir)))
+                          #:select? (git-predicate source-dir)))
       (arguments
-       (append (package-arguments emacs-guix)
-               '(#:phases
-                 (modify-phases %standard-phases
-                   (add-after 'unpack 'autogen
-                     (lambda _ (zero? (system* "sh" "autogen.sh"))))))))
-      (native-inputs
-       `(("pkg-config" ,pkg-config)
-         ;; 'emacs-minimal' does not find Emacs packages (this is for
-         ;; "guix environment").
-         ("emacs" ,emacs-no-x)
-         ("autoconf" ,autoconf)
-         ("automake" ,automake)
-         ("texinfo" ,texinfo))))))
-
-emacs-guix-devel
+       (substitute-keyword-arguments (package-arguments emacs-guix)
+         ((#:phases phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'autogen
+                (lambda _ (zero? (system* "sh" "autogen.sh"))))))))
+      (propagated-inputs
+       (modify-inputs  (package-propagated-inputs emacs-guix)
+         (replace "emacs-dash" emacs-llama)
+         (replace "emacs-magit-popup" emacs-transient))))))
 
 ;;; guix.scm ends here
diff --git a/channel/emacs-guix-channel.scm.next 
b/channel/emacs-guix-channel.scm.next
new file mode 100644
index 0000000..58a2a44
--- /dev/null
+++ b/channel/emacs-guix-channel.scm.next
@@ -0,0 +1,104 @@
+;;; guix.scm --- Guix package for Emacs-Guix
+
+;; Copyright © 2017 Alex Kost <alezost@gmail.com>
+;; Copyright © 2019 Oleg Pykhalov <go.wigust@gmail.com>
+;; Copyright © 2025 Nicolas Graves <ngraves@ngraves.fr>
+
+;; This file is part of Emacs-Guix.
+
+;; Emacs-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.
+;;
+;; Emacs-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 Emacs-Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This file contains Guix package for development version of
+;; Emacs-Guix.  To build or install, run:
+;;
+;;   guix build --file=guix.scm
+;;   guix package --install-from-file=guix.scm
+
+;; The main purpose of this file though is to make a development
+;; environment for building Emacs-Guix:
+;;
+;;   guix environment --pure --load=guix.scm
+;;   ./autogen.sh
+;;   ./configure
+;;   make
+
+;;; Code:
+
+(define-module (emacs-guix-channel))
+
+(use-modules
+ (git)
+ (ice-9 match)
+ (ice-9 popen)
+ (ice-9 rdelim)
+ (guix build utils)
+ (guix gexp)
+ (guix git-download)
+ (guix packages)
+ (guix profiles)
+ (gnu packages autotools)
+ (gnu packages emacs)
+ (gnu packages emacs-xyz)
+ (rde packages emacs-xyz)
+ (gnu packages guile)
+ (gnu packages guile-xyz)
+ (rde packages guile-xyz)
+ (gnu packages package-management)
+ (gnu packages pkg-config)
+ (gnu packages terminals)
+ (gnu packages texinfo))
+
+(define guix-with-guile-next
+  ((package-input-rewriting/spec `(("guile" . ,(const guile-next)))) guix))
+
+(define emacs-guix/devel
+  (let* ((source-dir (dirname (dirname (current-filename))))
+         (repo (repository-open source-dir))
+         (commit (oid->string
+                  (object-id (revparse-single repo "HEAD")))))
+    (package
+      (inherit emacs-guix)
+      (name "emacs-guix-arei")
+      (version (string-append
+                (string-drop-right (package-version emacs-guix) 7)
+                (string-take commit 7)))
+      (source (local-file source-dir
+                          #:recursive? #t
+                          #:select? (git-predicate source-dir)))
+      ;; (arguments
+      ;;  (append (package-arguments emacs-guix)
+      ;;          '(#:phases
+      ;;            (modify-phases %standard-phases
+      ;;              (add-after 'unpack 'autogen
+      ;;                (lambda _ (zero? (system* "sh" "autogen.sh"))))))))
+      (inputs
+       (modify-inputs (package-inputs emacs-guix)
+         (replace "guile" guile-next)
+         (append guile-ares-rs-latest)
+         (append foot)))
+      (propagated-inputs
+       (modify-inputs  (package-propagated-inputs emacs-guix)
+         (append emacs-arei-latest))))))
+
+(match (cdr (command-line))
+  (("build" . rest) emacs-guix/devel)
+  ;; (("shell" "-D" . rest) )
+  ;; (("shell" . rest) (specifications->manifest (list "emacs-guix/devel")))
+  (otherwise (package->development-manifest emacs-guix/devel)
+             ;; (error (format #f "Unable to handle ~a!" otherwise))
+             ))
+
+;;; guix.scm ends here
-- 
2.48.1






reply via email to

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