宋文武 <iyzs...@member.fsf.org> writes: > ng0 <n...@we.make.ritual.n0.is> writes: > > >>> From d1d7eb59ca53833098cea2d6eddaa59f1494b579 Mon Sep 17 00:00:00 2001 >>> From: ng0 <n...@we.make.ritual.n0.is> >>> Date: Fri, 8 Jul 2016 15:42:55 +0000 >>> Subject: [PATCH] gnu: services: Add git-service. >>> >>> * gnu/services/version-control.scm: New file, create it. >>> (git-service): New Procedures. >>> (git-service-type): New variable. >>> * doc/guix.texi: Add documentation. > > I think it should be: * doc/guix.text (Services)(Version Control): New > section. > >> [...] >>> +(define %git-accounts >>> + ;; User account and groups for git-daemon. >>> + (list (user-group >>> + (name "git") >>> + (system? #t)) >>> + (user-account >>> + (name "git") >>> + (system? #t) >>> + (group "git") >>> + (comment "Shepherd created user for the git-daemon service") >>> + (home-directory "/var/git") > > I think it doesn't need a home directory. > >>> + (shell #~(string-append #$shadow "/bin/git-shell"))))) > > Use 'nologin' should be enough, according to `man git-shell', it's for > SSH access.
The ssh access is intended, that's why it had a home-directory. For now I will apply what you suggested, but this is a use case I have myself and why would I use gitolite when git+ssh do the job well enough. > Also, it seems this 'git' user is not used anywhere, it should be passed > as the '--user' argument to 'git daemon' or as '#:user' to > 'make-forkexec-constructor'. > >>> + >>> +(define (git-activation config) >>> + "Return the activation gexp for CONFIG." >>> + #~(begin (use-modules (guix build utils)) >>> + ;; Create the default base-directory, see `man git daemon'. >>> + (mkdir-p "/var/git/repositories"))) > > This should create the 'git-configuration-base-directory' of config, and > make sure it's readable by the 'git' user. > > >>> +(define* (git-service #:key >>> + (git git) >>> + (base-directory "/var/git/repositories") >>> + (user-directory? #f) >>> + (user-directory? "") >>> + (directory? #f) >>> + (directory "") >>> + (port 9418) >>> + (pid-file? #t) >>> + (pid-file "/var/run/git-daemon.pid") >>> + (max-connections 32)) > > This should just accept a <git-configuration> object, and document it in > the manaual (no need to make detail comments in the git-command, which I > think a mention to `man git-daemon' is fine there). How? This thread is taking so much time because this is one of my 3 first services and I'm trying to learn more guile. I'll look at other services like before, but I asked for help because I'm stuck. I think openssh-service had this.. But what I have worked before I added all other options, and for now I want it this way.. Just debug this without changing it any further. But if this would not require much changes which can not break things further, I'll apply it. > > For testing, I guess 'git clone git://localhost/xxx' in the VM is > enough. > > And the patch doesn't apply for me, can you send an update one? >