October 18, 2022 3:42 PM, "Zain Jabbar" <zaijab2...@gmail.com> wrote:
> Here is a minimal reproducible(-ish needs change in module name) > example configuration which installs =emacs-debbugs= (and not much > else). Cool I am CC-ing guix devel. > #+BEGIN_SRC scheme > (define-module (zaijab minimal-working-example) > #:use-module (srfi srfi-1) > #:use-module (ice-9 pretty-print) > #:use-module (gnu home) > #:use-module (gnu packages) > #:use-module (gnu services) > #:use-module (gnu home services) > #:use-module (gnu services) > #:use-module (gnu services configuration) > #:use-module (guix gexp) > #:use-module (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 debuggs-configuration > (emacs-configuration > (emacs-packages (list (specification->package "emacs-debbugs"))))) > > (define-public total-emacs-configuration > (fold (lambda (config-1 config-2) (emacs-configuration > (init (append (emacs-configuration-init config-1) > (emacs-configuration-init config-2))) > (early-init (append (emacs-configuration-early-init config-1) > (emacs-configuration-early-init config-2))) > (emacs-packages (append (emacs-configuration-emacs-packages config-1) > (emacs-configuration-emacs-packages config-2))))) > (emacs-configuration) > > (filter emacs-configuration? > (map variable-ref > (filter variable-bound? > (hash-map->list (lambda (x y) y) (struct-ref (current-module) 0))))))) > > (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 > total-emacs-configuration))))) > > minimal-home-environment > #+END_SRC I wonder why you do the define total-emacs-configuration...is it possible to define an emacs-configuration something like this? Forgive the possibly wrong syntax, I don't use guix home (services (service emacs-configuration-service (emacs-configuration (packages (list emacs-debbugs emacs-evil emacs-paredit emacs-anzu)) (init (text-file "init-file.el" "(evil-mode 1)\n ;; other configuration stuff"))))) > I tested this using =guix home container -N > minimal-working-example.scm=. Typing =M-x debbugs-gnu= gives a menu of > bugs. I made sure the debbugs configuration is necessary by commenting > it out, re-running =guix home container= and seeing that =M-x debb > [TAB]= pulls up nothing. I think it works. Woo-hoo! When I tested the home container via terminal foot I get a weird error: warning: XDG_RUNTIME_DIR doesn't exists, on-first-login script won't execute anything. You can check if xdg runtime directory exists, XDG_RUNTIME_DIR variable is set to appropriate value and manually execute the script by running '$HOME/.guix-home/on-first-login'-bash-5.1$ emacs emacs: Terminal type foot is not defined. If that is not the actual type of terminal you have, use the Bourne shell command 'TERM=...; export TERM' (C-shell: 'setenv TERM ...') to specify the correct type. It may be necessary to do 'unset TERMINFO' (C-shell: 'unsetenv TERMINFO') as well. That's probably just foot being weird. In lxterminal, emacs started fine. However, doing a M-x info RET m Debbugs RET I get this error in emacs: "Creating file with prefx: No such file or directory /tmp/jka-com" Anyway, definitely go ahead and send it to guix-patches! > Thank you for telling me about the =,build= meta command. It looks > very useful! I will need to figure out how to use it from =M-x > geiser-guile=. I have built this code by doing the following: > - open VTerm > - guix repl > - ,use (guix) > - ,use (MODULE-NAME) ;; in my case this was (zaijab minimal-working-example) > - ,build minimal-home-environment Once you get geiser set up and clone the git repo, and compile everything... inside the guix-src code...whatever file you are currently working on C-c C-a opens up that file in the repl. It's super awesome to be able to throw in some code evaluate it on the fly. https://video.hardlimit.com/c/the_gnu_guy/videos > I will be learning how to use the Git patching system soon. I will add > more documentation when I submit the patch. I'll be sure to CC you as > well. Thank you for your assistance. > > On Tue, Oct 18, 2022 at 8:42 AM <jbra...@dismail.de> wrote: > >> October 18, 2022 1:55 PM, "Zain Jabbar" <zaijab2...@gmail.com> wrote: >> >> Aloha Guix Development Team, >> >> Thank you for your email. I attribute my successes to the fantastic >> documentation and my failures (as you will see in this email) to my >> own inability to read the documentation. >> >> I meant to mention, have you tried using ",build" in a geiser repl? >> It lets you build derivations/gexps and shows you the output in >> the store. I have found that super helpful when building my only >> guix service (not merged yet). >> >> From what I can tell, yes. Emacs does find the packages you install >> using this mechanism and loading them behaves as though you installed >> from a manifest. Let me know if you have a package you wish to test. I >> can email the results. >> >> emacs-debbugs. If it works, then that is awesome! Well done! >> >> But I would need more guidance to answer this question fully. There >> are some points of confusion I have relating to profiles and package >> availability. I will try to give my best answer using the >> documentation, source code, then a demo. >> >> One thing I can say for sure is that the packages are installed using >> the =home-profile-service-type=. According to the documentation at >> 13.3.1 Essential Home Services the =home-profile-service-type= can be >> "extended with a list of packages if you want to install additional >> packages into your profile". >> >> According to the source code in guix/gnu/home/services.scm >> #+BEGIN_SRC scheme >> ;; [In the big comment block line 76] >> ;;; home-profile-service-type is almost the same as >> profile-service-type, at least >> ;;; for now. >> .... ;; [Within the definition for home-profile-service-type (line 161)] >> (description >> "This is the @dfn{home profile} and can be found in >> @file{~/.guix-home/profile}. It contains packages and >> configuration files that the user has declared in their >> @code{home-environment} record.")) >> #+END_SRC >> >> It appears that using this configuration it installs it into the >> =~/.guix-home/profile=. Here is where I get a bit confused, when >> running =guix package --list-profiles= I get >> =/home/zjabbar/.config/guix/current= and >> =/home/zjabbar/.guix-profile=, neither of which are my home profile. >> >> Here is a demo. >> >> I do not have the =emacs-suneater-theme= package installed using my manifest. >> >> =guix package -I suneater= returns nothing when run in the terminal. >> >> After saving this configuration in the module: >> #+BEGIN_SRC scheme >> (define theme-configuration >> (emacs-configuration >> (emacs-packages (list (specification->package "emacs-suneater-theme"))) >> (init '((load-theme 'suneater t))))) >> #+END_SRC >> >> I find that Guix downloads and builds the package. After restarting >> Emacs, it comes up with the new theme and =M-x describe-theme= finds >> it and everything. That being said, =guix package -I suneater= *still* >> returns nothing when run in the terminal. I suppose it's because the >> theme was installed without using the =guix install= command >> specifically. >> >> =guix package -A suneater= does show me that suneater is available. >> However after deleting or commenting out the configuration in that >> source block, Emacs does not load the theme and Emacs cannot find the >> theme using =M-x describe-theme=. But =guix package -A suneater= still >> shows me that suneater is available. So it was removed according to >> Emacs but not to guix. I am likely not looking at the right =guix >> package= options. >> >> It sounds like you have created the home-emacs service is a way that works. >> I think your next move would be submit it guix-patc...@gnu.org. >> Feel free to CC me in the email. >> >> https://git-send-email.io >> >> Thanks, >> >> Joshua > > -- > Thank you, > Zain Jabbar > > On Tue, Oct 18, 2022 at 8:42 AM <jbra...@dismail.de> wrote: > >> October 18, 2022 1:55 PM, "Zain Jabbar" <zaijab2...@gmail.com> wrote: >> >> Aloha Guix Development Team, >> >> Thank you for your email. I attribute my successes to the fantastic >> documentation and my failures (as you will see in this email) to my >> own inability to read the documentation. >> >> I meant to mention, have you tried using ",build" in a geiser repl? >> It lets you build derivations/gexps and shows you the output in >> the store. I have found that super helpful when building my only >> guix service (not merged yet). >> >> From what I can tell, yes. Emacs does find the packages you install >> using this mechanism and loading them behaves as though you installed >> from a manifest. Let me know if you have a package you wish to test. I >> can email the results. >> >> emacs-debbugs. If it works, then that is awesome! Well done! >> >> But I would need more guidance to answer this question fully. There >> are some points of confusion I have relating to profiles and package >> availability. I will try to give my best answer using the >> documentation, source code, then a demo. >> >> One thing I can say for sure is that the packages are installed using >> the =home-profile-service-type=. According to the documentation at >> 13.3.1 Essential Home Services the =home-profile-service-type= can be >> "extended with a list of packages if you want to install additional >> packages into your profile". >> >> According to the source code in guix/gnu/home/services.scm >> #+BEGIN_SRC scheme >> ;; [In the big comment block line 76] >> ;;; home-profile-service-type is almost the same as >> profile-service-type, at least >> ;;; for now. >> .... ;; [Within the definition for home-profile-service-type (line 161)] >> (description >> "This is the @dfn{home profile} and can be found in >> @file{~/.guix-home/profile}. It contains packages and >> configuration files that the user has declared in their >> @code{home-environment} record.")) >> #+END_SRC >> >> It appears that using this configuration it installs it into the >> =~/.guix-home/profile=. Here is where I get a bit confused, when >> running =guix package --list-profiles= I get >> =/home/zjabbar/.config/guix/current= and >> =/home/zjabbar/.guix-profile=, neither of which are my home profile. >> >> Here is a demo. >> >> I do not have the =emacs-suneater-theme= package installed using my manifest. >> >> =guix package -I suneater= returns nothing when run in the terminal. >> >> After saving this configuration in the module: >> #+BEGIN_SRC scheme >> (define theme-configuration >> (emacs-configuration >> (emacs-packages (list (specification->package "emacs-suneater-theme"))) >> (init '((load-theme 'suneater t))))) >> #+END_SRC >> >> I find that Guix downloads and builds the package. After restarting >> Emacs, it comes up with the new theme and =M-x describe-theme= finds >> it and everything. That being said, =guix package -I suneater= *still* >> returns nothing when run in the terminal. I suppose it's because the >> theme was installed without using the =guix install= command >> specifically. >> >> =guix package -A suneater= does show me that suneater is available. >> However after deleting or commenting out the configuration in that >> source block, Emacs does not load the theme and Emacs cannot find the >> theme using =M-x describe-theme=. But =guix package -A suneater= still >> shows me that suneater is available. So it was removed according to >> Emacs but not to guix. I am likely not looking at the right =guix >> package= options. >> >> It sounds like you have created the home-emacs service is a way that works. >> I think your next move would be submit it guix-patc...@gnu.org. >> Feel free to CC me in the email. >> >> https://git-send-email.io >> >> Thanks, >> >> Joshua > > -- > Thank you, > Zain Jabbar