Package: guix-patches;
Reported by: Andrew Tropin <andrew <at> trop.in>
Date: Mon, 5 Jul 2021 15:36:01 UTC
Severity: normal
Tags: patch
Merged with 49546, 49547, 49548, 49549
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 49419 in the body.
You can then email your comments to 49419 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
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 05 Jul 2021 15:36:01 GMT) Full text and rfc822 format available.Andrew Tropin <andrew <at> trop.in>
:guix-patches <at> gnu.org
.
(Mon, 05 Jul 2021 15:36:01 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: guix-patches <at> gnu.org Subject: [PATCH 0/4] Essential home services Date: Mon, 05 Jul 2021 18:35:14 +0300
[Message part 1 (text/plain, inline)]
This patch series contains most crucial home services and few helper functions required for Guix Home. 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 gnu/home-services.scm | 472 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 472 insertions(+) create mode 100644 gnu/home-services.scm -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 05 Jul 2021 15:38:02 GMT) Full text and rfc822 format available.Message #8 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH 1/4] home-services: Add most essential home services Date: Mon, 05 Jul 2021 18:37:13 +0300
[Message part 1 (text/plain, inline)]
home-service-type is a root of home services DAG. home-profile-service-type is almost the same as profile-service-type, at least for now. home-environment-variables-service-type generates a @file{setup-environment} shell script, which is expected to be sourced by login shell or other program, which starts early and spawns all other processes. Home services for shells automatically add code for sourcing this file, if person do not use those home services they have to source this script manually in their's shell *profile file (details described in the manual). home-files-service-type is similar to etc-service-type, but doesn't extend home-activation, because deploy mechanism for config files is pluggable and can be different for different home environments: The default one is called symlink-manager (will be introudced in a separate patch series), which creates links for various dotfiles (like $XDG_CONFIG_HOME/$APP/...) to store, but is possible to implement alternative approaches like read-only home from Julien's guix-home-manager. home-run-on-first-login-service-type provides an @file{on-first-login} guile script, which runs provided gexps once, when user makes first login. It can be used to start user's Shepherd and maybe some other process. It relies on assumption that /run/user/$UID will be created on login by some login manager (elogind for example). home-activation-service-type provides an @file{activate} guile script, which do three main things: - Sets environment variables to the values declared in @file{setup-environment} shell script. It's necessary, because user can set for example XDG_CONFIG_HOME and it should be respected by activation gexp of symlink-manager. - Sets GUIX_NEW_HOME and possibly GUIX_OLD_HOME vars to paths in the store. Later those variables can be used by activation gexps, for example by symlink-manager or run-on-change services. - Run all activation gexps provided by other home services. --- gnu/home-services.scm | 328 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 328 insertions(+) create mode 100644 gnu/home-services.scm diff --git a/gnu/home-services.scm b/gnu/home-services.scm new file mode 100644 index 0000000000..44a7e68934 --- /dev/null +++ b/gnu/home-services.scm @@ -0,0 +1,328 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> +;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> +;;; +;;; 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 <http://www.gnu.org/licenses/>. + +(define-module (gnu home-services) + #:use-module (gnu services) + #:use-module (guix channels) + #:use-module (guix monads) + #:use-module (guix store) + #:use-module (guix gexp) + #:use-module (guix profiles) + #:use-module (guix sets) + #:use-module (guix ui) + #:use-module (guix discovery) + #:use-module (guix diagnostics) + + #:use-module (srfi srfi-1) + #: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-activation-service-type) + + #:re-export (service + service-type + service-extension)) + +;;; Comment: +;;; +;;; This module is similar to (gnu system services) module, but +;;; provides Home Services, which are supposed to be used for building +;;; home-environment. +;;; +;;; Home Services use the same extension as System Services. Consult +;;; (gnu system services) module or manual for more information. +;;; +;;; Code: + + +(define (home-derivation entries mextensions) + "Return as a monadic value the derivation of the 'home' +directory containing the given entries." + (mlet %store-monad ((extensions (mapm/accumulate-builds identity + mextensions))) + (lower-object + (file-union "home" (append entries (concatenate extensions)))))) + +(define home-service-type + ;; This is the ultimate service type, the root of the home service + ;; DAG. The service of this type is extended by monadic name/item + ;; pairs. These items end up in the "home-environment directory" as + ;; returned by 'home-environment-derivation'. + (service-type (name 'home) + (extensions '()) + (compose identity) + (extend home-derivation) + (default-value '()) + (description + "Build the home environment top-level directory, +which in turn refers to everything the home environment needs: its +packages, configuration files, activation script, and so on."))) + +(define (packages->profile-entry packages) + "Return a system entry for the profile containing PACKAGES." + ;; XXX: 'mlet' is needed here for one reason: to get the proper + ;; '%current-target' and '%current-target-system' bindings when + ;; 'packages->manifest' is called, and thus when the 'package-inputs' + ;; etc. procedures are called on PACKAGES. That way, conditionals in those + ;; inputs see the "correct" value of these two parameters. See + ;; <https://issues.guix.gnu.org/44952>. + (mlet %store-monad ((_ (current-target-system))) + (return `(("profile" ,(profile + (content (packages->manifest + (map identity + ;;(options->transformation transformations) + (delete-duplicates packages eq?)))))))))) + +;; MAYBE: Add a list of transformations for packages. It's better to +;; place it in home-profile-service-type to affect all profile +;; packages and prevent conflicts, when other packages relies on +;; non-transformed version of package. +(define home-profile-service-type + (service-type (name 'home-profile) + (extensions + (list (service-extension home-service-type + packages->profile-entry))) + (compose concatenate) + (extend append) + (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."))) + +(define (environment-variables->setup-environment-script vars) + "Return a file that can be sourced by a POSIX compliant shell which +initializes the environment. The file will source the home +environment profile, set some default environment variables, and set +environment variables provided in @code{vars}. @code{vars} is a list +of pairs (@code{(key . value)}), @code{key} is a string and +@code{value} is a string or gexp. + +If value is @code{#f} variable will be omitted. +If value is @code{#t} variable will be just exported. +For any other, value variable will be set to the @code{value} and +exported." + (define (warn-about-duplicate-defenitions) + (fold + (lambda (x acc) + (when (equal? (car x) (car acc)) + (warning + (G_ "duplicate definition for `~a' environment variable ~%") (car x))) + x) + (cons "" "") + (sort vars (lambda (a b) + (string<? (car a) (car b)))))) + + (warn-about-duplicate-defenitions) + (with-monad + %store-monad + (return + `(("setup-environment" + ;; 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\" +[ -f $PROFILE_FILE ] && . $PROFILE_FILE + +case $XDG_DATA_DIRS in + *$HOME_ENVIRONMENT/profile/share*) ;; + *) export XDG_DATA_DIRS=$HOME_ENVIRONMENT/profile/share:$XDG_DATA_DIRS ;; +esac +case $MANPATH in + *$HOME_ENVIRONMENT/profile/share/man*) ;; + *) export MANPATH=$HOME_ENVIRONMENT/profile/share/man:$MANPATH +esac +case $INFOPATH in + *$HOME_ENVIRONMENT/profile/share/info*) ;; + *) export INFOPATH=$HOME_ENVIRONMENT/profile/share/info:$INFOPATH ;; +esac +case $XDG_CONFIG_DIRS in + *$HOME_ENVIRONMENT/profile/etc/xdg*) ;; + *) export XDG_CONFIG_DIRS=$HOME_ENVIRONMENT/profile/etc/xdg:$XDG_CONFIG_DIRS ;; +esac +case $XCURSOR_PATH in + *$HOME_ENVIRONMENT/profile/share/icons*) ;; + *) export XCURSOR_PATH=$HOME_ENVIRONMENT/profile/share/icons:$XCURSOR_PATH ;; +esac + +" + + (append-map + (match-lambda + ((key . #f) + '()) + ((key . #t) + (list "export " key "\n")) + ((key . value) + (list "export " key "=" value "\n"))) + vars))))))) + +(define home-environment-variables-service-type + (service-type (name 'home-environment-variables) + (extensions + (list (service-extension + home-service-type + environment-variables->setup-environment-script))) + (compose concatenate) + (extend append) + (default-value '()) + (description "Set the environment variables."))) + +(define (files->files-directory files) + "Return a @code{files} directory that contains FILES." + (define (assert-no-duplicates files) + (let loop ((files files) + (seen (set))) + (match files + (() #t) + (((file _) rest ...) + (when (set-contains? seen file) + (raise (formatted-message (G_ "duplicate '~a' entry for files/") + file))) + (loop rest (set-insert file seen)))))) + + ;; Detect duplicates early instead of letting them through, eventually + ;; leading to a build failure of "files.drv". + (assert-no-duplicates files) + + (file-union "files" files)) + +(define (files-entry files) + "Return an entry for the @file{~/.guix-home/files} +directory containing FILES." + (with-monad %store-monad + (return `(("files" ,(files->files-directory files)))))) + +(define home-files-service-type + (service-type (name 'home-files) + (extensions + (list (service-extension home-service-type + files-entry))) + (compose concatenate) + (extend append) + (default-value '()) + (description "Configuration files for programs that +will be put in @file{~/.guix-home/files}."))) + +(define (compute-on-first-login-script _ gexps) + (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))))) + ;; 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)))))) + +(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))))) + +(define home-run-on-first-login-service-type + (service-type (name 'home-run-on-first-login) + (extensions + (list (service-extension + home-service-type + on-first-login-script-entry))) + (compose identity) + (extend compute-on-first-login-script) + (default-value #f) + (description "Run gexps on first user login. Can be +extended with one gexp."))) + + +(define (compute-activation-script init-gexp gexps) + (gexp->script + "activate" + #~(let* ((he-init-file (lambda (he) (string-append he "/setup-environment"))) + (he-path (string-append (getenv "HOME") "/.guix-home")) + (new-home-env (getenv "GUIX_NEW_HOME")) + (new-home (or new-home-env + ;; Path of the activation file if called interactively + (dirname (car (command-line))))) + (old-home-env (getenv "GUIX_OLD_HOME")) + (old-home (or old-home-env + (if (file-exists? (he-init-file he-path)) + (readlink he-path) + #f)))) + (if (file-exists? (he-init-file new-home)) + (let* ((port ((@@ (ice-9 popen) open-input-pipe) + (format #f "source ~a && env" + (he-init-file new-home)))) + (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? + (string-split result #\newline))))) + (close-port port) + (map (lambda (x) (setenv (car x) (cdr x))) vars) + + (setenv "GUIX_NEW_HOME" new-home) + (setenv "GUIX_OLD_HOME" old-home) + + #$@gexps + + ;; Do not unset env variable if it was set outside. + (unless new-home-env (setenv "GUIX_NEW_HOME" #f)) + (unless old-home-env (setenv "GUIX_OLD_HOME" #f))) + (format #t "\ +Activation script was either called or loaded by file from this direcotry: +~a +It doesn't seem that home environment is somewhere around. +Make sure that you call ./activate by symlink from -home store item.\n" + new-home))))) + +(define (activation-script-entry m-activation) + "Return, as a monadic value, an entry for the activation script +in the home environment directory." + (mlet %store-monad ((activation m-activation)) + (return `(("activate" ,activation))))) + +(define home-activation-service-type + (service-type (name 'home-activation) + (extensions + (list (service-extension + home-service-type + activation-script-entry))) + (compose identity) + (extend compute-activation-script) + (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 +reconfiguration or generation switching. This service can be extended +with one gexp, but many times, and all gexps must be idempotent."))) + -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 05 Jul 2021 15:40:02 GMT) Full text and rfc822 format available.Message #11 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH 2/4] home-services: Add home-run-on-change-service-type Date: Mon, 05 Jul 2021 18:39:44 +0300
[Message part 1 (text/plain, inline)]
Service allows to trigger actions during activation if file or directory specified by pattern is changed. --- gnu/home-services.scm | 95 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/gnu/home-services.scm b/gnu/home-services.scm index 44a7e68934..002a003d65 100644 --- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -37,7 +37,8 @@ home-environment-variables-service-type home-files-service-type home-run-on-first-login-service-type - home-activation-service-type) + home-activation-service-type + home-run-on-change-service-type) #:re-export (service service-type @@ -326,3 +327,95 @@ directory. @command{activate} script automatically called during reconfiguration or generation switching. This service can be extended with one gexp, but many times, and all gexps must be idempotent."))) + +;;; +;;; On-change. +;;; + +(define (compute-on-change-gexp eval-gexps? pattern-gexp-tuples) + #~(begin + (define (equal-regulars? file1 file2) + "Check if FILE1 and FILE2 are bit for bit identical." + (let* ((cmp-binary #$(file-append + (@@ (gnu packages base) diffutils) "/bin/cmp")) + (status (system* cmp-binary file1 file2))) + (= status 0))) + + (define (equal-symlinks? symlink1 symlink2) + "Check if SYMLINK1 and SYMLINK2 are pointing to the same target." + (string=? (readlink symlink1) (readlink symlink2))) + + (define (equal-directories? dir1 dir2) + "Check if DIR1 and DIR2 have the same content." + (define (ordinary-file file) + (not (or (string=? file ".") + (string=? file "..")))) + (let* ((files1 (scandir dir1 ordinary-file)) + (files2 (scandir dir2 ordinary-file))) + (if (equal? files1 files2) + (map (lambda (file) + (equal-files? + (string-append dir1 "/" file) + (string-append dir2 "/" file))) + files1) + #f))) + + (define (equal-files? file1 file2) + "Compares files, symlinks or directories of the same type." + (case (file-type file1) + ((directory) (equal-directories? file1 file2)) + ((symlink) (equal-symlinks? file1 file2)) + ((regular) (equal-regulars? file1 file2)) + (else + (display "The file type is unsupported by on-change service.\n") + #f))) + + (define (file-type file) + (stat:type (lstat file))) + + (define (something-changed? file1 file2) + (cond + ((and (not (file-exists? file1)) + (not (file-exists? file2))) #f) + ((or (not (file-exists? file1)) + (not (file-exists? file2))) #t) + + ((not (eq? (file-type file1) (file-type file2))) #t) + + (else + (not (equal-files? file1 file2))))) + + (define expressions-to-eval + (map + (lambda (x) + (let* ((file1 (string-append (getenv "GUIX_OLD_HOME") "/" (car x))) + (file2 (string-append (getenv "GUIX_NEW_HOME") "/" (car x))) + (_ (format #t "Comparing ~a and\n~10t~a..." file1 file2)) + (any-changes? (something-changed? file1 file2)) + (_ (format #t " done (~a)\n" + (if any-changes? "changed" "same")))) + (if any-changes? (cadr x) ""))) + '#$pattern-gexp-tuples)) + + (if #$eval-gexps? + (begin + (display "Evaling on-change gexps.\n\n") + (for-each primitive-eval expressions-to-eval) + (display "On-change gexps evaluation finished.\n\n")) + (display "\ +On-change gexps won't evaluated, disabled by service configuration.\n")))) + +(define home-run-on-change-service-type + (service-type (name 'home-run-on-change) + (extensions + (list (service-extension + home-activation-service-type + identity))) + (compose concatenate) + (extend compute-on-change-gexp) + (default-value #t) + (description "\ +G-expressions to run if the specified files have changed since the +last generation. The extension should be a list of lists where the +first element is the pattern for file or directory that expected to be +changed, and the second element is the G-expression to be evaluated."))) -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 05 Jul 2021 15:42:02 GMT) Full text and rfc822 format available.Message #14 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH 3/4] home-services: Add home-provenance-service-type Date: Mon, 05 Jul 2021 18:41:07 +0300
[Message part 1 (text/plain, inline)]
* gnu/home-services.scm (home-provenance-service-type, sexp->home-provenance, home-provenance): New variables. --- gnu/home-services.scm | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/gnu/home-services.scm b/gnu/home-services.scm index 002a003d65..20a9537650 100644 --- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -38,7 +38,10 @@ home-files-service-type home-run-on-first-login-service-type home-activation-service-type - home-run-on-change-service-type) + home-run-on-change-service-type + home-provenance-service-type + + fold-home-service-types) #:re-export (service service-type @@ -419,3 +422,25 @@ G-expressions to run if the specified files have changed since the last generation. The extension should be a list of lists where the first element is the pattern for file or directory that expected to be changed, and the second element is the G-expression to be evaluated."))) + + +;;; +;;; Provenance tracking. +;;; + +(define home-provenance-service-type + (service-type + (name 'home-provenance) + (extensions + (list (service-extension + home-service-type + (service-extension-compute + (first (service-type-extensions provenance-service-type)))))) + (default-value #f) ;the HE config file + (description "\ +Store provenance information about the home environment in the home +environment itself: the channels used when building the home +environment, and its configuration file, when available."))) + +(define sexp->home-provenance sexp->system-provenance) +(define home-provenance system-provenance) -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 05 Jul 2021 15:42:02 GMT) Full text and rfc822 format available.Message #17 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH 4/4] home-services: Add fold-home-service-types function Date: Mon, 05 Jul 2021 18:41:45 +0300
[Message part 1 (text/plain, inline)]
* gnu/home-services.scm (parent-directory, %guix-home-root-directory, %service-type-path, all-home-service-modules, fold-home-service-types): New variables. --- gnu/home-services.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gnu/home-services.scm b/gnu/home-services.scm index 20a9537650..a06cd72459 100644 --- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -444,3 +444,29 @@ environment, and its configuration file, when available."))) (define sexp->home-provenance sexp->system-provenance) (define home-provenance system-provenance) + + +;;; +;;; Searching +;;; + +(define (parent-directory directory) + "Get the parent directory of DIRECTORY" + (string-join (drop-right (string-split directory #\/) 1) "/")) + +(define %guix-home-root-directory + ;; Absolute file name of the module hierarchy. + (parent-directory (dirname (search-path %load-path "gnu/home-services.scm")))) + +(define %service-type-path + ;; Search path for service types. + (make-parameter `((,%guix-home-root-directory . "gnu/home-services")))) + +(define (all-home-service-modules) + "Return the default set of home-service modules." + (cons (resolve-interface '(gnu home-services)) + (all-modules (%service-type-path) + #:warn warn-about-load-error))) + +(define* (fold-home-service-types proc seed) + (fold-service-types proc seed (all-home-service-modules))) -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 05 Jul 2021 15:48:02 GMT) Full text and rfc822 format available.Message #20 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Maxime Devos <maximedevos <at> telenet.be> To: Andrew Tropin <andrew <at> trop.in>, 49419 <at> debbugs.gnu.org Subject: Re: [bug#49419] [PATCH 1/4] home-services: Add most essential home services Date: Mon, 05 Jul 2021 17:47:25 +0200
[Message part 1 (text/plain, inline)]
Hi, Andrew Tropin schreef op ma 05-07-2021 om 18:37 [+0300]: > + (if (file-exists? (he-init-file new-home)) > + (let* ((port ((@@ (ice-9 popen) open-input-pipe) > + (format #f "source ~a && env" > + (he-init-file new-home)))) > + (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? > + (string-split result #\newline))))) Why are you using @@ here? 'open-input-pipe', 'read-delimited' and 'remove' are exported variables, so you can just use @ instead of the magic evil @@ operator. From the guile manual: -- syntax: @ module-name binding-name Refer to the binding named BINDING-NAME in module MODULE-NAME. The binding must have been exported by the module. -- syntax: @@ module-name binding-name Refer to the binding named BINDING-NAME in module MODULE-NAME. The binding must not have been exported by the module. This syntax is only intended for debugging purposes or as a last resort. *Note Declarative Modules::, for some limitations on the use of ‘@@’. Greetings, Maxime.
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 05 Jul 2021 16:20:02 GMT) Full text and rfc822 format available.Message #23 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Maxime Devos <maximedevos <at> telenet.be>, 49419 <at> debbugs.gnu.org Subject: Re: [bug#49419] [PATCH 1/4] home-services: Add most essential home services Date: Mon, 05 Jul 2021 19:19:39 +0300
[Message part 1 (text/plain, inline)]
Maxime Devos <maximedevos <at> telenet.be> writes: > Hi, > > Andrew Tropin schreef op ma 05-07-2021 om 18:37 [+0300]: >> + (if (file-exists? (he-init-file new-home)) >> + (let* ((port ((@@ (ice-9 popen) open-input-pipe) >> + (format #f "source ~a && env" >> + (he-init-file new-home)))) >> + (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? >> + (string-split result #\newline))))) > > Why are you using @@ here? 'open-input-pipe', 'read-delimited' and 'remove' > are exported variables, so you can just use @ instead of the magic evil @@ > operator. Because of a bad habbit, I needed it once and after that started to use it uncoditionally. It should be @, thanks for pointing! BTW, how to add changes to the patches? Do I need to resend a particular patch with required updates or have to wait other reviews and send a v2 patch series?
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 05 Jul 2021 19:20:01 GMT) Full text and rfc822 format available.Message #26 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Maxime Devos <maximedevos <at> telenet.be> To: Andrew Tropin <andrew <at> trop.in>, 49419 <at> debbugs.gnu.org Subject: Re: [bug#49419] [PATCH 1/4] home-services: Add most essential home services Date: Mon, 05 Jul 2021 21:19:08 +0200
[Message part 1 (text/plain, inline)]
Andrew Tropin schreef op ma 05-07-2021 om 19:19 [+0300]: > Maxime Devos <maximedevos <at> telenet.be> writes: > > [...] > > BTW, how to add changes to the patches? Do I need to resend a > particular patch with required updates or have to wait other reviews and > send a v2 patch series? I would do a combination of those: reply to the mail of the reviewer with a revised patch attached. When you have received a ‘sufficient’ number of reviews from others on the other patches in the series as well, send a v2. Some benefits of this method: (1) it should be clear which patches should be applied, as the number of 'revised patches' without sending a new series version is limited. This is also the case if you send a new version after each little change, but can easily become _not_ the cas if you always respond with a revised patch without starting a new series version. (2) you don't clutter the mailboxes with new version after new version after each little change. This is particularily important if you have large patch series (say 13 or more patches), which doesn't seem to apply here. WDYT? Greetings, Maxime.
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Tue, 06 Jul 2021 07:11:02 GMT) Full text and rfc822 format available.Message #29 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Maxime Devos <maximedevos <at> telenet.be>, 49419 <at> debbugs.gnu.org Subject: Re: [bug#49419] [PATCH 1/4] home-services: Add most essential home services Date: Tue, 06 Jul 2021 10:09:50 +0300
[Message part 1 (text/plain, inline)]
Maxime Devos <maximedevos <at> telenet.be> writes: > Andrew Tropin schreef op ma 05-07-2021 om 19:19 [+0300]: >> Maxime Devos <maximedevos <at> telenet.be> writes: >> >> [...] >> >> BTW, how to add changes to the patches? Do I need to resend a >> particular patch with required updates or have to wait other reviews and >> send a v2 patch series? > > I would do a combination of those: reply to the mail of the reviewer with a > revised patch attached. When you have received a ‘sufficient’ number of reviews > from others on the other patches in the series as well, send a v2. > > Some benefits of this method: > > (1) it should be clear which patches should be applied, > as the number of 'revised patches' without sending a new series > version is limited. > > This is also the case if you send a new version after each little change, > but can easily become _not_ the cas if you always respond with a revised > patch without starting a new series version. > > (2) you don't clutter the mailboxes with new version after new version > after each little change. > > This is particularily important if you have large patch series (say 13 or > more patches), which doesn't seem to apply here. > > WDYT? I came up with one more approach: I can send a patch, which address the issues reviewer mentioned and after getting more reviews from other peers I can rebase my original commits and incorparate all the later patches to them and prepare v2 series. [PATCH 0/4] [PATCH 1/4] fix1 to address issue from subthread1 reported by r1 fix2 to address issue from subthread2 reported by r2 fix3 to address issue from subthread2 came during discussion with r1 and r2 [PATCH 2/4] ... Such approach makes it clear how the comments were addressed, because now you see a diff, not the whole new patch. On the other hand it can be a little harder to reply, because you don't have the latest version of the patch, but have only original patch and updates to it, so you need to pick, which one you want to reply to. I will try this one, to find its weak points. It's better to practice on this small patch series, rather something huge) Another question: Is it better to inline or attach patches?
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Tue, 06 Jul 2021 07:24:02 GMT) Full text and rfc822 format available.Message #32 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Maxime Devos <maximedevos <at> telenet.be>, 49419 <at> debbugs.gnu.org Subject: Re: [bug#49419] [PATCH 1/4] home-services: Add most essential home services Date: Tue, 06 Jul 2021 10:23:15 +0300
[Message part 1 (text/plain, inline)]
Maxime Devos <maximedevos <at> telenet.be> writes: > Hi, > > Andrew Tropin schreef op ma 05-07-2021 om 18:37 [+0300]: >> + (if (file-exists? (he-init-file new-home)) >> + (let* ((port ((@@ (ice-9 popen) open-input-pipe) >> + (format #f "source ~a && env" >> + (he-init-file new-home)))) >> + (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? >> + (string-split result #\newline))))) > > Why are you using @@ here? 'open-input-pipe', 'read-delimited' and 'remove' > are exported variables, so you can just use @ instead of the magic evil @@ > operator. Addressed the issue with the following patch.
[0001-toberebased-home-services-Use-instead-of.patch (text/x-patch, inline)]
From 27998096bf5b4ccd1c66ef71c1280faf0e11be72 Mon Sep 17 00:00:00 2001 From: Andrew Tropin <andrew <at> trop.in> Date: Mon, 5 Jul 2021 19:22:40 +0300 Subject: [PATCH] (toberebased) home-services: Use @ instead of @@ --- gnu/home-services.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gnu/home-services.scm b/gnu/home-services.scm index a06cd72459..78e5603edf 100644 --- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -280,15 +280,15 @@ extended with one gexp."))) (readlink he-path) #f)))) (if (file-exists? (he-init-file new-home)) - (let* ((port ((@@ (ice-9 popen) open-input-pipe) + (let* ((port ((@ (ice-9 popen) open-input-pipe) (format #f "source ~a && env" (he-init-file new-home)))) - (result ((@@ (ice-9 rdelim) read-delimited) "" port)) + (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) + ((@ (srfi srfi-1) remove) string-null? (string-split result #\newline))))) (close-port port) @@ -340,7 +340,7 @@ with one gexp, but many times, and all gexps must be idempotent."))) (define (equal-regulars? file1 file2) "Check if FILE1 and FILE2 are bit for bit identical." (let* ((cmp-binary #$(file-append - (@@ (gnu packages base) diffutils) "/bin/cmp")) + (@ (gnu packages base) diffutils) "/bin/cmp")) (status (system* cmp-binary file1 file2))) (= status 0))) -- 2.32.0
[Message part 3 (text/plain, inline)]
I can use different methods to attach/prepare/send patches and reply to the reviews, sorry for any inconveniences in advance) I'll stick to some approach, once I'll practice a few of them.
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Tue, 06 Jul 2021 08:27:02 GMT) Full text and rfc822 format available.Message #35 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Maxime Devos <maximedevos <at> telenet.be> To: Andrew Tropin <andrew <at> trop.in>, 49419 <at> debbugs.gnu.org Subject: Re: [bug#49419] [PATCH 1/4] home-services: Add most essential home services Date: Tue, 06 Jul 2021 10:26:31 +0200
[Message part 1 (text/plain, inline)]
Andrew Tropin schreef op di 06-07-2021 om 10:09 [+0300]: > Another question: Is it better to inline or attach patches? FWIW, I can read both just fine in my e-mail application (evolution). When it's inline, I can read the patch directly but also have an option to save it somewhere. When it is attached, there is some button for ‘expanding’ the attachement so I can read it. Both work for me. I don't know about other mail applications. Greetings, Maxime.
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Tue, 13 Jul 2021 18:18:01 GMT) Full text and rfc822 format available.Message #38 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: guix-patches <at> gnu.org Subject: [PATCH v2 0/4] Essential home services Date: Tue, 13 Jul 2021 19:17:20 +0300
Changes since v1: Use @ instead of @@ 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 gnu/home-services.scm | 472 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 472 insertions(+) create mode 100644 gnu/home-services.scm -- 2.32.0
Andrew Tropin <andrew <at> trop.in>
to control <at> debbugs.gnu.org
.
(Tue, 13 Jul 2021 18:28:01 GMT) Full text and rfc822 format available.guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 19 Jul 2021 17:16:01 GMT) Full text and rfc822 format available.Message #43 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH v3 0/4] Essential home services Date: Mon, 19 Jul 2021 11:04:01 +0300
[Message part 1 (text/plain, inline)]
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 gnu/home-services.scm | 477 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 477 insertions(+) create mode 100644 gnu/home-services.scm -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 19 Jul 2021 17:16:02 GMT) Full text and rfc822 format available.Message #46 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH v3 1/4] home-services: Add most essential home services Date: Mon, 5 Jul 2021 18:37:13 +0300
[Message part 1 (text/plain, inline)]
home-service-type is a root of home services DAG. home-profile-service-type is almost the same as profile-service-type, at least for now. home-environment-variables-service-type generates a @file{setup-environment} shell script, which is expected to be sourced by login shell or other program, which starts early and spawns all other processes. Home services for shells automatically add code for sourcing this file, if person do not use those home services they have to source this script manually in their's shell *profile file (details described in the manual). home-files-service-type is similar to etc-service-type, but doesn't extend home-activation, because deploy mechanism for config files is pluggable and can be different for different home environments: The default one is called symlink-manager (will be introudced in a separate patch series), which creates links for various dotfiles (like $XDG_CONFIG_HOME/$APP/...) to store, but is possible to implement alternative approaches like read-only home from Julien's guix-home-manager. home-run-on-first-login-service-type provides an @file{on-first-login} guile script, which runs provided gexps once, when user makes first login. It can be used to start user's Shepherd and maybe some other process. It relies on assumption that /run/user/$UID will be created on login by some login manager (elogind for example). home-activation-service-type provides an @file{activate} guile script, which do three main things: - Sets environment variables to the values declared in @file{setup-environment} shell script. It's necessary, because user can set for example XDG_CONFIG_HOME and it should be respected by activation gexp of symlink-manager. - Sets GUIX_NEW_HOME and possibly GUIX_OLD_HOME vars to paths in the store. Later those variables can be used by activation gexps, for example by symlink-manager or run-on-change services. - Run all activation gexps provided by other home services. --- gnu/home-services.scm | 328 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 328 insertions(+) create mode 100644 gnu/home-services.scm diff --git a/gnu/home-services.scm b/gnu/home-services.scm new file mode 100644 index 0000000000..a89a061a81 --- /dev/null +++ b/gnu/home-services.scm @@ -0,0 +1,328 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> +;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> +;;; +;;; 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 <http://www.gnu.org/licenses/>. + +(define-module (gnu home-services) + #:use-module (gnu services) + #:use-module (guix channels) + #:use-module (guix monads) + #:use-module (guix store) + #:use-module (guix gexp) + #:use-module (guix profiles) + #:use-module (guix sets) + #:use-module (guix ui) + #:use-module (guix discovery) + #:use-module (guix diagnostics) + + #:use-module (srfi srfi-1) + #: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-activation-service-type) + + #:re-export (service + service-type + service-extension)) + +;;; Comment: +;;; +;;; This module is similar to (gnu system services) module, but +;;; provides Home Services, which are supposed to be used for building +;;; home-environment. +;;; +;;; Home Services use the same extension as System Services. Consult +;;; (gnu system services) module or manual for more information. +;;; +;;; Code: + + +(define (home-derivation entries mextensions) + "Return as a monadic value the derivation of the 'home' +directory containing the given entries." + (mlet %store-monad ((extensions (mapm/accumulate-builds identity + mextensions))) + (lower-object + (file-union "home" (append entries (concatenate extensions)))))) + +(define home-service-type + ;; This is the ultimate service type, the root of the home service + ;; DAG. The service of this type is extended by monadic name/item + ;; pairs. These items end up in the "home-environment directory" as + ;; returned by 'home-environment-derivation'. + (service-type (name 'home) + (extensions '()) + (compose identity) + (extend home-derivation) + (default-value '()) + (description + "Build the home environment top-level directory, +which in turn refers to everything the home environment needs: its +packages, configuration files, activation script, and so on."))) + +(define (packages->profile-entry packages) + "Return a system entry for the profile containing PACKAGES." + ;; XXX: 'mlet' is needed here for one reason: to get the proper + ;; '%current-target' and '%current-target-system' bindings when + ;; 'packages->manifest' is called, and thus when the 'package-inputs' + ;; etc. procedures are called on PACKAGES. That way, conditionals in those + ;; inputs see the "correct" value of these two parameters. See + ;; <https://issues.guix.gnu.org/44952>. + (mlet %store-monad ((_ (current-target-system))) + (return `(("profile" ,(profile + (content (packages->manifest + (map identity + ;;(options->transformation transformations) + (delete-duplicates packages eq?)))))))))) + +;; MAYBE: Add a list of transformations for packages. It's better to +;; place it in home-profile-service-type to affect all profile +;; packages and prevent conflicts, when other packages relies on +;; non-transformed version of package. +(define home-profile-service-type + (service-type (name 'home-profile) + (extensions + (list (service-extension home-service-type + packages->profile-entry))) + (compose concatenate) + (extend append) + (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."))) + +(define (environment-variables->setup-environment-script vars) + "Return a file that can be sourced by a POSIX compliant shell which +initializes the environment. The file will source the home +environment profile, set some default environment variables, and set +environment variables provided in @code{vars}. @code{vars} is a list +of pairs (@code{(key . value)}), @code{key} is a string and +@code{value} is a string or gexp. + +If value is @code{#f} variable will be omitted. +If value is @code{#t} variable will be just exported. +For any other, value variable will be set to the @code{value} and +exported." + (define (warn-about-duplicate-defenitions) + (fold + (lambda (x acc) + (when (equal? (car x) (car acc)) + (warning + (G_ "duplicate definition for `~a' environment variable ~%") (car x))) + x) + (cons "" "") + (sort vars (lambda (a b) + (string<? (car a) (car b)))))) + + (warn-about-duplicate-defenitions) + (with-monad + %store-monad + (return + `(("setup-environment" + ;; 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\" +[ -f $PROFILE_FILE ] && . $PROFILE_FILE + +case $XDG_DATA_DIRS in + *$HOME_ENVIRONMENT/profile/share*) ;; + *) export XDG_DATA_DIRS=$HOME_ENVIRONMENT/profile/share:$XDG_DATA_DIRS ;; +esac +case $MANPATH in + *$HOME_ENVIRONMENT/profile/share/man*) ;; + *) export MANPATH=$HOME_ENVIRONMENT/profile/share/man:$MANPATH +esac +case $INFOPATH in + *$HOME_ENVIRONMENT/profile/share/info*) ;; + *) export INFOPATH=$HOME_ENVIRONMENT/profile/share/info:$INFOPATH ;; +esac +case $XDG_CONFIG_DIRS in + *$HOME_ENVIRONMENT/profile/etc/xdg*) ;; + *) export XDG_CONFIG_DIRS=$HOME_ENVIRONMENT/profile/etc/xdg:$XDG_CONFIG_DIRS ;; +esac +case $XCURSOR_PATH in + *$HOME_ENVIRONMENT/profile/share/icons*) ;; + *) export XCURSOR_PATH=$HOME_ENVIRONMENT/profile/share/icons:$XCURSOR_PATH ;; +esac + +" + + (append-map + (match-lambda + ((key . #f) + '()) + ((key . #t) + (list "export " key "\n")) + ((key . value) + (list "export " key "=" value "\n"))) + vars))))))) + +(define home-environment-variables-service-type + (service-type (name 'home-environment-variables) + (extensions + (list (service-extension + home-service-type + environment-variables->setup-environment-script))) + (compose concatenate) + (extend append) + (default-value '()) + (description "Set the environment variables."))) + +(define (files->files-directory files) + "Return a @code{files} directory that contains FILES." + (define (assert-no-duplicates files) + (let loop ((files files) + (seen (set))) + (match files + (() #t) + (((file _) rest ...) + (when (set-contains? seen file) + (raise (formatted-message (G_ "duplicate '~a' entry for files/") + file))) + (loop rest (set-insert file seen)))))) + + ;; Detect duplicates early instead of letting them through, eventually + ;; leading to a build failure of "files.drv". + (assert-no-duplicates files) + + (file-union "files" files)) + +(define (files-entry files) + "Return an entry for the @file{~/.guix-home/files} +directory containing FILES." + (with-monad %store-monad + (return `(("files" ,(files->files-directory files)))))) + +(define home-files-service-type + (service-type (name 'home-files) + (extensions + (list (service-extension home-service-type + files-entry))) + (compose concatenate) + (extend append) + (default-value '()) + (description "Configuration files for programs that +will be put in @file{~/.guix-home/files}."))) + +(define (compute-on-first-login-script _ gexps) + (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))))) + ;; 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)))))) + +(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))))) + +(define home-run-on-first-login-service-type + (service-type (name 'home-run-on-first-login) + (extensions + (list (service-extension + home-service-type + on-first-login-script-entry))) + (compose identity) + (extend compute-on-first-login-script) + (default-value #f) + (description "Run gexps on first user login. Can be +extended with one gexp."))) + + +(define (compute-activation-script init-gexp gexps) + (gexp->script + "activate" + #~(let* ((he-init-file (lambda (he) (string-append he "/setup-environment"))) + (he-path (string-append (getenv "HOME") "/.guix-home")) + (new-home-env (getenv "GUIX_NEW_HOME")) + (new-home (or new-home-env + ;; Path of the activation file if called interactively + (dirname (car (command-line))))) + (old-home-env (getenv "GUIX_OLD_HOME")) + (old-home (or old-home-env + (if (file-exists? (he-init-file he-path)) + (readlink he-path) + #f)))) + (if (file-exists? (he-init-file new-home)) + (let* ((port ((@ (ice-9 popen) open-input-pipe) + (format #f "source ~a && env" + (he-init-file new-home)))) + (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? + (string-split result #\newline))))) + (close-port port) + (map (lambda (x) (setenv (car x) (cdr x))) vars) + + (setenv "GUIX_NEW_HOME" new-home) + (setenv "GUIX_OLD_HOME" old-home) + + #$@gexps + + ;; Do not unset env variable if it was set outside. + (unless new-home-env (setenv "GUIX_NEW_HOME" #f)) + (unless old-home-env (setenv "GUIX_OLD_HOME" #f))) + (format #t "\ +Activation script was either called or loaded by file from this direcotry: +~a +It doesn't seem that home environment is somewhere around. +Make sure that you call ./activate by symlink from -home store item.\n" + new-home))))) + +(define (activation-script-entry m-activation) + "Return, as a monadic value, an entry for the activation script +in the home environment directory." + (mlet %store-monad ((activation m-activation)) + (return `(("activate" ,activation))))) + +(define home-activation-service-type + (service-type (name 'home-activation) + (extensions + (list (service-extension + home-service-type + activation-script-entry))) + (compose identity) + (extend compute-activation-script) + (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 +reconfiguration or generation switching. This service can be extended +with one gexp, but many times, and all gexps must be idempotent."))) + -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 19 Jul 2021 17:16:02 GMT) Full text and rfc822 format available.Message #49 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH v3 2/4] home-services: Add home-run-on-change-service-type Date: Mon, 5 Jul 2021 18:39:44 +0300
[Message part 1 (text/plain, inline)]
Service allows to trigger actions during activation if file or directory specified by pattern is changed. --- gnu/home-services.scm | 100 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/gnu/home-services.scm b/gnu/home-services.scm index a89a061a81..bcb6dd80df 100644 --- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -37,7 +37,8 @@ home-environment-variables-service-type home-files-service-type home-run-on-first-login-service-type - home-activation-service-type) + home-activation-service-type + home-run-on-change-service-type) #:re-export (service service-type @@ -326,3 +327,100 @@ directory. @command{activate} script automatically called during reconfiguration or generation switching. This service can be extended with one gexp, but many times, and all gexps must be idempotent."))) + +;;; +;;; On-change. +;;; + +(define (compute-on-change-gexp eval-gexps? pattern-gexp-tuples) + #~(begin + (define (equal-regulars? file1 file2) + "Check if FILE1 and FILE2 are bit for bit identical." + (let* ((cmp-binary #$(file-append + (@ (gnu packages base) diffutils) "/bin/cmp")) + (stats1 (lstat file1)) + (stats2 (lstat file2))) + (cond + ((= (stat:ino stats1) (stat:ino stats2)) #t) + ((not (= (stat:size stats1) (stat:size stats2))) #f) + + (else (= (system* cmp-binary file1 file2) 0))))) + + (define (equal-symlinks? symlink1 symlink2) + "Check if SYMLINK1 and SYMLINK2 are pointing to the same target." + (string=? (readlink symlink1) (readlink symlink2))) + + (define (equal-directories? dir1 dir2) + "Check if DIR1 and DIR2 have the same content." + (define (ordinary-file file) + (not (or (string=? file ".") + (string=? file "..")))) + (let* ((files1 (scandir dir1 ordinary-file)) + (files2 (scandir dir2 ordinary-file))) + (if (equal? files1 files2) + (map (lambda (file) + (equal-files? + (string-append dir1 "/" file) + (string-append dir2 "/" file))) + files1) + #f))) + + (define (equal-files? file1 file2) + "Compares files, symlinks or directories of the same type." + (case (file-type file1) + ((directory) (equal-directories? file1 file2)) + ((symlink) (equal-symlinks? file1 file2)) + ((regular) (equal-regulars? file1 file2)) + (else + (display "The file type is unsupported by on-change service.\n") + #f))) + + (define (file-type file) + (stat:type (lstat file))) + + (define (something-changed? file1 file2) + (cond + ((and (not (file-exists? file1)) + (not (file-exists? file2))) #f) + ((or (not (file-exists? file1)) + (not (file-exists? file2))) #t) + + ((not (eq? (file-type file1) (file-type file2))) #t) + + (else + (not (equal-files? file1 file2))))) + + (define expressions-to-eval + (map + (lambda (x) + (let* ((file1 (string-append (getenv "GUIX_OLD_HOME") "/" (car x))) + (file2 (string-append (getenv "GUIX_NEW_HOME") "/" (car x))) + (_ (format #t "Comparing ~a and\n~10t~a..." file1 file2)) + (any-changes? (something-changed? file1 file2)) + (_ (format #t " done (~a)\n" + (if any-changes? "changed" "same")))) + (if any-changes? (cadr x) ""))) + '#$pattern-gexp-tuples)) + + (if #$eval-gexps? + (begin + (display "Evaling on-change gexps.\n\n") + (for-each primitive-eval expressions-to-eval) + (display "On-change gexps evaluation finished.\n\n")) + (display "\ +On-change gexps won't evaluated, disabled by service configuration.\n")))) + +(define home-run-on-change-service-type + (service-type (name 'home-run-on-change) + (extensions + (list (service-extension + home-activation-service-type + identity))) + (compose concatenate) + (extend compute-on-change-gexp) + (default-value #t) + (description "\ +G-expressions to run if the specified files have changed since the +last generation. The extension should be a list of lists where the +first element is the pattern for file or directory that expected to be +changed, and the second element is the G-expression to be evaluated."))) -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 19 Jul 2021 17:16:02 GMT) Full text and rfc822 format available.Message #52 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH v3 3/4] home-services: Add home-provenance-service-type Date: Mon, 5 Jul 2021 18:41:07 +0300
[Message part 1 (text/plain, inline)]
* gnu/home-services.scm (home-provenance-service-type, sexp->home-provenance, home-provenance): New variables. --- gnu/home-services.scm | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/gnu/home-services.scm b/gnu/home-services.scm index bcb6dd80df..8aa9adeaaf 100644 --- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -38,7 +38,10 @@ home-files-service-type home-run-on-first-login-service-type home-activation-service-type - home-run-on-change-service-type) + home-run-on-change-service-type + home-provenance-service-type + + fold-home-service-types) #:re-export (service service-type @@ -424,3 +427,25 @@ G-expressions to run if the specified files have changed since the last generation. The extension should be a list of lists where the first element is the pattern for file or directory that expected to be changed, and the second element is the G-expression to be evaluated."))) + + +;;; +;;; Provenance tracking. +;;; + +(define home-provenance-service-type + (service-type + (name 'home-provenance) + (extensions + (list (service-extension + home-service-type + (service-extension-compute + (first (service-type-extensions provenance-service-type)))))) + (default-value #f) ;the HE config file + (description "\ +Store provenance information about the home environment in the home +environment itself: the channels used when building the home +environment, and its configuration file, when available."))) + +(define sexp->home-provenance sexp->system-provenance) +(define home-provenance system-provenance) -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 19 Jul 2021 17:16:03 GMT) Full text and rfc822 format available.Message #55 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH v3 4/4] home-services: Add fold-home-service-types function Date: Mon, 5 Jul 2021 18:41:45 +0300
[Message part 1 (text/plain, inline)]
* gnu/home-services.scm (parent-directory, %guix-home-root-directory, %service-type-path, all-home-service-modules, fold-home-service-types): New variables. --- gnu/home-services.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gnu/home-services.scm b/gnu/home-services.scm index 8aa9adeaaf..9afb70f0a7 100644 --- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -449,3 +449,29 @@ environment, and its configuration file, when available."))) (define sexp->home-provenance sexp->system-provenance) (define home-provenance system-provenance) + + +;;; +;;; Searching +;;; + +(define (parent-directory directory) + "Get the parent directory of DIRECTORY" + (string-join (drop-right (string-split directory #\/) 1) "/")) + +(define %guix-home-root-directory + ;; Absolute file name of the module hierarchy. + (parent-directory (dirname (search-path %load-path "gnu/home-services.scm")))) + +(define %service-type-path + ;; Search path for service types. + (make-parameter `((,%guix-home-root-directory . "gnu/home-services")))) + +(define (all-home-service-modules) + "Return the default set of home-service modules." + (cons (resolve-interface '(gnu home-services)) + (all-modules (%service-type-path) + #:warn warn-about-load-error))) + +(define* (fold-home-service-types proc seed) + (fold-service-types proc seed (all-home-service-modules))) -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Wed, 21 Jul 2021 15:10:01 GMT) Full text and rfc822 format available.Message #58 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Andrew Tropin <andrew <at> trop.in> Cc: 49419 <at> debbugs.gnu.org Subject: Re: bug#49419: [PATCH 0/4] Essential home services Date: Wed, 21 Jul 2021 17:08:55 +0200
Hi Andrew, Andrew Tropin <andrew <at> 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? I agree we should apply it all in ‘wip-guix-home’ for now. Some general comments: • Please remove tabs from Scheme files. • 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. :-) • When there are tests or documentation, add them in the commit that adds the corresponding functionality. • 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? I’ll look at the actual patches later, but I invite others to chime in too. :-) Thanks! Ludo’.
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Wed, 28 Jul 2021 05:39:02 GMT) Full text and rfc822 format available.Message #61 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 49419 <at> debbugs.gnu.org Subject: Re: bug#49419: [PATCH 0/4] Essential home services Date: Wed, 28 Jul 2021 08:35:59 +0300
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes: > Hi Andrew, > > Andrew Tropin <andrew <at> 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.
[0001-toberebased-gnu-home-services-Untabify-a-file.patch (text/x-patch, inline)]
From 26bfd8052d90650abc7e5ec6dbb7dd7165dfba3c Mon Sep 17 00:00:00 2001 From: Andrew Tropin <andrew <at> 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
[Message part 3 (text/plain, inline)]
> • 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!
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Thu, 05 Aug 2021 05:49:01 GMT) Full text and rfc822 format available.Message #64 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH v4 0/4] Essential home services Date: Thu, 05 Aug 2021 08:41:43 +0300
[Message part 1 (text/plain, inline)]
Seems there is no additional comments about implementation, so I just send cosmetical changes treating comments from previous reviews. Changes since v3: - Remove tabs. - Move Home Services explanation from commit message to comment. - Add missing ChangeLog-style commit body. 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 gnu/home-services.scm | 520 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 520 insertions(+) create mode 100644 gnu/home-services.scm -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Thu, 05 Aug 2021 05:49:02 GMT) Full text and rfc822 format available.Message #67 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH v4 1/4] home-services: Add most essential home services Date: Thu, 05 Aug 2021 08:45:38 +0300
[Message part 1 (text/plain, inline)]
* gnu/home-services.scm (home-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): New variables. --- gnu/home-services.scm | 368 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 368 insertions(+) create mode 100644 gnu/home-services.scm diff --git a/gnu/home-services.scm b/gnu/home-services.scm new file mode 100644 index 0000000000..4a6458abec --- /dev/null +++ b/gnu/home-services.scm @@ -0,0 +1,368 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> +;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> +;;; +;;; 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 <http://www.gnu.org/licenses/>. + +(define-module (gnu home-services) + #:use-module (gnu services) + #:use-module (guix channels) + #:use-module (guix monads) + #:use-module (guix store) + #:use-module (guix gexp) + #:use-module (guix profiles) + #:use-module (guix sets) + #:use-module (guix ui) + #:use-module (guix discovery) + #:use-module (guix diagnostics) + + #:use-module (srfi srfi-1) + #: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-activation-service-type) + + #:re-export (service + service-type + service-extension)) + +;;; Comment: +;;; +;;; This module is similar to (gnu system services) module, but +;;; provides Home Services, which are supposed to be used for building +;;; home-environment. +;;; +;;; Home Services use the same extension as System Services. Consult +;;; (gnu system services) module or manual for more information. +;;; +;;; home-service-type is a root of home services DAG. +;;; +;;; home-profile-service-type is almost the same as profile-service-type, at least +;;; for now. +;;; +;;; home-environment-variables-service-type generates a @file{setup-environment} +;;; shell script, which is expected to be sourced by login shell or other program, +;;; which starts early and spawns all other processes. Home services for shells +;;; automatically add code for sourcing this file, if person do not use those home +;;; services they have to source this script manually in their's shell *profile +;;; file (details described in the manual). +;;; +;;; home-files-service-type is similar to etc-service-type, but doesn't extend +;;; home-activation, because deploy mechanism for config files is pluggable and +;;; can be different for different home environments: The default one is called +;;; symlink-manager (will be introudced in a separate patch series), which creates +;;; links for various dotfiles (like $XDG_CONFIG_HOME/$APP/...) to store, but is +;;; possible to implement alternative approaches like read-only home from Julien's +;;; guix-home-manager. +;;; +;;; home-run-on-first-login-service-type provides an @file{on-first-login} guile +;;; script, which runs provided gexps once, when user makes first login. It can +;;; be used to start user's Shepherd and maybe some other process. It relies on +;;; assumption that /run/user/$UID will be created on login by some login +;;; manager (elogind for example). +;;; +;;; home-activation-service-type provides an @file{activate} guile script, which +;;; do three main things: +;;; +;;; - Sets environment variables to the values declared in +;;; @file{setup-environment} shell script. It's necessary, because user can set +;;; for example XDG_CONFIG_HOME and it should be respected by activation gexp of +;;; symlink-manager. +;;; +;;; - Sets GUIX_NEW_HOME and possibly GUIX_OLD_HOME vars to paths in the store. +;;; Later those variables can be used by activation gexps, for example by +;;; symlink-manager or run-on-change services. +;;; +;;; - Run all activation gexps provided by other home services. +;;; +;;; Code: + + +(define (home-derivation entries mextensions) + "Return as a monadic value the derivation of the 'home' +directory containing the given entries." + (mlet %store-monad ((extensions (mapm/accumulate-builds identity + mextensions))) + (lower-object + (file-union "home" (append entries (concatenate extensions)))))) + +(define home-service-type + ;; This is the ultimate service type, the root of the home service + ;; DAG. The service of this type is extended by monadic name/item + ;; pairs. These items end up in the "home-environment directory" as + ;; returned by 'home-environment-derivation'. + (service-type (name 'home) + (extensions '()) + (compose identity) + (extend home-derivation) + (default-value '()) + (description + "Build the home environment top-level directory, +which in turn refers to everything the home environment needs: its +packages, configuration files, activation script, and so on."))) + +(define (packages->profile-entry packages) + "Return a system entry for the profile containing PACKAGES." + ;; XXX: 'mlet' is needed here for one reason: to get the proper + ;; '%current-target' and '%current-target-system' bindings when + ;; 'packages->manifest' is called, and thus when the 'package-inputs' + ;; etc. procedures are called on PACKAGES. That way, conditionals in those + ;; inputs see the "correct" value of these two parameters. See + ;; <https://issues.guix.gnu.org/44952>. + (mlet %store-monad ((_ (current-target-system))) + (return `(("profile" ,(profile + (content (packages->manifest + (map identity + ;;(options->transformation transformations) + (delete-duplicates packages eq?)))))))))) + +;; MAYBE: Add a list of transformations for packages. It's better to +;; place it in home-profile-service-type to affect all profile +;; packages and prevent conflicts, when other packages relies on +;; non-transformed version of package. +(define home-profile-service-type + (service-type (name 'home-profile) + (extensions + (list (service-extension home-service-type + packages->profile-entry))) + (compose concatenate) + (extend append) + (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."))) + +(define (environment-variables->setup-environment-script vars) + "Return a file that can be sourced by a POSIX compliant shell which +initializes the environment. The file will source the home +environment profile, set some default environment variables, and set +environment variables provided in @code{vars}. @code{vars} is a list +of pairs (@code{(key . value)}), @code{key} is a string and +@code{value} is a string or gexp. + +If value is @code{#f} variable will be omitted. +If value is @code{#t} variable will be just exported. +For any other, value variable will be set to the @code{value} and +exported." + (define (warn-about-duplicate-defenitions) + (fold + (lambda (x acc) + (when (equal? (car x) (car acc)) + (warning + (G_ "duplicate definition for `~a' environment variable ~%") (car x))) + x) + (cons "" "") + (sort vars (lambda (a b) + (string<? (car a) (car b)))))) + + (warn-about-duplicate-defenitions) + (with-monad + %store-monad + (return + `(("setup-environment" + ;; 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\" +[ -f $PROFILE_FILE ] && . $PROFILE_FILE + +case $XDG_DATA_DIRS in + *$HOME_ENVIRONMENT/profile/share*) ;; + *) export XDG_DATA_DIRS=$HOME_ENVIRONMENT/profile/share:$XDG_DATA_DIRS ;; +esac +case $MANPATH in + *$HOME_ENVIRONMENT/profile/share/man*) ;; + *) export MANPATH=$HOME_ENVIRONMENT/profile/share/man:$MANPATH +esac +case $INFOPATH in + *$HOME_ENVIRONMENT/profile/share/info*) ;; + *) export INFOPATH=$HOME_ENVIRONMENT/profile/share/info:$INFOPATH ;; +esac +case $XDG_CONFIG_DIRS in + *$HOME_ENVIRONMENT/profile/etc/xdg*) ;; + *) export XDG_CONFIG_DIRS=$HOME_ENVIRONMENT/profile/etc/xdg:$XDG_CONFIG_DIRS ;; +esac +case $XCURSOR_PATH in + *$HOME_ENVIRONMENT/profile/share/icons*) ;; + *) export XCURSOR_PATH=$HOME_ENVIRONMENT/profile/share/icons:$XCURSOR_PATH ;; +esac + +" + + (append-map + (match-lambda + ((key . #f) + '()) + ((key . #t) + (list "export " key "\n")) + ((key . value) + (list "export " key "=" value "\n"))) + vars))))))) + +(define home-environment-variables-service-type + (service-type (name 'home-environment-variables) + (extensions + (list (service-extension + home-service-type + environment-variables->setup-environment-script))) + (compose concatenate) + (extend append) + (default-value '()) + (description "Set the environment variables."))) + +(define (files->files-directory files) + "Return a @code{files} directory that contains FILES." + (define (assert-no-duplicates files) + (let loop ((files files) + (seen (set))) + (match files + (() #t) + (((file _) rest ...) + (when (set-contains? seen file) + (raise (formatted-message (G_ "duplicate '~a' entry for files/") + file))) + (loop rest (set-insert file seen)))))) + + ;; Detect duplicates early instead of letting them through, eventually + ;; leading to a build failure of "files.drv". + (assert-no-duplicates files) + + (file-union "files" files)) + +(define (files-entry files) + "Return an entry for the @file{~/.guix-home/files} +directory containing FILES." + (with-monad %store-monad + (return `(("files" ,(files->files-directory files)))))) + +(define home-files-service-type + (service-type (name 'home-files) + (extensions + (list (service-extension home-service-type + files-entry))) + (compose concatenate) + (extend append) + (default-value '()) + (description "Configuration files for programs that +will be put in @file{~/.guix-home/files}."))) + +(define (compute-on-first-login-script _ gexps) + (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))))) + ;; 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)))))) + +(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))))) + +(define home-run-on-first-login-service-type + (service-type (name 'home-run-on-first-login) + (extensions + (list (service-extension + home-service-type + on-first-login-script-entry))) + (compose identity) + (extend compute-on-first-login-script) + (default-value #f) + (description "Run gexps on first user login. Can be +extended with one gexp."))) + + +(define (compute-activation-script init-gexp gexps) + (gexp->script + "activate" + #~(let* ((he-init-file (lambda (he) (string-append he "/setup-environment"))) + (he-path (string-append (getenv "HOME") "/.guix-home")) + (new-home-env (getenv "GUIX_NEW_HOME")) + (new-home (or new-home-env + ;; Path of the activation file if called interactively + (dirname (car (command-line))))) + (old-home-env (getenv "GUIX_OLD_HOME")) + (old-home (or old-home-env + (if (file-exists? (he-init-file he-path)) + (readlink he-path) + #f)))) + (if (file-exists? (he-init-file new-home)) + (let* ((port ((@ (ice-9 popen) open-input-pipe) + (format #f "source ~a && env" + (he-init-file new-home)))) + (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? + (string-split result #\newline))))) + (close-port port) + (map (lambda (x) (setenv (car x) (cdr x))) vars) + + (setenv "GUIX_NEW_HOME" new-home) + (setenv "GUIX_OLD_HOME" old-home) + + #$@gexps + + ;; Do not unset env variable if it was set outside. + (unless new-home-env (setenv "GUIX_NEW_HOME" #f)) + (unless old-home-env (setenv "GUIX_OLD_HOME" #f))) + (format #t "\ +Activation script was either called or loaded by file from this direcotry: +~a +It doesn't seem that home environment is somewhere around. +Make sure that you call ./activate by symlink from -home store item.\n" + new-home))))) + +(define (activation-script-entry m-activation) + "Return, as a monadic value, an entry for the activation script +in the home environment directory." + (mlet %store-monad ((activation m-activation)) + (return `(("activate" ,activation))))) + +(define home-activation-service-type + (service-type (name 'home-activation) + (extensions + (list (service-extension + home-service-type + activation-script-entry))) + (compose identity) + (extend compute-activation-script) + (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 +reconfiguration or generation switching. This service can be extended +with one gexp, but many times, and all gexps must be idempotent."))) + -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Thu, 05 Aug 2021 05:49:02 GMT) Full text and rfc822 format available.Message #70 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH v4 2/4] home-services: Add home-run-on-change-service-type Date: Thu, 05 Aug 2021 08:46:22 +0300
[Message part 1 (text/plain, inline)]
* gnu/home-services.scm (home-run-on-change-service-type): New variable. --- gnu/home-services.scm | 103 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 1 deletion(-) diff --git a/gnu/home-services.scm b/gnu/home-services.scm index 4a6458abec..32b59f55df 100644 --- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -37,7 +37,8 @@ home-environment-variables-service-type home-files-service-type home-run-on-first-login-service-type - home-activation-service-type) + home-activation-service-type + home-run-on-change-service-type) #:re-export (service service-type @@ -92,6 +93,9 @@ ;;; ;;; - Run all activation gexps provided by other home services. ;;; +;;; home-run-on-change-service-type allows to trigger actions during +;;; activation if file or directory specified by pattern is changed. +;;; ;;; Code: @@ -366,3 +370,100 @@ directory. @command{activate} script automatically called during reconfiguration or generation switching. This service can be extended with one gexp, but many times, and all gexps must be idempotent."))) + +;;; +;;; On-change. +;;; + +(define (compute-on-change-gexp eval-gexps? pattern-gexp-tuples) + #~(begin + (define (equal-regulars? file1 file2) + "Check if FILE1 and FILE2 are bit for bit identical." + (let* ((cmp-binary #$(file-append + (@ (gnu packages base) diffutils) "/bin/cmp")) + (stats1 (lstat file1)) + (stats2 (lstat file2))) + (cond + ((= (stat:ino stats1) (stat:ino stats2)) #t) + ((not (= (stat:size stats1) (stat:size stats2))) #f) + + (else (= (system* cmp-binary file1 file2) 0))))) + + (define (equal-symlinks? symlink1 symlink2) + "Check if SYMLINK1 and SYMLINK2 are pointing to the same target." + (string=? (readlink symlink1) (readlink symlink2))) + + (define (equal-directories? dir1 dir2) + "Check if DIR1 and DIR2 have the same content." + (define (ordinary-file file) + (not (or (string=? file ".") + (string=? file "..")))) + (let* ((files1 (scandir dir1 ordinary-file)) + (files2 (scandir dir2 ordinary-file))) + (if (equal? files1 files2) + (map (lambda (file) + (equal-files? + (string-append dir1 "/" file) + (string-append dir2 "/" file))) + files1) + #f))) + + (define (equal-files? file1 file2) + "Compares files, symlinks or directories of the same type." + (case (file-type file1) + ((directory) (equal-directories? file1 file2)) + ((symlink) (equal-symlinks? file1 file2)) + ((regular) (equal-regulars? file1 file2)) + (else + (display "The file type is unsupported by on-change service.\n") + #f))) + + (define (file-type file) + (stat:type (lstat file))) + + (define (something-changed? file1 file2) + (cond + ((and (not (file-exists? file1)) + (not (file-exists? file2))) #f) + ((or (not (file-exists? file1)) + (not (file-exists? file2))) #t) + + ((not (eq? (file-type file1) (file-type file2))) #t) + + (else + (not (equal-files? file1 file2))))) + + (define expressions-to-eval + (map + (lambda (x) + (let* ((file1 (string-append (getenv "GUIX_OLD_HOME") "/" (car x))) + (file2 (string-append (getenv "GUIX_NEW_HOME") "/" (car x))) + (_ (format #t "Comparing ~a and\n~10t~a..." file1 file2)) + (any-changes? (something-changed? file1 file2)) + (_ (format #t " done (~a)\n" + (if any-changes? "changed" "same")))) + (if any-changes? (cadr x) ""))) + '#$pattern-gexp-tuples)) + + (if #$eval-gexps? + (begin + (display "Evaling on-change gexps.\n\n") + (for-each primitive-eval expressions-to-eval) + (display "On-change gexps evaluation finished.\n\n")) + (display "\ +On-change gexps won't evaluated, disabled by service configuration.\n")))) + +(define home-run-on-change-service-type + (service-type (name 'home-run-on-change) + (extensions + (list (service-extension + home-activation-service-type + identity))) + (compose concatenate) + (extend compute-on-change-gexp) + (default-value #t) + (description "\ +G-expressions to run if the specified files have changed since the +last generation. The extension should be a list of lists where the +first element is the pattern for file or directory that expected to be +changed, and the second element is the G-expression to be evaluated."))) -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Thu, 05 Aug 2021 05:49:03 GMT) Full text and rfc822 format available.Message #73 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH v4 3/4] home-services: Add home-provenance-service-type Date: Thu, 05 Aug 2021 08:46:58 +0300
[Message part 1 (text/plain, inline)]
* gnu/home-services.scm (home-provenance-service-type, sexp->home-provenance, home-provenance): New variables. --- gnu/home-services.scm | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/gnu/home-services.scm b/gnu/home-services.scm index 32b59f55df..d320d3a44d 100644 --- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -38,7 +38,10 @@ home-files-service-type home-run-on-first-login-service-type home-activation-service-type - home-run-on-change-service-type) + home-run-on-change-service-type + home-provenance-service-type + + fold-home-service-types) #:re-export (service service-type @@ -467,3 +470,25 @@ G-expressions to run if the specified files have changed since the last generation. The extension should be a list of lists where the first element is the pattern for file or directory that expected to be changed, and the second element is the G-expression to be evaluated."))) + + +;;; +;;; Provenance tracking. +;;; + +(define home-provenance-service-type + (service-type + (name 'home-provenance) + (extensions + (list (service-extension + home-service-type + (service-extension-compute + (first (service-type-extensions provenance-service-type)))))) + (default-value #f) ;the HE config file + (description "\ +Store provenance information about the home environment in the home +environment itself: the channels used when building the home +environment, and its configuration file, when available."))) + +(define sexp->home-provenance sexp->system-provenance) +(define home-provenance system-provenance) -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Thu, 05 Aug 2021 05:49:03 GMT) Full text and rfc822 format available.Message #76 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Subject: [PATCH v4 4/4] home-services: Add fold-home-service-types function Date: Thu, 05 Aug 2021 08:47:40 +0300
[Message part 1 (text/plain, inline)]
* gnu/home-services.scm (parent-directory, %guix-home-root-directory, %service-type-path, all-home-service-modules, fold-home-service-types): New variables. --- gnu/home-services.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gnu/home-services.scm b/gnu/home-services.scm index d320d3a44d..16b9736d64 100644 --- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -492,3 +492,29 @@ environment, and its configuration file, when available."))) (define sexp->home-provenance sexp->system-provenance) (define home-provenance system-provenance) + + +;;; +;;; Searching +;;; + +(define (parent-directory directory) + "Get the parent directory of DIRECTORY" + (string-join (drop-right (string-split directory #\/) 1) "/")) + +(define %guix-home-root-directory + ;; Absolute file name of the module hierarchy. + (parent-directory (dirname (search-path %load-path "gnu/home-services.scm")))) + +(define %service-type-path + ;; Search path for service types. + (make-parameter `((,%guix-home-root-directory . "gnu/home-services")))) + +(define (all-home-service-modules) + "Return the default set of home-service modules." + (cons (resolve-interface '(gnu home-services)) + (all-modules (%service-type-path) + #:warn warn-about-load-error))) + +(define* (fold-home-service-types proc seed) + (fold-service-types proc seed (all-home-service-modules))) -- 2.32.0
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 23 Aug 2021 09:58:01 GMT) Full text and rfc822 format available.Message #79 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: 49419 <at> debbugs.gnu.org Cc: Ludovic Courtès <ludo <at> gnu.org>, Maxime Devos <maximedevos <at> telenet.be> Subject: Re: [PATCH v4 0/4] Essential home services Date: Mon, 23 Aug 2021 12:57:05 +0300
[Message part 1 (text/plain, inline)]
On 2021-08-05 08:41, Andrew Tropin wrote: > Seems there is no additional comments about implementation, so I just > send cosmetical changes treating comments from previous reviews. > > Changes since v3: > - Remove tabs. > - Move Home Services explanation from commit message to comment. > - Add missing ChangeLog-style commit body. > > 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 > > gnu/home-services.scm | 520 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 520 insertions(+) > create mode 100644 gnu/home-services.scm Guys, review v4 patches, please.
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Mon, 23 Aug 2021 16:25:01 GMT) Full text and rfc822 format available.Message #82 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Oleg Pykhalov <go.wigust <at> gmail.com> To: Andrew Tropin <andrew <at> trop.in> Cc: Ludovic Courtès <ludo <at> gnu.org>, Maxime Devos <maximedevos <at> telenet.be>, 49419 <at> debbugs.gnu.org Subject: Re: bug#49419: [PATCH 0/4] Essential home services Date: Mon, 23 Aug 2021 19:24:25 +0300
[Message part 1 (text/plain, inline)]
Hi Andrew, Andrew Tropin <andrew <at> trop.in> writes: […] > Guys, review v4 patches, please. These patch series looks good for me. As Ludovic suggested, we could move modules to another namespace for code sharing, but it is not a blocker from merging changes and we could do it later when we need to share the code. I think we should go forward and push to the master. WDYT? As I remember you have an access to push. Otherwise, please, ping me to push it.< Thanks, Oleg.
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Tue, 24 Aug 2021 08:55:02 GMT) Full text and rfc822 format available.Message #85 received at 49419 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Oleg Pykhalov <go.wigust <at> gmail.com> Cc: Ludovic Courtès <ludo <at> gnu.org>, Maxime Devos <maximedevos <at> telenet.be>, 49419 <at> debbugs.gnu.org Subject: Re: bug#49419: [PATCH 0/4] Essential home services Date: Tue, 24 Aug 2021 11:53:54 +0300
[Message part 1 (text/plain, inline)]
On 2021-08-23 19:24, Oleg Pykhalov wrote: > Hi Andrew, > Hi Oleg! > > These patch series looks good for me. > > As Ludovic suggested, we could move modules to another namespace for > code sharing, but it is not a blocker from merging changes and we could > do it later when we need to share the code. I think we should go > forward and push to the master. WDYT? Yep, let's postpone moving modules to another namespace until it will be needed. Later, when the necessity appears, we will decide how to better organize the code. We can push it to master, but I planned to keep it in wip-guix-home for a while to bring all related stuff like documentation and cli to the branch and merge it to the master after everything is complete. Also, merging only part of Guix Home to the master will arise conflicts for users of rde channel (which contains current implementation of Guix Home). However, it is solvable by removing already merged parts from rde repository, so, it's not a big deal and I'm fine with both merging options. > > As I remember you have an access to push. Nope, I don't have commit access yet) > Otherwise, please, ping me to push it.< If everything seems ok, merge the changes, please. I'll prepare the next patch series soon. > > Thanks, > Oleg.
[signature.asc (application/pgp-signature, inline)]
Oleg Pykhalov <go.wigust <at> gmail.com>
:Andrew Tropin <andrew <at> trop.in>
:Message #90 received at 49419-done <at> debbugs.gnu.org (full text, mbox):
From: Oleg Pykhalov <go.wigust <at> gmail.com> To: Andrew Tropin <andrew <at> trop.in> Cc: 49419-done <at> debbugs.gnu.org Subject: Re: bug#49419: [PATCH 0/4] Essential home services Date: Tue, 24 Aug 2021 15:14:25 +0300
[Message part 1 (text/plain, inline)]
Andrew Tropin <andrew <at> trop.in> writes: […] >> As Ludovic suggested, we could move modules to another namespace for >> code sharing, but it is not a blocker from merging changes and we could >> do it later when we need to share the code. I think we should go >> forward and push to the master. WDYT? > > Yep, let's postpone moving modules to another namespace until it will be > needed. Later, when the necessity appears, we will decide how to better > organize the code. > > We can push it to master, but I planned to keep it in wip-guix-home for > a while to bring all related stuff like documentation and cli to the > branch and merge it to the master after everything is complete. > > Also, merging only part of Guix Home to the master will arise conflicts > for users of rde channel (which contains current implementation of Guix > Home). However, it is solvable by removing already merged parts from > rde repository, so, it's not a big deal and I'm fine with both merging > options. OK, pushed to the wip-guix-home. https://git.savannah.gnu.org/cgit/guix.git/?h=wip-guix-home
[signature.asc (application/pgp-signature, inline)]
Oleg Pykhalov <go.wigust <at> gmail.com>
:Andrew Tropin <andrew <at> trop.in>
:Oleg Pykhalov <go.wigust <at> gmail.com>
:Andrew Tropin <andrew <at> trop.in>
:Oleg Pykhalov <go.wigust <at> gmail.com>
:Andrew Tropin <andrew <at> trop.in>
:Oleg Pykhalov <go.wigust <at> gmail.com>
:Andrew Tropin <andrew <at> trop.in>
:guix-patches <at> gnu.org
:bug#49419
; Package guix-patches
.
(Thu, 26 Aug 2021 07:03:01 GMT) Full text and rfc822 format available.Message #113 received at 49419-done <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Oleg Pykhalov <go.wigust <at> gmail.com> Cc: 49419-done <at> debbugs.gnu.org Subject: Re: bug#49419: [PATCH 0/4] Essential home services Date: Thu, 26 Aug 2021 10:01:28 +0300
[Message part 1 (text/plain, inline)]
On 2021-08-24 15:14, Oleg Pykhalov wrote: > Andrew Tropin <andrew <at> trop.in> writes: > > […] > >>> As Ludovic suggested, we could move modules to another namespace for >>> code sharing, but it is not a blocker from merging changes and we could >>> do it later when we need to share the code. I think we should go >>> forward and push to the master. WDYT? >> >> Yep, let's postpone moving modules to another namespace until it will be >> needed. Later, when the necessity appears, we will decide how to better >> organize the code. >> >> We can push it to master, but I planned to keep it in wip-guix-home for >> a while to bring all related stuff like documentation and cli to the >> branch and merge it to the master after everything is complete. >> >> Also, merging only part of Guix Home to the master will arise conflicts >> for users of rde channel (which contains current implementation of Guix >> Home). However, it is solvable by removing already merged parts from >> rde repository, so, it's not a big deal and I'm fine with both merging >> options. > > OK, pushed to the wip-guix-home. > > https://git.savannah.gnu.org/cgit/guix.git/?h=wip-guix-home Thank you very much!) Sent a next patch for Guix Home. #50208
[signature.asc (application/pgp-signature, inline)]
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Thu, 23 Sep 2021 11:24:05 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.