unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: jbranso@dismail.de
To: "Zain Jabbar" <zaijab2000@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: Creating an Emacs Home Configuration Service
Date: Wed, 19 Oct 2022 20:56:02 +0000	[thread overview]
Message-ID: <852cb48a4171fdc057c874cc5fb164cc@dismail.de> (raw)
In-Reply-To: <CAH+UbWTdhtFj9zz0e8P7cH+xaF=NZRokHkj7JNJ6FXkQhOvLAg@mail.gmail.com>

October 19, 2022 4:25 PM, "Zain Jabbar" <zaijab2000@gmail.com> wrote:

> Aloha All,
> 
> Thank you for your insightful messages. Sorry my code did not work as
> smoothly as I would have liked. I have a =home-environment= definition
> that hopefully works for you. You can put everything into one
> configuration as you described. I do that in the following source
> block. For some reason I liked the idea of separate definitions of
> each package, so that Guile and Guix Home kind of acts like a
> =use-package= declaration. Though that was needless abstraction on my
> end.

I do not know if it is a needless abstraction.  I am just bouncing ideas
around with you.  :)

> 
> #+BEGIN_SRC scheme
> (use-modules (srfi srfi-1)
> (ice-9 pretty-print)
> (gnu home)
> (gnu packages)
> (gnu services)
> (gnu home services)
> (gnu services configuration)
> (guix gexp)
> (guix transformations))
> 
> (define file-likes? (list-of file-like?))
> 
> (define-configuration/no-serialization emacs-configuration
> (emacs-packages
> (file-likes (list (specification->package "emacs-next"))) "Files")
> (early-init
> (list '()) "Early-Init")
> (init
> (list '()) "Init"))
> 
> (define-public emacs-configuration-service
> (service-type (name (symbol-append 'emacs-configuration))
> (extensions
> (list (service-extension
> home-profile-service-type
> (lambda (config) (emacs-configuration-emacs-packages config)))
> (service-extension
> home-xdg-configuration-files-service-type
> (lambda (config)
> (list
> `("emacs/init.el" ,(scheme-file "init.el"
> (emacs-configuration-init config)
> #:splice? #:t))
> `("emacs/early-init.el" ,(scheme-file "early-init.el"
> (emacs-configuration-early-init config)
> #:splice? #:t)))))))
> (default-value (emacs-configuration))
> (description "Configures Emacs init.el")))
> 
> (define-public minimal-home-environment
> (home-environment
> (services
> (list
> (service emacs-configuration-service
> (emacs-configuration
> (emacs-packages
> (list
> (specification->package "bash")
> (specification->package "emacs-next")
> (specification->package "emacs-debbugs")
> (specification->package "emacs-evil")
> (specification->package "emacs-paredit")
> (specification->package "emacs-anzu")))
> (init '((evil-mode 1)
> ;; Please add more config here
> ;; Begining of emacs init configuration after evil-mode 1
> 
> ;; End emacs init configuration
> ))
> (early-init '((setq warning-suppress-log-types '((comp) (comp)))
> (setq warning-suppress-types '((comp) (comp))))))))))) ; A
> serious stack of pringles here
> 
> minimal-home-environment
> #+END_SRC
> 
> I saved this file to =minimal-working-example.scm= and ran a container using
> =guix home -N --share=/tmp container ./minimal-working-example.scm=.
> This should spawn a shell in which you can run =emacs= (as terminal).
> Furthermore we can also run the info help command and get to the
> debbugs page.
> 
> The =init= and =early-init= configuration options take in
> S-Expressions not files. Under the hood the service uses =scheme-file=
> which takes in an expression. I am open to suggestions for other file
> mechanisms, like if, for example, G-Expressions are more natural here.
> I found that I did not know how to naturally append G-Expressions
> together and that the S-Expressions can "bleed" into the config using
> backquotes. So I chose just sticking in a list of expressions for
> Emacs. Something Andrew Tropin taught me, if you are working in a
> =*.scm= file and you want to evaluate elisp, use =M-x eval-region= or
> =M-x edit-indirect-region= (with the usual stipulation that if you do
> this very often we can bind it to a key).

I would say when you submit your service to guix-devel others will give
you some options too.  I like the idea of S-expressions though.

 
> If my interpretation of 13.1 Declaring the Home Environment is
> correct, we should expect an error associated with XDG_RUNTIME_DIR as
> the necessary variables will be set via the Operating-System
> declaration. The next error I believe is emacs wanting to make a file
> where the home container does not have read or write permissions. My
> =guix home= declaration with the =share= parameter should hopefully
> help with this error. Oddly enough if we do not specify the
> installation of =bash=, Emacs says it cannot uncompress the info
> manuals because there is no =sh=. That is why I included =bash= into
> the emacs packages list. I do think a lot of these "solutions" will be
> unncessecary if users were to use =guix home reconfigure= rather than
> user the container. Though it's nice to debug them there.

Thanks for the explanation!


  parent reply	other threads:[~2022-10-19 20:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAH+UbWQ1JZCZf0BEOzT1zcTeW5sDekOsxbGYgKn8rjdQ5e0kUw@mail.gmail.com>
2022-10-17  2:34 ` Creating an Emacs Home Configuration Service Zain Jabbar
2022-10-17 22:09   ` jbranso
2022-10-17 23:12     ` Zain Jabbar
2022-10-18 15:41     ` jbranso
     [not found]       ` <CAH+UbWR8xWoCK9wouhsizEzTAO3CksNpkebu5we_75yQq++yUg@mail.gmail.com>
     [not found]         ` <a8142b002799224845f8efdddb28e518@dismail.de>
2022-10-19 18:18           ` jbranso
2022-10-19 20:25             ` Zain Jabbar
2022-10-19 20:56             ` jbranso [this message]
2022-10-19 21:09               ` Zain Jabbar
2022-10-19 15:36   ` Ludovic Courtès
2022-10-19 20:53     ` Zain Jabbar
2022-10-20  7:22       ` Andrew Tropin
2022-10-20 13:17       ` Ludovic Courtès
2022-10-20 18:35   ` 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=852cb48a4171fdc057c874cc5fb164cc@dismail.de \
    --to=jbranso@dismail.de \
    --cc=guix-devel@gnu.org \
    --cc=zaijab2000@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 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).