From: ng0 <ng0@we.make.ritual.n0.is>
To: guix-devel@gnu.org
Subject: not a patch.. yet. git-daemon-service
Date: Fri, 17 Jun 2016 23:10:45 +0000 [thread overview]
Message-ID: <20160617231045.GA4910@khazad-dum> (raw)
[-- Attachment #1: Type: text/plain, Size: 5583 bytes --]
I've been working on understanding and applying to my first shepherd service.
There are maybe syntax errors, I did not look at it yet this way nor did
I run it.
I have some general questions which I will write into the code, not code
related questions. I will clean up, check up and fix and then ask about
the code.
Well coming back to it, I only have one question, but with this I can
give you a view on what I intend to do (and which I will fix).
> ;;; GNU Guix --- Functional package management for GNU
> ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
> ;;;
> ;;; 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 services version-control)
> #:use-module (gnu services)
> #:use-module (gnu services base)
> #:use-module (gnu services shepherd)
> #:use-module (gnu system shadow)
> #:use-module (gnu packages version-control)
> #:use-module (gnu packages admin)
> #:use-module (guix records)
> #:use-module (guix gexp)
> #:export (git-daemon-service
> git-daemon-service-type))
> ;;; Commentary:
> ;;;
> ;;; Version Control related services.
> ;;;
> ;;; Code:
> \f
> ;;;
> ;;; Git.
> ;;;
> (define-record-type* <git-daemon-configuration>
> git-daemon-configuration make-git-daemon-configuration
> git-daemon-configuration?
> (git-daemon git-daemon-configuration-git
> (default git))
> (base-path git-daemon-configuration-base-path) ; string
> (port git-daemon-configuration-port) ; string (default: 9418)
> (extra-settings git-daemon-configuration-extra-settings))
> ;;(export-all git-daemon-configuration-export-all?) ;; those are switches I need to add differently
> ;;(informative-errors git-daemon-configuration-informative-errors?) ;; same.
> ;;(verbose git-daemon-configuration-verbose?)) ;; same.
There are many settings. The ones I think are the very basic ones which can
be used for a start for this service are:
port, base-path, a forced --syslog --informative-errors and finally the option
to add whatever you want to add when you read the man page.
There are more we can add later, but those are the very basic in my opinion.
What's your opinion?
> ;; todo?: create repo folders and include them in the system generations?
> (define %git-daemon-activation
> ;; Activation gexp.
> #~(begin
> (use-modules (guix build utils))
> (mkdir-p "/var/run/git-daemon")))
> (define git-daemon-shepherd-service
> (match-lambda
> (($ <git-daemon-configuration> git-daemon base-path port extra-settings)
> (let ((conf (string-append "
> --base-path="base-path"
> --port="(number->string port)"
> " extra-settings))))
> (list (shepherd-service
> (provision '(git-daemon))
> (requirement '(networking loopback syslog)) ;; syslog?
> (documentation "Run the git daemon server for git repositories.")
> (start #~(make-forkexec-constructor
> (list (string-append #$git-daemon "/bin/git")
> "daemon" "--syslog" "--informative-errors"
> #$conf)))
> (stop #~(make-kill-destructor)))))))
> (define %git-daemon-accounts
> ;; User account and groups for git-daemon.
> (list (user-group (name "git") (system? #t))
> (user-account
> (name "git")
> (group "git")
> (system? #t)
> (comment "git daemon user")
> (home-directory "/var/empty")
> (shell #~(string-append #$shadow "/sbin/nologin")))))
> (define git-daemon-service-type
> (service-type (name 'git-daemon)
> (extensions
> (list (service-extension shepherd-root-service-type
> git-daemon-shepherd-service)
> (service-extension activation-service-type
> (const %git-daemon-activation))
> ;; Add git-daemon to the global profile.
> (service-extension profile-service-type list)))))
> (define* (git-daemon-service #:key (git git)
> (extra-settings "")
> base-path
> (port 9418))
> "Return a service that runs @url{https://git-scm.org,git} as a daemon,
> etc...
> The daemon will listen on the port specified in @var{port}.
> In addition, @var{extra-settings} specifies a string to append to the
> daemon parameters."
> (service git-daemon-service-type
> (git-daemon-configuration
> (git git) (base-path base-path)
> (port port) (extra-settings extra-settings))))
--
♥Ⓐ ng0
For non-prism friendly talk find me on
psyced.org / loupsycedyglgamf.onion
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next reply other threads:[~2016-06-17 23:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-17 23:10 ng0 [this message]
2016-06-20 8:26 ` not a patch.. yet. git-daemon-service Ludovic Courtès
2016-07-04 7:37 ` ng0
2016-07-04 8:31 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160617231045.GA4910@khazad-dum \
--to=ng0@we.make.ritual.n0.is \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).