guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#54293] [WIP] home: Add home-git-service-type


From: 宋文武
Subject: [bug#54293] [WIP] home: Add home-git-service-type
Date: Wed, 09 Mar 2022 20:50:06 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

(lines begin with '>>' are from my previous mail.)

Maxime Devos <maximedevos@telenet.be> writes:
>> I made 'options' an sexp value since there are so many git options
>> (see 'man git-config').

> This can be solved with an escape hatch like openssh-configuration's
> 'extra-content' and by adding support for new options on an on-demand
> basis.  If there are lots of options, that just means there's lot to
> do, I think.
> [...]
> Instead of this ad-hoc alist structure, how about introducing some
> structure with records, like done for other Guix services, e.g.
> 'openssh-configuration' and 'guix-configuration'?
> [...]
> To elaborate a little, I think the following options are the most
> important to support:

>   user.name, user.email, commiter.name, committer.email
>   smtp things (for git send-email, important for contributing to guix)
>   pgp things (important for being a committer in guix)

Yes, add a proper record structure will make documentation and type
check more viable.  I'll try later..


>> I can also symlink the generated gitconfig into ~/.gitconfig, but
>> with 'GIT_CONFIG_SYSTEM' it can be used together with hand maintained
>> ~/.gitconfig.
> The GIT_CONFIG_SYSTEM is less stateful, I like it.  There are multiple
> variables like these though: GIT_CONFIG_GLOBAL, GIT_CONFIG_SYSTEM and
> GIT_CONFIG.  My guess is that GIT_CONFIG_GLOBAL would be appropriate
> here.

Set GIT_CONFIG_GLOBAL will shadow ~/.gitconfig, while GIT_CONFIG_SYSTEM
is applied before ~/.gitconfig, so that user can have some out-of guix
managed options in ~/.gitconfig if they really want (maybe password?).


> 宋文武 schreef op ma 07-03-2022 om 22:51 [+0800]:
>> Hello, with:
>> --8<---------------cut here---------------start------------->8---
>> (service home-git-service-type
>>  (home-git-configuration
>>   (options '((user (name "foo")
>>                    (email "foo@bar.com")))))) [...]
>
> How about providing an option for passwords?  E.g.,
>
>  (home-git-configuration
>    (user (git-user-info
>            (name "Foobar")
>            (e-mail "Foobar <foo@bar.com>")
>            (signing-key "some PGP fingerprint)))
>    (secrets-file "/home/foo/the-password")
>    (smtp (git-smtp-configuration
>            #;(password "12345") ; not recommended, use 'secrets-file' instead
>            ...))
>
> (with some appropriate documentation)
>
> secrets-file (not interned in the store):
>   
>   # I don't remember the exact option name
>   smtp.password = Foobaz
>
> the produced .gitconfig would include a line
>
>   [include]
>     path = /home/foo/the-password

Um, I can get it with sexp options:
--8<---------------cut here---------------start------------->8---
  (options '((include (path "/home/foo/the-password"))
             (include (path "/home/foo/another-file"))))
--8<---------------cut here---------------end--------------->8---


Or if with proper record fields, I'd like to keep the original git
variables names in scheme too:
--8<---------------cut here---------------start------------->8---
  (user.name "Foobar")
  (user.email "foo@bar.com")
  (include.path (list "/home/foo/the-password"
                      "/home/foo/another-file"))
  (sendemail.smtpPass "12345" )
--8<---------------cut here---------------end--------------->8---

But with record field name, I don't know how to encode variables with
subsection (eg: url.<base>.insteadOf):

  [url "https://mirror.sjtu.edu.cn/git/guix.git";]
    insteadof = https://git.savannah.gnu.org/git/guix.git


The subsection name may not be a valid scheme variable name...


I'll update this patch with adding doc and proper record fields for some
important options later, thank you!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]