From patchwork Thu Oct 20 01:59:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zain Jabbar X-Patchwork-Id: 43731 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8612C27BBEA; Thu, 20 Oct 2022 14:24:27 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 611E427BBE9 for ; Thu, 20 Oct 2022 14:24:26 +0100 (BST) Received: from localhost ([::1]:53522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olVX2-0000bE-PL for patchwork@mira.cbaines.net; Thu, 20 Oct 2022 09:24:23 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olV2K-0002u1-C5 for patchwork@mira.cbaines.net; Thu, 20 Oct 2022 08:52:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olLUW-00074a-Fb for guix-patches@gnu.org; Wed, 19 Oct 2022 22:41:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33439) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1olLUW-0000sM-3w for guix-patches@gnu.org; Wed, 19 Oct 2022 22:41:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1olLUV-0005Cs-Ux for guix-patches@gnu.org; Wed, 19 Oct 2022 22:41:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58652] Creating home-emacs-service-type Resent-From: Zain Jabbar Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 20 Oct 2022 02:41:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58652 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 58652@debbugs.gnu.org, jbranso@dismail.de X-Debbugs-Original-To: guix-patches@gnu.org, jbranso@dismail.de Received: via spool by submit@debbugs.gnu.org id=B.166623364019946 (code B ref -1); Thu, 20 Oct 2022 02:41:03 +0000 Received: (at submit) by debbugs.gnu.org; 20 Oct 2022 02:40:40 +0000 Received: from localhost ([127.0.0.1]:60746 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olLU7-0005BY-VV for submit@debbugs.gnu.org; Wed, 19 Oct 2022 22:40:40 -0400 Received: from lists.gnu.org ([209.51.188.17]:51884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olKqF-000496-VZ for submit@debbugs.gnu.org; Wed, 19 Oct 2022 21:59:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olKqF-0000Ar-OL for guix-patches@gnu.org; Wed, 19 Oct 2022 21:59:27 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]:45596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1olKqD-00015g-MR for guix-patches@gnu.org; Wed, 19 Oct 2022 21:59:27 -0400 Received: by mail-ej1-x630.google.com with SMTP id sc25so44017263ejc.12 for ; Wed, 19 Oct 2022 18:59:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=qiWfhCTnU5Lul75gz2L3HqqLuY5aHvj6dy1/ALt/Nlg=; b=EkXE3wu0zcE1A2Ukzykc2i6RhSW/ixourzn5qKlAu5cXWpT93eFRJ/QhzKvAcXBhiU HruOA0W7UausIkL9ADkfrgYGNUWjQAupioX6WQfDwQwatxFPRNC0xizNj04eWH6MAUwA rEwxNhOQkG4LCM8gTVYeEvPM9bLxgxEPVHKIivwkcif5r5XOrHnhy0cKJ9t6+oZKmg1R v9PBh/liUqJF6b6Wq2UF8tChwQVZgIX4709ip0iSfovueZyR7Wk0QAZsuFlwfV+34e8Y 4vCe/bbPpKxOzuQzYz2jTPh73ltIVCEX5WGQGkqubHpH14JjjAjzd5xlYw2DN2yIrhYE 0QDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qiWfhCTnU5Lul75gz2L3HqqLuY5aHvj6dy1/ALt/Nlg=; b=YrHwiBbBQBhOXrWZfrckGeYrL/6ID3czU4s9c6fstuk2XmgqJ/q1Ned6R5J5kqEwGt 6pStip3oTwwKRi5faSlyJGw10odLUO+nWCyKZlJNlwLub0qQqjdTz6Jjqy3jOyeJHVJh vFBSbitvQM2Zbbx7SSHxndR884bhDYT0s20fQY1WTbNCYjbOCrf09RtsFsmDpSioXbqS ak9TbZFsOGB9e9XucOVoYwWqhdVhzK84PALy4dlwHD5k8MLDliHkDnt/NnPqMClbLA/u q7HeG9JDfyTYnyudHSV6oG7IE/NyA7o4Ao9C44n/kir2IlVfqv0rvVHcPUZ1CBD5re8H UeoA== X-Gm-Message-State: ACrzQf30WgC0go37DebUAQxd7SP8npQqcDl0+1IVNernHPLfw4qGTRYd ZGDMmZ+ulusX+lluTwO1t61jcR3TquYuGgSOgpTQ+wtdlSs= X-Google-Smtp-Source: AMsMyM5FQL9QuYIPqRPp44dEJwVIFVobmgEAZZzXfGKGc2+/J70/ZuAPueTAD/wRpMDmURZlFjZfvLvTqKQ3Cd99DXU= X-Received: by 2002:a17:907:1c10:b0:791:a716:5089 with SMTP id nc16-20020a1709071c1000b00791a7165089mr5279870ejc.672.1666231163616; Wed, 19 Oct 2022 18:59:23 -0700 (PDT) MIME-Version: 1.0 From: Zain Jabbar Date: Wed, 19 Oct 2022 15:59:12 -1000 Message-ID: Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=zaijab2000@gmail.com; helo=mail-ej1-x630.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 19 Oct 2022 22:40:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Thu, 20 Oct 2022 08:45:30 -0400 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Aloha Guix Development Team, First submission of a patch to this mail service. Hopefully this works. I welcome any and all feedback. Attached is a patch which creates a new file =/gnu/home/services/emacs.scm= which defines a new service =home-emacs-service-type= and a configuration for said service =home-emacs-configuration=. The configuration contains a list of packages to add to the home-profile, and a list of expressions to add into Emacs' =init.el= and =early-init.el=. Here is an example of a home environment file which: Adds the following packages: - =bash= - =emacs-next= - =emacs-debbugs= - =emacs-evil= - =emacs-paredit= - =emacs-anzu= Overwrites the =.config/emacs/init.el= with: #+BEGIN_SRC emacs-lisp (evil-mode 1) #+END_SRC Overwrites the =.config/emacs/early-init.el= with: #+BEGIN_SRC emacs-lisp (setq warning-suppress-log-types '((comp) (comp))) (setq warning-suppress-types '((comp) (comp))) #+END_SRC #+BEGIN_SRC scheme (use-modules (gnu home services emacs) (gnu home) (gnu packages) (ice-9 pretty-print) (gnu services)) (define-public minimal-home-environment (home-environment (services (list (service home-emacs-service-type (home-emacs-configuration (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))) (early-init '((setq warning-suppress-log-types '((comp) (comp))) (setq warning-suppress-types '((comp) (comp))))))))))) minimal-home-environment #+END_SRC Saving this text into a file =minimal-working-example.scm= allows us to run this configuration with =guix home -N --share=/tmp container ./minimal-working-example.scm=. diff --git a/gnu/home/services/emacs.scm b/gnu/home/services/emacs.scm deleted file mode 100644 index a3951c2a85..0000000000 --- a/gnu/home/services/emacs.scm +++ /dev/null @@ -1,63 +0,0 @@ -;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2022 Zain Jabbar -;;; -;;; This file is part of GNU Guix. -;;; -;;; 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 . - -(define-module (gnu home services emacs) - #: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) - - #:export (home-emacs-service-type - home-emacs-configuration)) - -(define file-likes? (list-of file-like?)) - -(define-configuration/no-serialization home-emacs-configuration - (packages - (file-likes (list (specification->package "emacs"))) - "The packages this configuration will add to home-profile. Usually these will be emacs-* packages.") - (early-init - (list '()) - "A list whose contents will inserted into @file{$XDG_CONFIG_HOME/emacs/early-init.el}") - (init - (list '()) - "A list whose contents will inserted into @file{$XDG_CONFIG_HOME/emacs/init.el}")) - -(define home-emacs-service-type - (service-type (name 'emacs-configuration) - (extensions - (list (service-extension - home-profile-service-type - (lambda (config) (home-emacs-configuration-packages config))) - (service-extension - home-xdg-configuration-files-service-type - (lambda (config) - (list - `("emacs/early-init.el" - ,(scheme-file "early-init.el" - (home-emacs-configuration-early-init config) - #:splice? #:t)) - `("emacs/init.el" - ,(scheme-file "init.el" - (home-emacs-configuration-init config) - #:splice? #:t))))))) - (default-value (home-emacs-configuration)) - (description "Configures Emacs and installs packages to home-profile.")))