unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrew Tropin <andrew@trop.in>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 49419@debbugs.gnu.org
Subject: [bug#49419] [PATCH 0/4] Essential home services
Date: Wed, 28 Jul 2021 08:35:59 +0300	[thread overview]
Message-ID: <87lf5rj8zk.fsf@trop.in> (raw)
In-Reply-To: <87im13g0vs.fsf_-_@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 820 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Hi Andrew,
>
> Andrew Tropin <andrew@trop.in> skribis:
>
>> Diff with v2: Prevents unecessary calls to system*
>>
>> Please, when review finished, apply against guix-home-wip branch.
>>
>> Andrew Tropin (4):
>>   home-services: Add most essential home services
>>   home-services: Add home-run-on-change-service-type
>>   home-services: Add home-provenance-service-type
>>   home-services: Add fold-home-service-types function
>
> Thanks for sending this first patch series!
>
> How would you like to proceed?  Sending patches that add essential
> services, and then (guix scripts home …) modules?

Yep.

> I agree we should apply it all in ‘wip-guix-home’ for now.
>
> Some general comments:
>
>   • Please remove tabs from Scheme files.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-toberebased-gnu-home-services-Untabify-a-file.patch --]
[-- Type: text/x-patch, Size: 7915 bytes --]

From 26bfd8052d90650abc7e5ec6dbb7dd7165dfba3c Mon Sep 17 00:00:00 2001
From: Andrew Tropin <andrew@trop.in>
Date: Wed, 28 Jul 2021 08:22:20 +0300
Subject: [PATCH] (toberebased) gnu: home-services: Untabify a file

---
 gnu/home-services.scm | 80 +++++++++++++++++++++----------------------
 1 file changed, 40 insertions(+), 40 deletions(-)

diff --git a/gnu/home-services.scm b/gnu/home-services.scm
index 9afb70f0a7..94f0ccff7a 100644
--- a/gnu/home-services.scm
+++ b/gnu/home-services.scm
@@ -33,10 +33,10 @@
   #:use-module (ice-9 match)
 
   #:export (home-service-type
-	    home-profile-service-type
-	    home-environment-variables-service-type
-	    home-files-service-type
-	    home-run-on-first-login-service-type
+            home-profile-service-type
+            home-environment-variables-service-type
+            home-files-service-type
+            home-run-on-first-login-service-type
             home-activation-service-type
             home-run-on-change-service-type
             home-provenance-service-type
@@ -44,8 +44,8 @@
             fold-home-service-types)
 
   #:re-export (service
-	       service-type
-	       service-extension))
+               service-type
+               service-extension))
 
 ;;; Comment:
 ;;;
@@ -76,7 +76,7 @@ directory containing the given entries."
                 (extensions '())
                 (compose identity)
                 (extend home-derivation)
-		(default-value '())
+                (default-value '())
                 (description
                  "Build the home environment top-level directory,
 which in turn refers to everything the home environment needs: its
@@ -130,12 +130,12 @@ exported."
     (fold
      (lambda (x acc)
        (when (equal? (car x) (car acc))
-	 (warning
-	  (G_ "duplicate definition for `~a' environment variable ~%") (car x)))
+         (warning
+          (G_ "duplicate definition for `~a' environment variable ~%") (car x)))
        x)
      (cons "" "")
      (sort vars (lambda (a b)
-		  (string<? (car a) (car b))))))
+                  (string<? (car a) (car b))))))
 
   (warn-about-duplicate-defenitions)
   (with-monad
@@ -145,7 +145,7 @@ exported."
        ;; TODO: It's necessary to source ~/.guix-profile too
        ;; on foreign distros
        ,(apply mixed-text-file "setup-environment"
-	       "\
+               "\
 HOME_ENVIRONMENT=$HOME/.guix-home
 GUIX_PROFILE=\"$HOME_ENVIRONMENT/profile\"
 PROFILE_FILE=\"$HOME_ENVIRONMENT/profile/etc/profile\"
@@ -174,25 +174,25 @@ esac
 
 "
 
-	       (append-map
-		(match-lambda
-		  ((key . #f)
-		   '())
-		  ((key . #t)
-		   (list "export " key "\n"))
-		  ((key . value)
+               (append-map
+                (match-lambda
+                  ((key . #f)
+                   '())
+                  ((key . #t)
+                   (list "export " key "\n"))
+                  ((key . value)
                    (list "export " key "=" value "\n")))
-		vars)))))))
+                vars)))))))
 
 (define home-environment-variables-service-type
   (service-type (name 'home-environment-variables)
                 (extensions
                  (list (service-extension
-			home-service-type
+                        home-service-type
                         environment-variables->setup-environment-script)))
                 (compose concatenate)
                 (extend append)
-		(default-value '())
+                (default-value '())
                 (description "Set the environment variables.")))
 
 (define (files->files-directory files)
@@ -227,7 +227,7 @@ directory containing FILES."
                                           files-entry)))
                 (compose concatenate)
                 (extend append)
-		(default-value '())
+                (default-value '())
                 (description "Configuration files for programs that
 will be put in @file{~/.guix-home/files}.")))
 
@@ -235,32 +235,32 @@ will be put in @file{~/.guix-home/files}.")))
   (gexp->script
    "on-first-login"
    #~(let* ((xdg-runtime-dir (or (getenv "XDG_RUNTIME_DIR")
-				 (format #f "/run/user/~a" (getuid))))
-	    (flag-file-path (string-append
-			     xdg-runtime-dir "/on-first-login-executed"))
-	    (touch (lambda (file-name)
-		     (call-with-output-file file-name (const #t)))))
+                                 (format #f "/run/user/~a" (getuid))))
+            (flag-file-path (string-append
+                             xdg-runtime-dir "/on-first-login-executed"))
+            (touch (lambda (file-name)
+                     (call-with-output-file file-name (const #t)))))
        ;; XDG_RUNTIME_DIR dissapears on logout, that means such trick
        ;; allows to launch on-first-login script on first login only
        ;; after complete logout/reboot.
        (when (not (file-exists? flag-file-path))
-	 (begin #$@gexps (touch flag-file-path))))))
+         (begin #$@gexps (touch flag-file-path))))))
 
 (define (on-first-login-script-entry m-on-first-login)
   "Return, as a monadic value, an entry for the on-first-login script
 in the home environment directory."
   (mlet %store-monad ((on-first-login m-on-first-login))
-	(return `(("on-first-login" ,on-first-login)))))
+        (return `(("on-first-login" ,on-first-login)))))
 
 (define home-run-on-first-login-service-type
   (service-type (name 'home-run-on-first-login)
                 (extensions
                  (list (service-extension
-			home-service-type
+                        home-service-type
                         on-first-login-script-entry)))
                 (compose identity)
                 (extend compute-on-first-login-script)
-		(default-value #f)
+                (default-value #f)
                 (description "Run gexps on first user login.  Can be
 extended with one gexp.")))
 
@@ -281,18 +281,18 @@ extended with one gexp.")))
                               #f))))
        (if (file-exists? (he-init-file new-home))
            (let* ((port   ((@ (ice-9 popen) open-input-pipe)
-		           (format #f "source ~a && env"
+                           (format #f "source ~a && env"
                                    (he-init-file new-home))))
-	          (result ((@ (ice-9 rdelim) read-delimited) "" port))
-	          (vars (map (lambda (x)
+                  (result ((@ (ice-9 rdelim) read-delimited) "" port))
+                  (vars (map (lambda (x)
                                (let ((si (string-index x #\=)))
                                  (cons (string-take x si)
                                        (string-drop x (1+ si)))))
-			     ((@ (srfi srfi-1) remove)
-			      string-null?
+                             ((@ (srfi srfi-1) remove)
+                              string-null?
                               (string-split result #\newline)))))
-	     (close-port port)
-	     (map (lambda (x) (setenv (car x) (cdr x))) vars)
+             (close-port port)
+             (map (lambda (x) (setenv (car x) (cdr x))) vars)
 
              (setenv "GUIX_NEW_HOME" new-home)
              (setenv "GUIX_OLD_HOME" old-home)
@@ -319,11 +319,11 @@ in the home environment directory."
   (service-type (name 'home-activation)
                 (extensions
                  (list (service-extension
-			home-service-type
+                        home-service-type
                         activation-script-entry)))
                 (compose identity)
                 (extend compute-activation-script)
-		(default-value #f)
+                (default-value #f)
                 (description "Run gexps to activate the current
 generation of home environment and update the state of the home
 directory.  @command{activate} script automatically called during
-- 
2.32.0


[-- Attachment #1.3: Type: text/plain, Size: 1997 bytes --]


> • Please do not write documentation in commit logs.  For example,
>     patch #1 explains the different service types, but to me, that’d
>     belong in a comment or (better yet) in a section of the manual.  For
>     commit logs, we use ChangeLog style:
>
>       https://guix.gnu.org/manual/en/html_node/Submitting-Patches.html
>
>     It’s OK if you don’t get the fine points right from the start,
>     committers can tweak it for you.  :-)

True, I forgot to add ChangeLog style parts to first two patches.  The
rest of commit message originally was just an explanation for reviewers
to provide a context, but yep it's already looks like a documentation)

>
> • When there are tests or documentation, add them in the commit that
>     adds the corresponding functionality.

Wanted to add documentation with a separate patch series to make patch
series to wip-guix-home be smaller and easier for review, but probably
you are right, I should add related documentation in the same series.

>   • Regarding module names: what about putting everything in the (gnu
>     home …) name space.  For services, I wonder if we could simply use
>     (gnu services home), for the essential services, and other (gnu
>     services …) module, but that assumes some code can be shared between
>     System and Home.  Thoughts?

There was a thread on rde-devel about moving home services to (gnu
services ...), in the second half of the first response I provided some
arguments against this change.
https://lists.sr.ht/~abcdw/rde-devel/%3C87y2cqifpx.fsf%40yoctocell.xyz%3E

However, I can miss some niceties, so I still open for discussion if you
think that arguments from the thread isn't valid anymore or not valid at
all.

> I’ll look at the actual patches later, but I invite others to chime in
> too.  :-)

Cool, I'll wait for the review of the code and will prepare a new
version of patch series after that.

Thank you for the comments!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]

  reply	other threads:[~2021-07-28  5:39 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 15:35 [bug#49419] [PATCH 0/4] Essential home services Andrew Tropin
2021-07-05 15:37 ` [bug#49419] [PATCH 1/4] home-services: Add most essential " Andrew Tropin
2021-07-05 15:47   ` Maxime Devos
2021-07-05 16:19     ` Andrew Tropin
2021-07-05 19:19       ` Maxime Devos
2021-07-06  7:09         ` Andrew Tropin
2021-07-06  8:26           ` Maxime Devos
2021-07-06  7:23     ` Andrew Tropin
2021-07-05 15:39 ` [bug#49419] [PATCH 2/4] home-services: Add home-run-on-change-service-type Andrew Tropin
2021-07-05 15:41 ` [bug#49419] [PATCH 3/4] home-services: Add home-provenance-service-type Andrew Tropin
2021-07-05 15:41 ` [bug#49419] [PATCH 4/4] home-services: Add fold-home-service-types function Andrew Tropin
2021-07-13 16:17 ` [bug#49419] [PATCH v2 0/4] Essential home services Andrew Tropin
2021-07-05 15:37   ` [bug#49546] [PATCH v2 1/4] home-services: Add most essential " Andrew Tropin
     [not found]     ` <handler.49546.B.16262002971832.ack@debbugs.gnu.org>
2021-07-13 18:24       ` [bug#49546] Acknowledgement ([PATCH v2 1/4] home-services: Add most essential home services) Andrew Tropin
2021-07-05 15:39   ` [bug#49547] [PATCH v2 2/4] home-services: Add home-run-on-change-service-type Andrew Tropin
2021-07-14 10:41     ` Maxime Devos
2021-07-15  8:46       ` Andrew Tropin
2021-07-18 16:17         ` Maxime Devos
2021-07-05 15:41   ` [bug#49548] [PATCH v2 3/4] home-services: Add home-provenance-service-type Andrew Tropin
2021-07-05 15:41   ` [bug#49549] [PATCH v2 4/4] home-services: Add fold-home-service-types function Andrew Tropin
2021-07-15  9:59   ` [bug#49568] Testing reply without debbugs address Andrew Tropin
2021-07-19  8:04 ` [bug#49419] [PATCH v3 0/4] Essential home services Andrew Tropin
2021-07-05 15:37   ` [bug#49419] [PATCH v3 1/4] home-services: Add most essential " Andrew Tropin
2021-07-05 15:39   ` [bug#49419] [PATCH v3 2/4] home-services: Add home-run-on-change-service-type Andrew Tropin
2021-07-05 15:41   ` [bug#49419] [PATCH v3 3/4] home-services: Add home-provenance-service-type Andrew Tropin
2021-07-05 15:41   ` [bug#49419] [PATCH v3 4/4] home-services: Add fold-home-service-types function Andrew Tropin
2021-07-21 15:08   ` [bug#49419] [PATCH 0/4] Essential home services Ludovic Courtès
2021-07-28  5:35     ` Andrew Tropin [this message]
     [not found] ` <handler.49419.B.162549932625345.ack@debbugs.gnu.org>
2021-08-05  5:41   ` [bug#49419] [PATCH v4 " Andrew Tropin
2021-08-05  5:45     ` [bug#49419] [PATCH v4 1/4] home-services: Add most essential " Andrew Tropin
2021-08-05  5:46     ` [bug#49419] [PATCH v4 2/4] home-services: Add home-run-on-change-service-type Andrew Tropin
2021-08-05  5:46     ` [bug#49419] [PATCH v4 3/4] home-services: Add home-provenance-service-type Andrew Tropin
2021-08-05  5:47     ` [bug#49419] [PATCH v4 4/4] home-services: Add fold-home-service-types function Andrew Tropin
2021-08-23  9:57     ` [bug#49419] [PATCH v4 0/4] Essential home services Andrew Tropin
2021-08-23 16:24       ` [bug#49419] [PATCH " Oleg Pykhalov
2021-08-24  8:53         ` Andrew Tropin
2021-08-24 12:14           ` bug#49419: " Oleg Pykhalov
2021-08-26  7:01             ` [bug#49419] " Andrew Tropin

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=87lf5rj8zk.fsf@trop.in \
    --to=andrew@trop.in \
    --cc=49419@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /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).