From mboxrd@z Thu Jan 1 00:00:00 1970 From: ng0 Subject: not a patch.. yet. git-daemon-service Date: Fri, 17 Jun 2016 23:10:45 +0000 Message-ID: <20160617231045.GA4910@khazad-dum> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="J2SCkAp4GZ/dPZZf" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE2ui-0007Wn-F3 for guix-devel@gnu.org; Fri, 17 Jun 2016 19:11:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bE2ue-0007A5-DH for guix-devel@gnu.org; Fri, 17 Jun 2016 19:10:59 -0400 Received: from 93-95-228-168.1984.is ([93.95.228.168]:46134 helo=beleriand.n0.is) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE2ud-00079t-Vx for guix-devel@gnu.org; Fri, 17 Jun 2016 19:10:56 -0400 Received: by beleriand.n0.is (OpenSMTPD) with ESMTPSA id e3b5ba62 TLS version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO for ; Fri, 17 Jun 2016 23:10:50 +0000 (UTC) Content-Disposition: inline List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org --J2SCkAp4GZ/dPZZf Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I've been working on understanding and applying to my first shepherd servic= e. 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 =C2=A9 2016 ng0 > ;;; > ;;; 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 . > (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: > =0C > ;;; > ;;; Git. > ;;; > (define-record-type* > 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?) ;; tho= se 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 opt= ion 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 base-path port extra-setting= s) > (let ((conf (string-append " > --base-path=3D"base-path" > --port=3D"(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= =2E") > (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)))) -- =E2=99=A5=E2=92=B6 ng0 For non-prism friendly talk find me on psyced.org / loupsycedyglgamf.onion --J2SCkAp4GZ/dPZZf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iF4EARYKAAYFAldkg3UACgkQhhoAchyzrCBA2AEAgFKSI0OGBejmiNSD7oZBOsDX N7i5ET7nWzvswYMNdGkA/1B1u8xfEKbe4cEbnkXNRmWxrBDf3k80V5yE/jAMf6IG =qJ7d -----END PGP SIGNATURE----- --J2SCkAp4GZ/dPZZf--