GNU bug report logs - #33753
[PATCH 1/3] gnu: Add stumpwm-contrib.

Previous Next

Package: guix-patches;

Reported by: Nam Nguyen <namn <at> berkeley.edu>

Date: Sat, 15 Dec 2018 02:07:01 UTC

Severity: normal

Tags: patch

Done: Oleg Pykhalov <go.wigust <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33753 in the body.
You can then email your comments to 33753 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Sat, 15 Dec 2018 02:07:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nam Nguyen <namn <at> berkeley.edu>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 15 Dec 2018 02:07:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nam Nguyen <namn <at> berkeley.edu>
To: guix-patches <at> gnu.org
Cc: Nam Nguyen <namn <at> berkeley.edu>
Subject: [PATCH 1/3] gnu: Add stumpwm-contrib.
Date: Fri, 14 Dec 2018 18:06:00 -0800
* gnu/packages/lisp.scm (stumpwm-contrib): New variable.
---
 gnu/packages/lisp.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index d1c0a2ef3..b9e6c0e42 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2018 Alex Vong <alexvong1995 <at> gmail.com>
 ;;; Copyright © 2018 Pierre Neidhardt <mail <at> ambrevar.xyz>
 ;;; Copyright © 2018 Pierre Langlois <pierre.langlois <at> gmx.com>
+;;; Copyright © 2018 Nam Nguyen <namn <at> berkeley.edu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -991,6 +992,41 @@ productive, customizable lisp based systems.")
     (inherit (sbcl-package->cl-source-package stumpwm))
     (name "cl-stumpwm")))
 
+(define stumpwm-contrib
+  (let ((commit "bd47cec14f7299711ac29468d2e1364d38a81bee")
+        (revision "1"))
+    (package
+      (name "stumpwm-contrib")
+      (version (git-version "0.0.1" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/stumpwm/stumpwm-contrib.git")
+               (commit commit)))
+         (file-name (string-append name "-" version "-checkout"))
+         (sha256
+          (base32 "0kh9vpmxssjvxgvl6ihpn0qh4l660n64iq80ivhagdvr8s045ddj"))))
+      (inputs
+       `(("stumpwm" ,stumpwm "lib")))
+      (build-system asdf-build-system/sbcl)
+      (arguments
+       '(#:phases
+         ;; Make stumpwm-contrib more modular.  Child modules must copy
+         ;; their source to $(out)/share/common-lisp/stumpwm-contrib.
+         (modify-phases %standard-phases
+           (add-after 'check 'delete-plugins
+             (lambda* (#:key outputs #:allow-other-keys)
+               (delete-file-recursively
+                (string-append (assoc-ref outputs "out")
+                               "/share/common-lisp/sbcl-source"))
+               #t)))))
+      (home-page "https://github.com/stumpwm/stumpwm-contrib")
+      (synopsis "Collection of StumpWM modules")
+      (description "Modules are a way to extend StumpWM using Lisp
+code.")
+      (license (list license:gpl2+ license:gpl3+ license:bsd-2)))))
+
 ;; The slynk that users expect to install includes all of slynk's contrib
 ;; modules.  Therefore, we build the base module and all contribs first; then
 ;; we expose the union of these as `sbcl-slynk'.  The following variable
-- 
2.20.0





Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Sat, 15 Dec 2018 02:10:02 GMT) Full text and rfc822 format available.

Message #8 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Nam Nguyen <namn <at> berkeley.edu>
To: 33753 <at> debbugs.gnu.org
Cc: Nam Nguyen <namn <at> berkeley.edu>
Subject: [PATCH 2/3] gnu: Add stumpwm-cpu.
Date: Fri, 14 Dec 2018 18:09:07 -0800
* gnu/packages/lisp.scm (stumpwm-cpu): New variable.
---
 gnu/packages/lisp.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index b9e6c0e42..308159982 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -1027,6 +1027,32 @@ productive, customizable lisp based systems.")
 code.")
       (license (list license:gpl2+ license:gpl3+ license:bsd-2)))))
 
+(define-public stumpwm-cpu
+  (package (inherit stumpwm-contrib)
+    (name "stumpwm-cpu")
+    (arguments
+     (let ((cat "modeline")
+           (mod "cpu"))
+       (substitute-keyword-arguments (package-arguments stumpwm-contrib)
+         ((#:asd-file _ "") (string-append cat "/" mod "/" mod ".asd"))
+         ((#:asd-system-name _ #f) mod)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-before 'delete-plugins 'copy-plugin-source
+               (lambda* (#:key outputs #:allow-other-keys)
+                 (let* ((out (assoc-ref outputs "out"))
+                        (clisp (string-append out "/share/common-lisp"))
+                        (source (string-append clisp "/sbcl-source/"
+                                               ,mod "/" ,cat "/" ,mod))
+                        (dest (string-append clisp "/stumpwm-contrib/"
+                                             ,mod)))
+                   (mkdir-p dest)
+                   (copy-recursively source dest))
+                 #t)))))))
+    (synopsis "Add CPU info to the StumpWM modeline")
+    (description "Add CPU info to the StumpWM modeline.")
+    (license license:gpl3+)))
+
 ;; The slynk that users expect to install includes all of slynk's contrib
 ;; modules.  Therefore, we build the base module and all contribs first; then
 ;; we expose the union of these as `sbcl-slynk'.  The following variable
-- 
2.20.0





Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Sat, 15 Dec 2018 02:10:03 GMT) Full text and rfc822 format available.

Message #11 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Nam Nguyen <namn <at> berkeley.edu>
To: 33753 <at> debbugs.gnu.org
Cc: Nam Nguyen <namn <at> berkeley.edu>
Subject: [PATCH 3/3] gnu: emacs-stumpwm-mode: Use source and version of
 stumpwm-cpu.
Date: Fri, 14 Dec 2018 18:09:08 -0800
* gnu/packages/emacs.scm (emacs-stumpwm-mode): Use source and version of stumpwm-cpu.
---
 gnu/packages/emacs.scm | 44 ++++++++++++++++--------------------------
 1 file changed, 17 insertions(+), 27 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 358f32cab..07d2c2104 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -122,6 +122,7 @@
   #:use-module (gnu packages video)
   #:use-module (gnu packages haskell)
   #:use-module (gnu packages wordnet)
+  #:use-module (gnu packages lisp)
   #:use-module (guix utils)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match))
@@ -10822,33 +10823,22 @@ bookmarks and history.")
       (license license:gpl3+))))
 
 (define-public emacs-stumpwm-mode
-  (let ((commit "8fbe071d2c6c040794060a354eb377218dc10b35")
-        (revision "1"))
-    (package
-      (name "emacs-stumpwm-mode")
-      (version (string-append "0.0.1-" revision "."
-                              (string-take commit 7)))
-      (source (origin
-                (method git-fetch)
-                (uri (git-reference
-                      (url "https://github.com/stumpwm/stumpwm-contrib.git")
-                      (commit commit)))
-                (file-name (string-append name "-" version "-checkout"))
-                (sha256
-                 (base32
-                  "1dfwsvz1c8w6j4jp0kzaz78ml3f5dp0a5pvf090kwpbpg176r7iq"))))
-      (build-system emacs-build-system)
-      (arguments
-       `(#:phases
-         (modify-phases %standard-phases
-           (add-after 'unpack 'chdir-elisp
-             ;; Elisp directory is not in root of the source.
-             (lambda _
-               (chdir "util/swm-emacs"))))))
-      (home-page "https://github.com/stumpwm/stumpwm-contrib")
-      (synopsis "Emacs minor-mode for Stumpwm")
-      (description "Emacs minor-mode for Stumpwm")
-      (license license:gpl3+))))
+  (package
+    (name "emacs-stumpwm-mode")
+    (version (package-version stumpwm-cpu))
+    (source (package-source stumpwm-cpu))
+    (build-system emacs-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir-elisp
+           ;; Elisp directory is not in root of the source.
+           (lambda _
+             (chdir "util/swm-emacs"))))))
+    (home-page "https://github.com/stumpwm/stumpwm-contrib")
+    (synopsis "Emacs minor-mode for Stumpwm")
+    (description "Emacs minor-mode for Stumpwm")
+    (license license:gpl3+)))
 
 (define-public emacs-irfc
   (package
-- 
2.20.0





Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Sat, 15 Dec 2018 02:52:01 GMT) Full text and rfc822 format available.

Message #14 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Nam Nguyen <namn <at> berkeley.edu>
To: 33753 <at> debbugs.gnu.org
Subject: stumpwm-contrib
Date: Fri, 14 Dec 2018 18:50:31 -0800
I am trying to make stumpwm-contrib less of a "grab bag" and more modular
and well-tested by breaking all the stumpwm extensions/modules into
separate recipes.

stumpwm-contrib deletes the source code and child
recipes copies their source code from their directory to
$(out)/share/common-lisp/stumpwm-contrib.

To test this, install stumpwm and stumpwm-cpu.

~/.stumpwmrc
********************************************************************************
(set-module-dir "~/.guix-profile/share/common-lisp/sbcl-bundle-systems")
(load-module "cpu")

(setf *screen-mode-line-format* '("%c %C %t %f [%n] %W"))

;; %c (CPU usage as %)
;; %C (CPU usage as bar graph)
;; %t (CPU temperature)
;; %f (CPU frequency)
********************************************************************************

To toggle the mode-line:
C-t semicolon mode-line <RET>

I violated the "Don't Repeat Yourself" (DRY) principle and have
stumpwm-{battery-portable,cpu,mem,pinentry,winner-mode} all tested and
working. I will postpone submission of those until stumpwm-cpu has been
accepted. All these submodules are nearly identical with only different
cat and mod variables. pinentry has some additional inputs. This results
in a lot of repeated code that looks nearly identical to stumpwm-cpu.

Another concern I had was for ~/.stumpwmrc, including sbcl-bundle-systems
(which contains symlinks to the compiled code) is necessary for
stumpwm-pinentry to work correctly. The other plugins can just use the
stumpwm-contrib directory I created.

;; (set-module-dir "~/.guix-profile/share/common-lisp/stumpwm-contrib")
(set-module-dir "~/.guix-profile/share/common-lisp/sbcl-bundle-systems")

Documentation (org-mode files) can be found in the stumpwm-contrib
directory.

Here is the general directory structure:
********************************************************************************
/home/user/.guix-profile/share/common-lisp:
 .
 ..
 sbcl-bundle-systems
 stumpwm-contrib

/home/user/.guix-profile/share/common-lisp/sbcl-bundle-systems:
 .
 ..
 battery-portable.asd -> /gnu/store/...-stumpwm-battery-portable-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/battery-portable.asd
 cpu.asd -> /gnu/store/...-stumpwm-cpu-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/cpu.asd
 mem.asd -> /gnu/store/...-stumpwm-mem-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/mem.asd
 pinentry.asd -> /gnu/store/...-stumpwm-pinentry-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/pinentry.asd
 swm-gaps.asd -> /gnu/store/...-stumpwm-gaps-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/swm-gaps.asd
 winner-mode.asd -> /gnu/store/...-stumpwm-winner-mode-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/winner-mode.asd

/home/user/.guix-profile/share/common-lisp/stumpwm-contrib:
 .
 ..
 battery-portable -> /gnu/store/...-stumpwm-battery-portable-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/battery-portable
 cpu -> /gnu/store/...-stumpwm-cpu-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/cpu
 mem -> /gnu/store/...-stumpwm-mem-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/mem
 pinentry -> /gnu/store/...-stumpwm-pinentry-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/pinentry
 swm-gaps -> /gnu/store/...-stumpwm-gaps-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/swm-gaps
 winner-mode -> /gnu/store/...-stumpwm-winner-mode-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/winner-mode

/home/user/.guix-profile/share/common-lisp/stumpwm-contrib/cpu:
 .
 ..
 cpu.asd
 cpu.lisp
 package.lisp
 README.org
********************************************************************************

Summary of questions:
1. Should the entire repository be bundled together instead of breaking
it into individual modules?
2. Should asdf-build-system/source be used instead of sbcl?  I had initially
copied the entire repository with all the source code, and it still worked.
3. Is there a way to by more DRY?
4. Should the stumpwm-contrib directory be named sbcl-sources (can't
recall the default directory of asdf-build-system/source)?




Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Fri, 21 Dec 2018 17:08:02 GMT) Full text and rfc822 format available.

Message #17 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Nam Nguyen <namn <at> berkeley.edu>
Cc: Christopher Lemmer Webber <cwebber <at> dustycloud.org>,
 Pierre Neidhardt <mail <at> ambrevar.xyz>, 33753 <at> debbugs.gnu.org
Subject: Re: [bug#33753] stumpwm-contrib
Date: Fri, 21 Dec 2018 18:06:57 +0100
Hello!

Pierre, Chris: could you provide feedback to Nam?  I don’t use Stump
(yet!) so I wouldn’t know what to suggest.

  https://issues.guix.info/issue/33753

Thanks,
Ludo’.

Nam Nguyen <namn <at> berkeley.edu> skribis:

> I am trying to make stumpwm-contrib less of a "grab bag" and more modular
> and well-tested by breaking all the stumpwm extensions/modules into
> separate recipes.
>
> stumpwm-contrib deletes the source code and child
> recipes copies their source code from their directory to
> $(out)/share/common-lisp/stumpwm-contrib.
>
> To test this, install stumpwm and stumpwm-cpu.
>
> ~/.stumpwmrc
> ********************************************************************************
> (set-module-dir "~/.guix-profile/share/common-lisp/sbcl-bundle-systems")
> (load-module "cpu")
>
> (setf *screen-mode-line-format* '("%c %C %t %f [%n] %W"))
>
> ;; %c (CPU usage as %)
> ;; %C (CPU usage as bar graph)
> ;; %t (CPU temperature)
> ;; %f (CPU frequency)
> ********************************************************************************
>
> To toggle the mode-line:
> C-t semicolon mode-line <RET>
>
> I violated the "Don't Repeat Yourself" (DRY) principle and have
> stumpwm-{battery-portable,cpu,mem,pinentry,winner-mode} all tested and
> working. I will postpone submission of those until stumpwm-cpu has been
> accepted. All these submodules are nearly identical with only different
> cat and mod variables. pinentry has some additional inputs. This results
> in a lot of repeated code that looks nearly identical to stumpwm-cpu.
>
> Another concern I had was for ~/.stumpwmrc, including sbcl-bundle-systems
> (which contains symlinks to the compiled code) is necessary for
> stumpwm-pinentry to work correctly. The other plugins can just use the
> stumpwm-contrib directory I created.
>
> ;; (set-module-dir "~/.guix-profile/share/common-lisp/stumpwm-contrib")
> (set-module-dir "~/.guix-profile/share/common-lisp/sbcl-bundle-systems")
>
> Documentation (org-mode files) can be found in the stumpwm-contrib
> directory.
>
> Here is the general directory structure:
> ********************************************************************************
> /home/user/.guix-profile/share/common-lisp:
>  .
>  ..
>  sbcl-bundle-systems
>  stumpwm-contrib
>
> /home/user/.guix-profile/share/common-lisp/sbcl-bundle-systems:
>  .
>  ..
>  battery-portable.asd -> /gnu/store/...-stumpwm-battery-portable-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/battery-portable.asd
>  cpu.asd -> /gnu/store/...-stumpwm-cpu-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/cpu.asd
>  mem.asd -> /gnu/store/...-stumpwm-mem-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/mem.asd
>  pinentry.asd -> /gnu/store/...-stumpwm-pinentry-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/pinentry.asd
>  swm-gaps.asd -> /gnu/store/...-stumpwm-gaps-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/swm-gaps.asd
>  winner-mode.asd -> /gnu/store/...-stumpwm-winner-mode-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/winner-mode.asd
>
> /home/user/.guix-profile/share/common-lisp/stumpwm-contrib:
>  .
>  ..
>  battery-portable -> /gnu/store/...-stumpwm-battery-portable-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/battery-portable
>  cpu -> /gnu/store/...-stumpwm-cpu-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/cpu
>  mem -> /gnu/store/...-stumpwm-mem-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/mem
>  pinentry -> /gnu/store/...-stumpwm-pinentry-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/pinentry
>  swm-gaps -> /gnu/store/...-stumpwm-gaps-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/swm-gaps
>  winner-mode -> /gnu/store/...-stumpwm-winner-mode-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/winner-mode
>
> /home/user/.guix-profile/share/common-lisp/stumpwm-contrib/cpu:
>  .
>  ..
>  cpu.asd
>  cpu.lisp
>  package.lisp
>  README.org
> ********************************************************************************
>
> Summary of questions:
> 1. Should the entire repository be bundled together instead of breaking
> it into individual modules?
> 2. Should asdf-build-system/source be used instead of sbcl?  I had initially
> copied the entire repository with all the source code, and it still worked.
> 3. Is there a way to by more DRY?
> 4. Should the stumpwm-contrib directory be named sbcl-sources (can't
> recall the default directory of asdf-build-system/source)?




Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Fri, 21 Dec 2018 18:19:01 GMT) Full text and rfc822 format available.

Message #20 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Christopher Lemmer Webber <cwebber <at> dustycloud.org>,
 Nam Nguyen <namn <at> berkeley.edu>, 33753 <at> debbugs.gnu.org
Subject: Re: [bug#33753] stumpwm-contrib
Date: Fri, 21 Dec 2018 19:18:13 +0100
[Message part 1 (text/plain, inline)]
Hi Nam,

Well, I don't use StumpWM (I'm on EXWM) but I know the ASDF build system, so
maybe I can help a bit.

> : 1. Should the entire repository be bundled together instead of breaking
> : it into individual modules?

One package per .asd.

> : 2. Should asdf-build-system/source be used instead of sbcl?  I had initially
> : copied the entire repository with all the source code, and it still worked.

No, since StumpWM only supports sbcl, stick to the sbcl build system.

> : 3. Is there a way to by more DRY?

I haven't looked into the details, but you could probably use a a function /
macro to define those packages.
Lots of other packages do this, e.g. linux, gcc, clang, etc.

> : 4. Should the stumpwm-contrib directory be named sbcl-sources (can't
> : recall the default directory of asdf-build-system/source)?

Sorry, which directory exactly?

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Mon, 24 Dec 2018 09:22:01 GMT) Full text and rfc822 format available.

Message #23 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Nam Nguyen <namn <at> berkeley.edu>
To: 33753 <at> debbugs.gnu.org
Cc: Nam Nguyen <namn <at> berkeley.edu>
Subject: [PATCH 1/3] gnu: Add stumpwm modules.
Date: Mon, 24 Dec 2018 01:21:23 -0800
* gnu/packages/lisp.scm (stumpwm-contrib, stumpwm-module)
  (stumpwm-cpu, stumpwm-mem, stumpwm-hostname, stumpwm-battery-portable)
  (stumpwm-winner-mode, stumpwm-swm-gaps)
  (stumpwm-pinentry): New variables.
---
 gnu/packages/lisp.scm | 111 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 111 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 261e720e2..711c57cbc 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2018 Alex Vong <alexvong1995 <at> gmail.com>
 ;;; Copyright © 2018 Pierre Neidhardt <mail <at> ambrevar.xyz>
 ;;; Copyright © 2018 Pierre Langlois <pierre.langlois <at> gmx.com>
+;;; Copyright © 2018 Nam Nguyen <namn <at> berkeley.edu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1032,6 +1033,116 @@ productive, customizable lisp based systems.")
     (inherit (sbcl-package->cl-source-package stumpwm))
     (name "cl-stumpwm")))
 
+(define stumpwm-contrib
+  (let ((commit "bd47cec14f7299711ac29468d2e1364d38a81bee")
+        (revision "1"))
+    (package
+      (name "stumpwm-contrib")
+      (version (git-version "0.0.1" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/stumpwm/stumpwm-contrib.git")
+               (commit commit)))
+         (file-name (string-append name "-" version "-checkout"))
+         (sha256
+          (base32
+           "0kh9vpmxssjvxgvl6ihpn0qh4l660n64iq80ivhagdvr8s045ddj"))))
+      (inputs
+       `(("stumpwm" ,stumpwm "lib")))
+      (build-system asdf-build-system/sbcl)
+      (arguments
+       '(#:tests? #f ; No tests exist.
+         #:phases
+         (modify-phases %standard-phases
+           ;; Delete all sources.
+           (add-after 'check 'delete-modules
+             (lambda* (#:key outputs #:allow-other-keys)
+               (delete-file-recursively
+                (string-append (assoc-ref outputs "out")
+                               "/share/common-lisp/sbcl-source"))
+               #t)))))
+      (home-page "https://github.com/stumpwm/stumpwm-contrib")
+      (synopsis "Collection of StumpWM modules")
+      (description "Modules are a way to extend StumpWM using Lisp
+code.")
+      (license (list license:gpl2+      ; TODO: swm-gaps Missing license?
+                     license:gpl3+      ; cpu, mem, battery-portable,
+                                        ; winner-mode, pinentry
+                     license:bsd-2))))) ; hostname
+
+(define* (stumpwm-module mod cat syn desc)
+  (package (inherit stumpwm-contrib)
+    (name (string-append "stumpwm-" mod))
+    (arguments
+     (substitute-keyword-arguments (package-arguments stumpwm-contrib)
+       ((#:asd-file _ "") (string-append cat "/" mod "/" mod ".asd"))
+       ((#:asd-system-name _ #f) mod)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           ;; Keep module's sources.
+           (add-before 'delete-modules 'copy-module-sources
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (clisp (string-append out "/share/common-lisp"))
+                      (source (string-append clisp "/sbcl-source/"
+                                             ,mod "/" ,cat "/" ,mod))
+                      (dest (string-append clisp "/stumpwm-contrib/"
+                                           ,mod)))
+                 (mkdir-p dest)
+                 (copy-recursively source dest))
+               #t))))))
+    (synopsis syn)
+    (description desc)))
+
+(define-public stumpwm-cpu
+  (stumpwm-module "cpu" "modeline"
+                  "Display CPU info"
+                  "Display CPU info in the StumpWM modeline."))
+
+(define-public stumpwm-mem
+  (stumpwm-module "mem" "modeline"
+                  "Display memory info"
+                  "Display memory info in the StumpWM modeline."))
+
+(define-public stumpwm-hostname
+  (stumpwm-module "hostname" "modeline"
+                  "Display hostname"
+                  "Display hostname in the StumpWM modeline."))
+
+(define-public stumpwm-battery-portable
+  (stumpwm-module "battery-portable" "modeline"
+                  "Display laptop battery info"
+                  "Display laptop battery info in the StumpWM
+modeline."))
+
+(define-public stumpwm-winner-mode
+  (stumpwm-module "winner-mode" "util"
+                  "Emacs' winner-mode for StumpWM"
+                  "Winner mode records changes in the window
+configuration so that changes can be undone.  It hooks into StumpWM to
+dump layouts.  This only works per group."))
+
+(define-public stumpwm-swm-gaps
+  (stumpwm-module "swm-gaps" "util"
+                  "Pretty (useless) gaps for StumpWM"
+                  "Add gaps to StumpWM running along various borders."))
+
+(define-public stumpwm-pinentry
+  (let ((pinentry (stumpwm-module "pinentry" "util"
+                                  "Integrate GnuPG Agent with StumpWM"
+                                  "GnuPG Agent uses
+@code{stumpwm-pinentry} to ask for your password.")))
+    (package (inherit pinentry)
+      (inputs
+       `(("sbcl-cffi" ,sbcl-cffi)
+         ("sbcl-usocket-server" ,sbcl-usocket-server)
+         ("sbcl-percent-encoding" ,sbcl-percent-encoding)
+         ,@(package-inputs stumpwm-contrib)))
+      (propagated-inputs
+       `(("netcat" ,netcat))))))
+
 ;; The slynk that users expect to install includes all of slynk's contrib
 ;; modules.  Therefore, we build the base module and all contribs first; then
 ;; we expose the union of these as `sbcl-slynk'.  The following variable
-- 
2.20.1





Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Mon, 24 Dec 2018 09:22:02 GMT) Full text and rfc822 format available.

Message #26 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Nam Nguyen <namn <at> berkeley.edu>
To: 33753 <at> debbugs.gnu.org
Cc: Nam Nguyen <namn <at> berkeley.edu>
Subject: [PATCH 2/3] gnu: Add sbcl-percent-encoding.
Date: Mon, 24 Dec 2018 01:21:24 -0800
* gnu/packages/lisp.scm (sbcl-percent-encoding): New variable.
---
 gnu/packages/lisp.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 711c57cbc..84da001b2 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -1502,6 +1502,30 @@ the string into one of the standard Common Lisp number types, if possible, or
 else @code{parse-number} signals an error of type @code{invalid-number}.")
     (license license:bsd-3)))
 
+(define-public sbcl-percent-encoding
+  (package
+    (name "sbcl-percent-encoding")
+    (version "20121013")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://beta.quicklisp.org/archive/percent-encoding/"
+                           "2012-10-13/percent-encoding-"
+                           version "-git.tgz"))
+       (sha256
+        (base32
+         "1dlf77c1iha1d7h6fzmv090mf8p6w20fqjrd5zcbh2kiicyabhfb"))))
+    (inputs
+     `(("sbcl-anaphora" ,sbcl-anaphora)
+       ("sbcl-babel" ,sbcl-babel)
+       ("sbcl-fiveam" ,sbcl-fiveam)))
+    (build-system asdf-build-system/sbcl)
+    (home-page "https://common-lisp.net/project/percent-encoding/")
+    (synopsis "Library for percent-encoding (URI encoding) for Common Lisp")
+    (description "@code{percent-encoding} is a URI encoding library for
+Common Lisp, as defined in RFC 3986.")
+    (license license:expat)))
+
 (define-public sbcl-iterate
   (package
     (name "sbcl-iterate")
-- 
2.20.1





Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Mon, 24 Dec 2018 09:23:02 GMT) Full text and rfc822 format available.

Message #29 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Nam Nguyen <namn <at> berkeley.edu>
To: 33753 <at> debbugs.gnu.org
Cc: Nam Nguyen <namn <at> berkeley.edu>
Subject: [PATCH 3/3] gnu: emacs-stumpwm-mode: Use source and version of
 stumpwm-cpu.
Date: Mon, 24 Dec 2018 01:21:25 -0800
* gnu/packages/emacs.scm (emacs-stumpwm-mode): Use source and version of stumpwm-cpu.
---
 gnu/packages/emacs.scm | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 7fdcfb1a3..2e6962695 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -122,6 +122,7 @@
   #:use-module (gnu packages video)
   #:use-module (gnu packages haskell)
   #:use-module (gnu packages wordnet)
+  #:use-module (gnu packages lisp)
   #:use-module (guix utils)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match))
@@ -10864,17 +10865,8 @@ bookmarks and history.")
         (revision "1"))
     (package
       (name "emacs-stumpwm-mode")
-      (version (string-append "0.0.1-" revision "."
-                              (string-take commit 7)))
-      (source (origin
-                (method git-fetch)
-                (uri (git-reference
-                      (url "https://github.com/stumpwm/stumpwm-contrib.git")
-                      (commit commit)))
-                (file-name (string-append name "-" version "-checkout"))
-                (sha256
-                 (base32
-                  "1dfwsvz1c8w6j4jp0kzaz78ml3f5dp0a5pvf090kwpbpg176r7iq"))))
+      (version (package-version stumpwm-cpu))
+      (source (package-source stumpwm-cpu))
       (build-system emacs-build-system)
       (arguments
        `(#:phases
-- 
2.20.1





Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Mon, 24 Dec 2018 10:02:01 GMT) Full text and rfc822 format available.

Message #32 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Nam Nguyen <namn <at> berkeley.edu>
To: 33753 <at> debbugs.gnu.org
Cc: ludo <at> gnu.org, mail <at> ambrevar.xyz
Subject: Re: [bug#33753] stumpwm-contrib
Date: Mon, 24 Dec 2018 02:01:29 -0800
Hi all,

> you could probably use a a function / macro to define those packages

Thank you for pointing me to examples. This helped me refactor.

> : 4. Should the stumpwm-contrib directory be named sbcl-sources (can't
> : recall the default directory of asdf-build-system/source)?

> Sorry, which directory exactly?

If I use asdf-build-system/source instead of sbcl I get the sources for
cpu stored in:
~/.guix-profile/share/common-lisp/source/cpu

Instead, I arbitrarily created stumpwm-contrib to store the sources:
~/.guix-profile/share/common-lisp/stumpwm-contrib/cpu

To rephrase question #4: Should I rename stumpwm-contrib to be "source"
to be more consistent with the "default" naming, or is stumpwm-contrib
sufficient?

As noted before, ~/.stumpwmrc will have to contain the precompiled code in:
(set-module-dir "~/.guix-profile/share/common-lisp/sbcl-bundle-systems")
in order to work with the more advanced plugins like pinentry.

AIUI, stumpwm-contrib/cpu contains the source code and documentation
org-mode files, and sbcl-bundle-systems contains the precompiled code.

This time, I included all the modules for review, as refactoring helped
to shorten the patches.




Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Mon, 24 Dec 2018 10:15:02 GMT) Full text and rfc822 format available.

Message #35 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Nam Nguyen <namn <at> berkeley.edu>
Cc: ludo <at> gnu.org, 33753 <at> debbugs.gnu.org
Subject: Re: [bug#33753] stumpwm-contrib
Date: Mon, 24 Dec 2018 11:14:20 +0100
[Message part 1 (text/plain, inline)]
> If I use asdf-build-system/source instead of sbcl I get the sources for
> cpu stored in:
> ~/.guix-profile/share/common-lisp/source/cpu

But you should not use asdf-build-system/source for StumpWM since it's not
supported by any Lisp other than SBCL, right?

> As noted before, ~/.stumpwmrc will have to contain the precompiled code in:
> (set-module-dir "~/.guix-profile/share/common-lisp/sbcl-bundle-systems")
> in order to work with the more advanced plugins like pinentry.

And then you would not need this line either if I'm not mistaken.

> AIUI,

What is AIUI? :/

> stumpwm-contrib/cpu contains the source code and documentation
> org-mode files, and sbcl-bundle-systems contains the precompiled code.

Both are included with asdf-build-system/sbcl.  Is this OK in this context?

Sorry, no time for testing at the moment.

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Mon, 24 Dec 2018 10:21:02 GMT) Full text and rfc822 format available.

Message #38 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: Nam Nguyen <namn <at> berkeley.edu>, 33753 <at> debbugs.gnu.org
Subject: Re: [bug#33753] stumpwm-contrib
Date: Mon, 24 Dec 2018 12:20:50 +0200
[Message part 1 (text/plain, inline)]
On Mon, Dec 24, 2018 at 11:14:20AM +0100, Pierre Neidhardt wrote:
> 
> > AIUI,
> 
> What is AIUI? :/
> 

as i understand it

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Tue, 25 Dec 2018 08:20:01 GMT) Full text and rfc822 format available.

Message #41 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Nam Nguyen <namn <at> berkeley.edu>
To: 33753 <at> debbugs.gnu.org
Subject: [PATCH 1/3] gnu: Add stumpwm modules.
Date: Tue, 25 Dec 2018 00:19:00 -0800
* gnu/packages/lisp.scm (stumpwm-cpu, stumpwm-mem, stumpwm-hostname)
  (stumpwm-battery-portable, stumpwm-winner-mode, stumpwm-swm-gaps)
  (stumpwm-pinentry): New public variables.
  (stumpwm-contrib, stumpwm-module): New private variables.
---
 gnu/packages/lisp.scm | 104 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 261e720e2..4fb9a8a00 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2018 Alex Vong <alexvong1995 <at> gmail.com>
 ;;; Copyright © 2018 Pierre Neidhardt <mail <at> ambrevar.xyz>
 ;;; Copyright © 2018 Pierre Langlois <pierre.langlois <at> gmx.com>
+;;; Copyright © 2018 Nam Nguyen <namn <at> berkeley.edu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1032,6 +1033,109 @@ productive, customizable lisp based systems.")
     (inherit (sbcl-package->cl-source-package stumpwm))
     (name "cl-stumpwm")))
 
+(define stumpwm-contrib
+  (let ((commit "bd47cec14f7299711ac29468d2e1364d38a81bee")
+        (revision "1"))
+    (package
+      (name "stumpwm-contrib")
+      (version (git-version "0.0.1" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/stumpwm/stumpwm-contrib.git")
+               (commit commit)))
+         (file-name (string-append name "-" version "-checkout"))
+         (sha256
+          (base32
+           "0kh9vpmxssjvxgvl6ihpn0qh4l660n64iq80ivhagdvr8s045ddj"))))
+      (build-system asdf-build-system/sbcl)
+      (inputs
+       `(("stumpwm" ,stumpwm "lib")))
+      (home-page "https://github.com/stumpwm/stumpwm-contrib")
+      (synopsis "Collection of StumpWM modules")
+      (description "Modules are a way to extend StumpWM using Lisp
+code.")
+      (license (list license:gpl2+      ; TODO: swm-gaps Missing license?
+                     license:gpl3+      ; cpu, mem, battery-portable,
+                                        ; winner-mode, pinentry
+                     license:bsd-2))))) ; hostname
+
+(define* (stumpwm-module mod cat syn desc)
+  (package (inherit stumpwm-contrib)
+    (name (string-append "stumpwm-" mod))
+    (arguments
+     `(#:tests? #f ; No tests exist.
+       #:asd-file (string-append ,cat "/" ,mod "/" ,mod ".asd")
+       #:asd-system-name ,mod
+       #:phases
+       (modify-phases %standard-phases
+         ;; Keep this module's sources and delete the rest.
+         (add-after 'check 'copy-module-sources
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (clisp (string-append out "/share/common-lisp"))
+                    (sbcl-source (string-append clisp "/sbcl-source"))
+                    (source (string-append sbcl-source "/"
+                                           ,mod "/" ,cat "/" ,mod))
+                    (tmp (string-append out "/" ,mod)))
+               (mkdir-p tmp)
+               (copy-recursively source tmp)
+               (delete-file-recursively sbcl-source)
+               (copy-recursively tmp
+                                 (string-append sbcl-source "/" ,mod))
+               (delete-file-recursively tmp))
+             #t)))))
+    (synopsis syn)
+    (description desc)))
+
+(define-public stumpwm-cpu
+  (stumpwm-module "cpu" "modeline"
+                  "Display CPU info"
+                  "Display CPU info in the StumpWM modeline."))
+
+(define-public stumpwm-mem
+  (stumpwm-module "mem" "modeline"
+                  "Display memory info"
+                  "Display memory info in the StumpWM modeline."))
+
+(define-public stumpwm-hostname
+  (stumpwm-module "hostname" "modeline"
+                  "Display hostname"
+                  "Display hostname in the StumpWM modeline."))
+
+(define-public stumpwm-battery-portable
+  (stumpwm-module "battery-portable" "modeline"
+                  "Display laptop battery info"
+                  "Display laptop battery info in the StumpWM
+modeline."))
+
+(define-public stumpwm-winner-mode
+  (stumpwm-module "winner-mode" "util"
+                  "Emacs' winner-mode for StumpWM"
+                  "Winner mode records changes in the window
+configuration so that changes can be undone.  It hooks into StumpWM to
+dump layouts.  This only works per group."))
+
+(define-public stumpwm-swm-gaps
+  (stumpwm-module "swm-gaps" "util"
+                  "Pretty (useless) gaps for StumpWM"
+                  "Add gaps to StumpWM running along various borders."))
+
+(define-public stumpwm-pinentry
+  (let ((pinentry (stumpwm-module "pinentry" "util"
+                                  "Integrate GnuPG Agent with StumpWM"
+                                  "GnuPG Agent uses
+@code{stumpwm-pinentry} to ask for your password.")))
+    (package (inherit pinentry)
+      (inputs
+       `(("sbcl-cffi" ,sbcl-cffi)
+         ("sbcl-usocket-server" ,sbcl-usocket-server)
+         ("sbcl-percent-encoding" ,sbcl-percent-encoding)
+         ,@(package-inputs stumpwm-contrib)))
+      (propagated-inputs
+       `(("netcat" ,netcat))))))
+
 ;; The slynk that users expect to install includes all of slynk's contrib
 ;; modules.  Therefore, we build the base module and all contribs first; then
 ;; we expose the union of these as `sbcl-slynk'.  The following variable
-- 
2.20.1





Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Tue, 25 Dec 2018 08:20:02 GMT) Full text and rfc822 format available.

Message #44 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Nam Nguyen <namn <at> berkeley.edu>
To: 33753 <at> debbugs.gnu.org
Subject: [PATCH 2/3] gnu: Add sbcl-percent-encoding.
Date: Tue, 25 Dec 2018 00:19:01 -0800
* gnu/packages/lisp.scm (sbcl-percent-encoding): New variable.
---
 gnu/packages/lisp.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 4fb9a8a00..5d99c7dfb 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -1495,6 +1495,30 @@ the string into one of the standard Common Lisp number types, if possible, or
 else @code{parse-number} signals an error of type @code{invalid-number}.")
     (license license:bsd-3)))
 
+(define-public sbcl-percent-encoding
+  (package
+    (name "sbcl-percent-encoding")
+    (version "20121013")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://beta.quicklisp.org/archive/percent-encoding/"
+                           "2012-10-13/percent-encoding-"
+                           version "-git.tgz"))
+       (sha256
+        (base32
+         "1dlf77c1iha1d7h6fzmv090mf8p6w20fqjrd5zcbh2kiicyabhfb"))))
+    (inputs
+     `(("sbcl-anaphora" ,sbcl-anaphora)
+       ("sbcl-babel" ,sbcl-babel)
+       ("sbcl-fiveam" ,sbcl-fiveam)))
+    (build-system asdf-build-system/sbcl)
+    (home-page "https://common-lisp.net/project/percent-encoding/")
+    (synopsis "Library for percent-encoding (URI encoding) for Common Lisp")
+    (description "@code{percent-encoding} is a URI encoding library for
+Common Lisp, as defined in RFC 3986.")
+    (license license:expat)))
+
 (define-public sbcl-iterate
   (package
     (name "sbcl-iterate")
-- 
2.20.1





Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Tue, 25 Dec 2018 09:02:02 GMT) Full text and rfc822 format available.

Message #47 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Nam Nguyen <namn <at> berkeley.edu>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: 33753 <at> debbugs.gnu.org
Subject: Re: [bug#33753] stumpwm-contrib
Date: Tue, 25 Dec 2018 01:01:21 -0800
> Sorry, no time for testing at the moment.
No worries. Thanks for letting me know.

> Both are included with asdf-build-system/sbcl.  Is this OK in this context?

In this context, the entire repo is contained in sbcl-source. 
COPYING  media/  minor-mode/  modeline/  README.org  update-readme.sh  util/

I've resorted to a clunky way of deleting everything but the util/cpu
subdirectory that I care about retaining.
cp -r sbcl-source/util/cpu out/cpu
rm -rf sbcl-source
cp -r out/cpu sbcl-source/cpu

I have cleaned up the code a bit in these latest two patches so that
there is only one phase that does this. The directories look like so:

---8<------------------------------------------------------------
~/.guix-profile/share/common-lisp/sbcl-source$ ls
battery-portable  cpu  hostname  mem  pinentry  swm-gaps  winner-mode

~/.guix-profile/share/common-lisp/sbcl-bundle-systems$ ls
battery-portable.asd  cpu.asd  hostname.asd  mem.asd  pinentry.asd  swm-gaps.asd  winner-mode.asd
---8<------------------------------------------------------------

> (set-module-dir "~/.guix-profile/share/common-lisp/sbcl-bundle-systems")
> And then you would not need this line either if I'm not mistaken.

I referred to the documentation[1], and it seems that module-dir can be set.

In order not to set module-dir at runtime, perhaps the stumpwm recipe
can be configured[2] with the correct module-dir?

I suppose it would be more user-friendly to not have to use set-module-dir
and just use the modules directly (like how emacs works with guix). If
this is option is more desired, I can try configuring stumpwm and will
report back.

---8<------------------------------------------------------------
(defvar *load-path* nil
  "A list of paths in which modules can be found, by default it is
  populated by any asdf systems found in `*module-dir*' set from the
  configure script when StumpWM was built, or later by the user using
  `add-to-load-path'")
---8<------------------------------------------------------------

[1] https://github.com/stumpwm/stumpwm/wiki/Modules
[2] https://github.com/stumpwm/stumpwm/blob/master/module.lisp




Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Wed, 26 Dec 2018 07:14:02 GMT) Full text and rfc822 format available.

Message #50 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Nam Nguyen <namn <at> berkeley.edu>
To: 33753 <at> debbugs.gnu.org
Subject: Re: [bug#33753] stumpwm-contrib
Date: Tue, 25 Dec 2018 23:13:21 -0800
I did some investigating by querying within stumpwm.

C-t ; brings up a stumpwm prompt.
---8<------------------------------------------------------------
eval-line (print *module-dir*)

/gnu/store/...stumpwm-18.11-lib/.stumpwm.d/modules/
---8<------------------------------------------------------------

It seems to set *module-dir* at build time to be
/gnu/store/...stumpwm-18.11-lib/.stumpwm.d/modules/. However, this .stump.d
doesn't exist and it was created when stumpwm was compiled. There are
also potentially a FHS assumption with (getenv "HOME") and it happens to
evaluate to the /gnu/store item.

StumpWM gives option #1 of setting module-dir at build time of
StumpWM. I could try patching
---8<------------------------------------------------------------
> (pathname-as-directory (concat (getenv "HOME") "/.stumpwm.d/modules"))
---8<------------------------------------------------------------
in order to store the modules at some standard, system-wide location? Hard
coding it as /var/guix/profiles/per-user/user/guix-profile/share/common-lisp
is incorrect because guix won't build as the user. Maybe I can force stumpwm
and the stumpwm-contrib modules to use the same stumpwm library. This seems
tricky/impossible, though, since they are all individual modules.

StumpWM also offers option #2 of calling set-module-dir to set this
variable at run-time in ~/.stumpwmrc. This is how it currently works and
it seems more simple.
---8<-------------------  ~/.stumpwmrc --------------------------
(set-module-dir "~/.guix-profile/share/common-lisp/sbcl-bundle-systems")
---8<------------------------------------------------------------

*module-dir* is essentially a seed for *load-path*, which is where the
files like cpu.asd and cpu--system.fasl are. With the current setup,
load-path is populated correctly.
---8<------------------------------------------------------------
eval-line (print *load-path*)

/gnu/store/stumpwm-cpu/lib/sbcl/"
...
/gnu/store/stumpwm-mem/lib/sbcl/"
---8<------------------------------------------------------------

Option #3 is to use "add-to-load-path", but that seems similar to
Option #1. I suppose this is a matter of investigating how stumpwm
handles its modules/extensions. What I know thus far points me to err
toward setting module-dir at run-time, since it is a one-liner.

Relevant snippets from module.lisp
(https://github.com/stumpwm/stumpwm/blob/master/module.lisp)

---8<------------------------------------------------------------
(defvar *module-dir*
  (pathname-as-directory (concat (getenv "HOME") "/.stumpwm.d/modules"))
  "The location of the contrib modules on your system.")

(defun build-load-path (path)
  "Maps subdirectories of path, returning a list of all subdirs in the
  path which contain any files ending in .asd"
  ...

(defvar *load-path* nil
  "A list of paths in which modules can be found, by default it is
  populated by any asdf systems found in `*module-dir*' set from the
  configure script when StumpWM was built, or later by the user using
  `add-to-load-path'")

(defun set-module-dir (dir)
  "Sets the location of the for StumpWM to find modules"
  (when (stringp dir)
    (setf dir (pathname (concat dir "/"))))
  (setf *module-dir* dir)
  (init-load-path *module-dir*))
---8<------------------------------------------------------------




Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Thu, 27 Dec 2018 10:52:01 GMT) Full text and rfc822 format available.

Message #53 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Nam Nguyen <namn <at> berkeley.edu>
Cc: 33753 <at> debbugs.gnu.org
Subject: Re: [bug#33753] stumpwm-contrib
Date: Thu, 27 Dec 2018 11:51:53 +0100
[Message part 1 (text/plain, inline)]
OK, thanks for the details.  I'll look into this later.

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Mon, 23 Mar 2020 07:17:02 GMT) Full text and rfc822 format available.

Message #56 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: 33753 <at> debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH 0/3] ttf-fonts module in StumpWM
Date: Mon, 23 Mar 2020 10:16:01 +0300
Hello.  I wish to push the following if you don't mind.  We probably could
make a better solution later, but I think it's good enough for now.  WDYT?

This patch series allows you to use ttf-fonts module in StumpWM.

Oleg Pykhalov (3):
  gnu: Add sbcl-clx-truetype.
  gnu: emacs-stumpwm-mode: Update to 0.0.1-1.dd5b037.
  gnu: Add sbcl-stumpwm-ttf-fonts.

 doc/guix-cookbook.texi     | 41 +++++++++++++++++++++++++++++++++++++-
 gnu/packages/emacs-xyz.scm |  4 ++--
 gnu/packages/lisp-xyz.scm  | 35 ++++++++++++++++++++++++++++++++
 gnu/packages/wm.scm        | 33 +++++++++++++++++++++++++++++-
 4 files changed, 109 insertions(+), 4 deletions(-)

-- 
2.25.1





Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Mon, 23 Mar 2020 07:26:01 GMT) Full text and rfc822 format available.

Message #59 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: 33753 <at> debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH 1/3] gnu: Add sbcl-clx-truetype.
Date: Mon, 23 Mar 2020 10:24:40 +0300
* gnu/packages/lisp-xyz.scm (sbcl-clx-truetype): New variable.
---
 gnu/packages/lisp-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/lisp-xyz.scm b/gnu/packages/lisp-xyz.scm
index 043c219e5e..d0af123171 100644
--- a/gnu/packages/lisp-xyz.scm
+++ b/gnu/packages/lisp-xyz.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2019 Brett Gilio <brettg <at> gnu.org>
 ;;; Copyright © 2020 Konrad Hinsen <konrad.hinsen <at> fastmail.net>
 ;;; Copyright © 2020 Dimakis Dimakakos <me <at> bendersteed.tech>
+;;; Copyright © 2020 Oleg Pykhalov <go.wigust <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -619,6 +620,40 @@ from other CLXes around the net.")
 (define-public ecl-clx
   (sbcl-package->ecl-package sbcl-clx))
 
+(define-public sbcl-clx-truetype
+  (package
+    (name "sbcl-clx-truetype")
+    (version "2016-08-25")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "http://beta.quicklisp.org/archive/clx-truetype/" version
+             "/clx-truetype-" (string-delete #\- version) "-git.tgz"))
+       (sha256
+        (base32
+         "0ndy067rg9w6636gxwlpnw7f3ck9nrnjb03444pprik9r3c9in67"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           (substitute* "package.lisp"
+             ((":export") ":export\n   :+font-cache-filename+"))
+           #t))))
+    (build-system asdf-build-system/sbcl)
+    (inputs
+     `(("clx" ,sbcl-clx)
+       ("zpb-ttf" ,sbcl-zpb-ttf)
+       ("cl-vectors" ,sbcl-cl-vectors)
+       ("cl-paths-ttf" ,sbcl-cl-paths-ttf)
+       ("cl-fad" ,sbcl-cl-fad)
+       ("cl-store" ,sbcl-cl-store)
+       ("trivial-features" ,sbcl-trivial-features)))
+    (home-page "http://beta.quicklisp.org/archive/clx-truetype/")
+    (synopsis "Antialiased TrueType font rendering using CLX and XRender")
+    (description "CLX-TrueType is pure common lisp solution for
+antialiased TrueType font rendering using CLX and XRender extension.")
+    (license license:expat)))
+
 (define-public sbcl-cl-ppcre-unicode
   (package (inherit sbcl-cl-ppcre)
     (name "sbcl-cl-ppcre-unicode")
-- 
2.25.1





Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Mon, 23 Mar 2020 07:27:02 GMT) Full text and rfc822 format available.

Message #62 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: 33753 <at> debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH 2/3] gnu: emacs-stumpwm-mode: Update to 0.0.1-1.dd5b037.
Date: Mon, 23 Mar 2020 10:24:41 +0300
* gnu/packages/emacs-xyz.scm (emacs-stumpwm-mode): Update to 0.0.1-1.dd5b037.
---
 gnu/packages/emacs-xyz.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index fe2210ac79..0069c19a2b 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -14536,7 +14536,7 @@ bookmarks and history.")
     (license license:gpl3+)))
 
 (define-public emacs-stumpwm-mode
-  (let ((commit "5328f85fbf6a8b08c758c17b9435368bf7a68f39"))
+  (let ((commit "dd5b037923ec7d3cc27c55806bcec5a1b8cf4e91"))
     (package
       (name "emacs-stumpwm-mode")
       (version (git-version "0.0.1" "1" commit))
@@ -14548,7 +14548,7 @@ bookmarks and history.")
                 (file-name (git-file-name name version))
                 (sha256
                  (base32
-                  "00kf4k8bqadi5s667wb96sn549v2kvw01zwszjrg7nhd805m1ng6"))))
+                  "0ahxdj9f884afpzxczx6mx7l4nwg4kw6afqaq7lwhf7lxcwylldn"))))
       (build-system emacs-build-system)
       (arguments
        `(#:phases
-- 
2.25.1





Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Mon, 23 Mar 2020 07:27:02 GMT) Full text and rfc822 format available.

Message #65 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: 33753 <at> debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH 3/3] gnu: Add sbcl-stumpwm-ttf-fonts.
Date: Mon, 23 Mar 2020 10:24:42 +0300
* gnu/packages/wm.scm (sbcl-stumpwm-ttf-fonts): New variable.
* doc/guix-cookbook.texi (Customizing a Window Manager): Document
SBCL-STUMPWM-TTF-FONTS installation and configuration.
---
 doc/guix-cookbook.texi | 41 ++++++++++++++++++++++++++++++++++++++++-
 gnu/packages/wm.scm    | 33 ++++++++++++++++++++++++++++++++-
 2 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi
index 477b7e3dff..84a9bb38a4 100644
--- a/doc/guix-cookbook.texi
+++ b/doc/guix-cookbook.texi
@@ -11,6 +11,7 @@
 Copyright @copyright{} 2019 Ricardo Wurmus@*
 Copyright @copyright{} 2019 Efraim Flashner@*
 Copyright @copyright{} 2019 Pierre Neidhardt@*
+Copyright @copyright{} 2020 Oleg Pykhalov@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -1319,7 +1320,8 @@ chapter is to demonstrate some advanced configuration concepts.
 reference.
 
 @menu
-* Customizing the Kernel::     Creating and using a custom Linux kernel on Guix System.
+* Customizing the Kernel::       Creating and using a custom Linux kernel on Guix System.
+* Customizing a Window Manager:: Handle customization of a Window manager on Guix System.
 @end menu
 
 @node Customizing the Kernel
@@ -1562,6 +1564,43 @@ likely that you'll need to modify the initrd on a machine using a custom
 kernel, since certain modules which are expected to be built may not be
 available for inclusion into the initrd.
 
+@node Customizing a Window Manager
+@section Customizing a Window Manager
+@cindex wm
+
+@node StumpWM
+@subsection StumpWM
+@cindex stumpwm
+
+You could install StumpWM with a Guix system by adding
+@code{stumpwm-checkout} and optionally @code{`(,stumpwm-checkout "lib")}
+packages to a system configuration file, e.g. @file{/etc/config.scm}.
+
+An example configuration can look like this:
+
+@lisp
+(operating-system
+  ;; …
+  (packages (append (list sbcl stumpwm-checkout `(,stumpwm-checkout "lib"))
+                    %base-packages)))
+@end lisp
+
+@cindex stumpwm fonts
+By default StumpWM uses X11 fonts, which could be small or pixelated on
+your system.  You could fix this by installing StumpWM contrib Lisp
+module @code{sbcl-stumpwm-ttf-fonts}, adding it to Guix system packages.
+
+Then you need to add the following code to a StumpWM configuration file
+@file{~/.stumpwm.d/init.lisp}:
+
+@lisp
+(require :ttf-fonts)
+(setf xft:*font-dirs* '("/run/current-system/profile/share/fonts/"))
+(setf clx-truetype:+font-cache-filename+ (concat (getenv "HOME") "/.fonts/font-cache.sexp"))
+(xft:cache-fonts)
+(set-font (make-instance 'xft:font :family "DejaVu Sans Mono" :subfamily "Book" :size 11))
+@end lisp
+
 @c *********************************************************************
 @node Advanced package management
 @chapter Advanced package management
diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index 25ec278e2c..7217d985f2 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -14,7 +14,7 @@
 ;;; Copyright © 2016 Ivan Vilata i Balaguer <ivan <at> selidor.net>
 ;;; Copyright © 2017 Mekeor Melire <mekeor.melire <at> gmail.com>
 ;;; Copyright © 2017, 2019 Marius Bakke <mbakke <at> fastmail.com>
-;;; Copyright © 2017 Oleg Pykhalov <go.wigust <at> gmail.com>
+;;; Copyright © 2017, 2020 Oleg Pykhalov <go.wigust <at> gmail.com>
 ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2018 Pierre-Antoine Rouby <contact <at> parouby.fr>
 ;;; Copyright © 2018, 2019 Meiyo Peng <meiyo <at> riseup.net>
@@ -1660,6 +1660,37 @@ productive, customizable lisp based systems.")
 (define-public sbcl-stumpwm+slynk
   (deprecated-package "sbcl-stumpwm-with-slynk" stumpwm+slynk))
 
+(define-public sbcl-stumpwm-ttf-fonts
+  (let ((commit "dd5b037923ec7d3cc27c55806bcec5a1b8cf4e91")
+        (revision "1"))
+    (package
+      (name "sbcl-ttf-fonts")
+      (version (git-version "0.0.1" revision commit)) ;no upstream release
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/stumpwm/stumpwm-contrib.git")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0ahxdj9f884afpzxczx6mx7l4nwg4kw6afqaq7lwhf7lxcwylldn"))))
+      (inputs
+       `(("stumpwm" ,stumpwm "lib")
+         ("clx-truetype" ,sbcl-clx-truetype)))
+      (build-system asdf-build-system/sbcl)
+      (arguments
+       '(#:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'chdir
+             (lambda _
+               (chdir "util/ttf-fonts"))))))
+      (home-page "https://github.com/stumpwm/stumpwm-contrib")
+      (synopsis "Implementation of TTF font rendering for Lisp")
+      (description "This package provides a Lisp implementation of TTF font
+rendering.")
+      (license (list license:gpl2+ license:gpl3+ license:bsd-2)))))
+
 (define-public lemonbar
   (let ((commit "35183ab81d2128dbb7b6d8e119cc57846bcefdb4")
         (revision "1"))
-- 
2.25.1





Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Mon, 23 Mar 2020 09:07:02 GMT) Full text and rfc822 format available.

Message #68 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Guillaume Le Vaillant <glv <at> posteo.net>
To: 33753 <at> debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: Re: [bug#33753] [PATCH 1/3] gnu: Add sbcl-clx-truetype.
Date: Mon, 23 Mar 2020 10:06:17 +0100
[Message part 1 (text/plain, inline)]
Oleg Pykhalov <go.wigust <at> gmail.com> skribis:

> * gnu/packages/lisp-xyz.scm (sbcl-clx-truetype): New variable.

The author of clx-truetype suggests using truetype-clx instead (see
https://github.com/quicklisp/quicklisp-projects/issues/1774). Have you
checked if that would work for the ttf-fonts module of stumpwm-contrib?

If not, maybe we could get the sources from a fork of the original
repository that disappeared instead of fetching the Quicklisp archive
(for example, https://github.com/l04m33/clx-truetype has clx-truetype
version 0.1).
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33753; Package guix-patches. (Mon, 30 Mar 2020 20:25:01 GMT) Full text and rfc822 format available.

Message #71 received at 33753 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Guillaume Le Vaillant <glv <at> posteo.net>
Cc: 33753-done <at> debbugs.gnu.org, 33753 <at> debbugs.gnu.org
Subject: Re: [bug#33753] [PATCH 1/3] gnu: Add sbcl-clx-truetype.
Date: Mon, 30 Mar 2020 23:24:43 +0300
[Message part 1 (text/plain, inline)]
Hi,

Apologies for a delay.

Guillaume Le Vaillant <glv <at> posteo.net> writes:

> The author of clx-truetype suggests using truetype-clx instead (see
> https://github.com/quicklisp/quicklisp-projects/issues/1774). Have you
> checked if that would work for the ttf-fonts module of stumpwm-contrib?
>
> If not, maybe we could get the sources from a fork of the original
> repository that disappeared instead of fetching the Quicklisp archive
> (for example, https://github.com/l04m33/clx-truetype has clx-truetype
> version 0.1).

I've tested in a VM, it works.  Thank you for noticing this!

Also I pushed stumpish package in addition to this series. 

Regards,
Oleg.
[signature.asc (application/pgp-signature, inline)]

Reply sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
You have taken responsibility. (Mon, 30 Mar 2020 20:25:02 GMT) Full text and rfc822 format available.

Notification sent to Nam Nguyen <namn <at> berkeley.edu>:
bug acknowledged by developer. (Mon, 30 Mar 2020 20:25:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 28 Apr 2020 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 357 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.