* pre-release [PATCH] git-service
@ 2016-07-08 15:53 ng0
2016-07-08 18:24 ` Thompson, David
0 siblings, 1 reply; 16+ messages in thread
From: ng0 @ 2016-07-08 15:53 UTC (permalink / raw)
To: guix-devel
I need some feedback on the git-service.
The inserted patch gives me this output:
ng0@shadowwalker ~/guix-git-service$ ./pre-inst-env guix system
vm ~/testvm.scm
Backtrace:
In ice-9/boot-9.scm:
1724: 19 [%start-stack load-stack ...]
1729: 18 [#<procedure 19ceea0 ()>]
In unknown file:
?: 17 [primitive-load
"/home/ng0/guix-git-service/scripts/guix"]
In guix/ui.scm:
1209: 16 [run-guix-command system "vm" "/home/ng0/testvm.scm"]
In ice-9/boot-9.scm:
157: 15 [catch srfi-34 #<procedure 457dd20 at
guix/ui.scm:425:2 ()> ...]
157: 14 [catch system-error ...]
In guix/scripts/system.scm:
882: 13 [#<procedure 4580ed0 at
guix/scripts/system.scm:874:2 ()>]
788: 12 [process-action vm ("/home/ng0/testvm.scm") ...]
In guix/store.scm:
1182: 11 [run-with-store # ...]
In guix/scripts/system.scm:
800: 10 [#<procedure 458ae40 at
guix/scripts/system.scm:792:8 (state)> #]
564: 9 [perform-action vm # # ...]
In gnu/system/vm.scm:
496: 8 [system-qemu-image/shared-store-script # # #
...]
In gnu/system.scm:
601: 7 [operating-system-derivation # # #f]
In gnu/services.scm:
601: 6 [loop #]
In srfi/srfi-1.scm:
578: 5 [map #<procedure 4a00a00 at
gnu/services.scm:590:4 (service)> (# # #)]
In gnu/services.scm:
463: 4 [packages->profile-entry (# # # # ...)]
In guix/profiles.scm:
187: 3 [packages->manifest (# # # # ...)]
In srfi/srfi-1.scm:
576: 2 [map #<procedure 2278ce0 at
guix/profiles.scm:188:8 (expr)> (# # # # ...)]
In guix/profiles.scm:
174: 1 [package->manifest-entry # #f]
In guix/packages.scm:
638: 0 [package-transitive-propagated-inputs #]
guix/packages.scm:638:21: In procedure
package-transitive-propagated-inputs:
guix/packages.scm:638:21: In procedure
%package-propagated-inputs-real: Wrong type argument:
#<<git-configuration> git: #<package git@2.9.0
gnu/packages/version-control.scm:113 39349c0> base-path:
"/var/git/repositories" port: 9418>
From bfff0a190b51deca3849738310f03f2289f10881 Mon Sep 17 00:00:00 2001
From: ng0 <ng0@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.
---
gnu/local.mk | 1 +
gnu/services/version-control.scm | 110 +++++++++++++++++++++++++++++++++++++++
2 files changed, 111 insertions(+)
create mode 100644 gnu/services/version-control.scm
diff --git a/gnu/local.mk b/gnu/local.mk
index 947d1b0..eb0fd9a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -384,6 +384,7 @@ GNU_SYSTEM_MODULES = \
%D%/services/shepherd.scm \
%D%/services/herd.scm \
%D%/services/ssh.scm \
+ %D%/services/version-control.scm \
%D%/services/web.scm \
%D%/services/xorg.scm \
\
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm
new file mode 100644
index 0000000..ad41afc
--- /dev/null
+++ b/gnu/services/version-control.scm
@@ -0,0 +1,110 @@
+ ;;; 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)
+ #:use-module (ice-9 match)
+ #:export (git-service
+ git-service-type))
+
+;;; Commentary:
+;;;
+;;; Version Control related services.
+;;;
+;;; Code:
+
+\f
+;;;
+;;; git
+;;;
+
+(define-record-type* <git-configuration>
+ git-configuration make-git-configuration
+ git-configuration?
+ (git git-configuration-git ; <package>
+ (default git))
+ (base-path git-configuration-base-path) ; string
+ (port git-configuration-port)) ; string
+
+
+(define git-shepherd-service
+ (match-lambda
+ (($ <git-configuration> git base-path port)
+ (let ((conf (string-append
+ "--base-path="base-path
+ "--port="(number->string port))))
+ (list (shepherd-service
+ (provision '(git))
+ (requirement '(networking loopback syslogd))
+ (documentation "Run the git-daemon server for git repositories")
+ (start #~(make-forkexec-constructor
+ (list (string-append #$git "/bin/git")
+ "daemon" "--syslog" "--informative-errors"
+ #$conf)))
+ (stop #~(make-kill-destructor))))))))
+
+(define %git-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/git")
+ (shell #~(string-append #$shadow "/sbin/nologin")))))
+
+(define %git-activation
+ ;; Activation gexp.
+ #~(begin (use-modules (guix build utils))
+ (mkdir-p "/var/run/git-daemon")))
+
+(define git-service-type
+ (service-type
+ (name 'git)
+ (extensions
+ (list (service-extension shepherd-root-service-type
+ git-shepherd-service)
+ (service-extension activation-service-type
+ (const %git-activation))
+ ;; Add git-daemon to the global profile.
+ (service-extension profile-service-type list)))))
+
+(define* (git-service #:key
+ (git git)
+ (base-path "/var/git/repositories")
+ (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-service-type
+ (git-configuration
+ (git git)
+ (base-path base-path)
+ (port port))))
--
2.9.0
--
♥Ⓐ ng0
For non-prism friendly talk find me on http://www.psyced.org
SecuShare – http://secushare.org
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service
2016-07-08 15:53 pre-release [PATCH] git-service ng0
@ 2016-07-08 18:24 ` Thompson, David
2016-07-08 20:41 ` Ricardo Wurmus
0 siblings, 1 reply; 16+ messages in thread
From: Thompson, David @ 2016-07-08 18:24 UTC (permalink / raw)
To: ng0; +Cc: guix-devel
On Fri, Jul 8, 2016 at 11:53 AM, ng0 <ng0@we.make.ritual.n0.is> wrote:
> I need some feedback on the git-service.
> The inserted patch gives me this output:
>
>
> +(define-record-type* <git-configuration>
> + git-configuration make-git-configuration
> + git-configuration?
> + (git git-configuration-git ; <package>
> + (default git))
> + (base-path git-configuration-base-path) ; string
> + (port git-configuration-port)) ; string
So, this is a record type...
> +
> +(define git-shepherd-service
> + (match-lambda
> + (($ <git-configuration> git base-path port)
> + (let ((conf (string-append
> + "--base-path="base-path
> + "--port="(number->string port))))
> + (list (shepherd-service
> + (provision '(git))
> + (requirement '(networking loopback syslogd))
> + (documentation "Run the git-daemon server for git repositories")
> + (start #~(make-forkexec-constructor
> + (list (string-append #$git "/bin/git")
> + "daemon" "--syslog" "--informative-errors"
> + #$conf)))
...and you (ungexp conf), where conf is an instance of that record
type, into what is supposed to be a list of strings that form command
line arguments for git. See the issue?
> + (stop #~(make-kill-destructor))))))))
- Dave
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service
2016-07-08 18:24 ` Thompson, David
@ 2016-07-08 20:41 ` Ricardo Wurmus
2016-07-09 1:08 ` ng0
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: Ricardo Wurmus @ 2016-07-08 20:41 UTC (permalink / raw)
To: Thompson, David; +Cc: guix-devel
Thompson, David <dthompson2@worcester.edu> writes:
> On Fri, Jul 8, 2016 at 11:53 AM, ng0 <ng0@we.make.ritual.n0.is> wrote:
>> I need some feedback on the git-service.
>> The inserted patch gives me this output:
>>
>>
>> +(define-record-type* <git-configuration>
>> + git-configuration make-git-configuration
>> + git-configuration?
>> + (git git-configuration-git ; <package>
>> + (default git))
>> + (base-path git-configuration-base-path) ; string
>> + (port git-configuration-port)) ; string
>
> So, this is a record type...
>
>> +
>> +(define git-shepherd-service
>> + (match-lambda
>> + (($ <git-configuration> git base-path port)
>> + (let ((conf (string-append
>> + "--base-path="base-path
>> + "--port="(number->string port))))
>> + (list (shepherd-service
>> + (provision '(git))
>> + (requirement '(networking loopback syslogd))
>> + (documentation "Run the git-daemon server for git repositories")
>> + (start #~(make-forkexec-constructor
>> + (list (string-append #$git "/bin/git")
>> + "daemon" "--syslog" "--informative-errors"
>> + #$conf)))
>
> ...and you (ungexp conf), where conf is an instance of that record
> type, into what is supposed to be a list of strings that form command
> line arguments for git. See the issue?
I might be misreading this, but “conf” here is literally the string
“--base-path=something--port=1234”
when “base-path” is the string “something” and “port” is the number
“1234”.
The let binding for “conf” is incorrect.
First, you say earlier that “port” is a string:
> + (port git-configuration-port)) ; string
but then you pass it to “number->string”, so it’s actually expected to
be a number.
Second, the argument to “make-forkexec-constructor” is supposed to be a
list of strings, each representing one argument. So defining “conf” as
a concatenation is not okay. You don’t need a let-binding for “conf” at
all. Just use “base-path” and “port” directly. (I haven’t tested
this.)
(list (string-append #$git "/bin/git")
"daemon" "--syslog" "--informative-errors"
(string-append "--base-path=" $#base-path)
(string-append "--port=" $#port))
But the error you get stems from passing a value of
“<git-configuration>” to something that expects a package. I don’t see
where this happens. Since I cannot see “~/testvm.scm” I cannot tell you
anything more.
~~ Ricardo
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service
2016-07-08 20:41 ` Ricardo Wurmus
@ 2016-07-09 1:08 ` ng0
2016-07-13 10:23 ` ng0
2016-07-13 16:37 ` pre-release [PATCH] git-service [v2] ng0
2 siblings, 0 replies; 16+ messages in thread
From: ng0 @ 2016-07-09 1:08 UTC (permalink / raw)
To: guix-devel
Ricardo Wurmus <rekado@elephly.net> writes:
> Thompson, David <dthompson2@worcester.edu> writes:
>
>> On Fri, Jul 8, 2016 at 11:53 AM, ng0 <ng0@we.make.ritual.n0.is> wrote:
>>> I need some feedback on the git-service.
>>> The inserted patch gives me this output:
>>>
>>>
>>> +(define-record-type* <git-configuration>
>>> + git-configuration make-git-configuration
>>> + git-configuration?
>>> + (git git-configuration-git ; <package>
>>> + (default git))
>>> + (base-path git-configuration-base-path) ; string
>>> + (port git-configuration-port)) ; string
>>
>> So, this is a record type...
>>
>>> +
>>> +(define git-shepherd-service
>>> + (match-lambda
>>> + (($ <git-configuration> git base-path port)
>>> + (let ((conf (string-append
>>> + "--base-path="base-path
>>> + "--port="(number->string port))))
>>> + (list (shepherd-service
>>> + (provision '(git))
>>> + (requirement '(networking loopback syslogd))
>>> + (documentation "Run the git-daemon server for git repositories")
>>> + (start #~(make-forkexec-constructor
>>> + (list (string-append #$git "/bin/git")
>>> + "daemon" "--syslog" "--informative-errors"
>>> + #$conf)))
>>
>> ...and you (ungexp conf), where conf is an instance of that record
>> type, into what is supposed to be a list of strings that form command
>> line arguments for git. See the issue?
>
> I might be misreading this, but “conf” here is literally the string
>
> “--base-path=something--port=1234”
>
> when “base-path” is the string “something” and “port” is the number
> “1234”.
>
> The let binding for “conf” is incorrect.
>
> First, you say earlier that “port” is a string:
>
>> + (port git-configuration-port)) ; string
>
> but then you pass it to “number->string”, so it’s actually expected to
> be a number.
>
> Second, the argument to “make-forkexec-constructor” is supposed to be a
> list of strings, each representing one argument. So defining “conf” as
> a concatenation is not okay. You don’t need a let-binding for “conf” at
> all. Just use “base-path” and “port” directly. (I haven’t tested
> this.)
>
> (list (string-append #$git "/bin/git")
> "daemon" "--syslog" "--informative-errors"
> (string-append "--base-path=" $#base-path)
> (string-append "--port=" $#port))
>
> But the error you get stems from passing a value of
> “<git-configuration>” to something that expects a package. I don’t see
> where this happens. Since I cannot see “~/testvm.scm” I cannot tell you
> anything more.
>
> ~~ Ricardo
>
I just came back, I'll look at everything else tomorrow. Thanks
for the replies so far!
This is the testvm.scm:
(use-modules (gnu) (gnu system nss))
(use-service-modules desktop networking ssh version-control dbus avahi xorg)
(use-package-modules certs)
(use-package-modules tor emacs xorg version-control avahi xorg ssh)
(operating-system
(host-name "testvm")
(timezone "UTC")
(locale "en_US.UTF-8")
(bootloader (grub-configuration (device "/dev/sda")))
(file-systems
(list (file-system
(mount-point "/")
(device "dummy")
(type "dummy"))
%binary-format-file-system))
(users (list (user-account
(name "ng0")
(comment "")
(group "users")
(supplementary-groups '("wheel" "netdev"
"audio" "video"))
(home-directory "/home/ng0")
(password ""))))
(services (cons* (slim-service #:auto-login? #t
#:default-user "ng0")
(console-keymap-service "de-latin1")
(static-networking-service "eth0" "10.0.2.10"
#:name-servers '("10.0.2.3")
#:gateway "10.0.2.2")
;;(avahi-service)
;;(dbus-service (list avahi))
(git-service)
%base-services))
(pam-services
(base-pam-services #:allow-empty-passwords? #t))
(packages (cons* emacs openssh git xterm
avahi findutils grep which xmodmap
%base-packages)))
--
♥Ⓐ ng0
For non-prism friendly talk find me on http://www.psyced.org
SecuShare – http://secushare.org
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service
2016-07-08 20:41 ` Ricardo Wurmus
2016-07-09 1:08 ` ng0
@ 2016-07-13 10:23 ` ng0
2016-07-13 16:37 ` pre-release [PATCH] git-service [v2] ng0
2 siblings, 0 replies; 16+ messages in thread
From: ng0 @ 2016-07-13 10:23 UTC (permalink / raw)
To: guix-devel
Hi,
thanks to you both for your help!
Ricardo Wurmus <rekado@elephly.net> writes:
> Thompson, David <dthompson2@worcester.edu> writes:
>
>> On Fri, Jul 8, 2016 at 11:53 AM, ng0 <ng0@we.make.ritual.n0.is> wrote:
>>> I need some feedback on the git-service.
>>> The inserted patch gives me this output:
>>>
>>>
>>> +(define-record-type* <git-configuration>
>>> + git-configuration make-git-configuration
>>> + git-configuration?
>>> + (git git-configuration-git ; <package>
>>> + (default git))
>>> + (base-path git-configuration-base-path) ; string
>>> + (port git-configuration-port)) ; string
>>
>> So, this is a record type...
>>
>>> +
>>> +(define git-shepherd-service
>>> + (match-lambda
>>> + (($ <git-configuration> git base-path port)
>>> + (let ((conf (string-append
>>> + "--base-path="base-path
>>> + "--port="(number->string port))))
>>> + (list (shepherd-service
>>> + (provision '(git))
>>> + (requirement '(networking loopback syslogd))
>>> + (documentation "Run the git-daemon server for git repositories")
>>> + (start #~(make-forkexec-constructor
>>> + (list (string-append #$git "/bin/git")
>>> + "daemon" "--syslog" "--informative-errors"
>>> + #$conf)))
>>
>> ...and you (ungexp conf), where conf is an instance of that record
>> type, into what is supposed to be a list of strings that form command
>> line arguments for git. See the issue?
With the additional input Ricardo gave it's clearer now.
>
> I might be misreading this, but “conf” here is literally the string
>
> “--base-path=something--port=1234”
>
> when “base-path” is the string “something” and “port” is the number
> “1234”.
>
> The let binding for “conf” is incorrect.
>
> First, you say earlier that “port” is a string:
>
>> + (port git-configuration-port)) ; string
>
> but then you pass it to “number->string”, so it’s actually expected to
> be a number.
>
> Second, the argument to “make-forkexec-constructor” is supposed to be a
> list of strings, each representing one argument. So defining “conf” as
> a concatenation is not okay. You don’t need a let-binding for “conf” at
> all. Just use “base-path” and “port” directly. (I haven’t tested
> this.)
>
> (list (string-append #$git "/bin/git")
> "daemon" "--syslog" "--informative-errors"
> (string-append "--base-path=" $#base-path)
> (string-append "--port=" $#port))
>
> But the error you get stems from passing a value of
> “<git-configuration>” to something that expects a package. I don’t see
> where this happens. Since I cannot see “~/testvm.scm” I cannot tell you
> anything more.
>
> ~~ Ricardo
>
I based this on information sourced from other services, and some
parts (the service field and the shepherd-service) are just
testing out what is expected and what's not.
I feel like your information and what I need to read up on helps
alot.
thanks.
--
♥Ⓐ ng0
For non-prism friendly talk find me on http://www.psyced.org
SecuShare – http://secushare.org
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service [v2]
2016-07-08 20:41 ` Ricardo Wurmus
2016-07-09 1:08 ` ng0
2016-07-13 10:23 ` ng0
@ 2016-07-13 16:37 ` ng0
2016-07-14 9:07 ` ng0
2 siblings, 1 reply; 16+ messages in thread
From: ng0 @ 2016-07-13 16:37 UTC (permalink / raw)
To: Ricardo Wurmus; +Cc: guix-devel
Hi,
this is an updated patch which in combination with the testvm.scm
further below produces the output which can be seen at the bottom
of this mail, not very different from where I started with.
The testvm.scm might have some issues, but I'll notice once I get
to the point where the service stops throwing errors.
From 55211aa38f0ba8cb4e458b2c145b3ef7e1d7f334 Mon Sep 17 00:00:00 2001
From: ng0 <ng0@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.
---
gnu/local.mk | 1 +
gnu/services/version-control.scm | 115 +++++++++++++++++++++++++++++++++++++++
2 files changed, 116 insertions(+)
create mode 100644 gnu/services/version-control.scm
diff --git a/gnu/local.mk b/gnu/local.mk
index d011844..5808d14 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -384,6 +384,7 @@ GNU_SYSTEM_MODULES = \
%D%/services/shepherd.scm \
%D%/services/herd.scm \
%D%/services/ssh.scm \
+ %D%/services/version-control.scm \
%D%/services/web.scm \
%D%/services/xorg.scm \
\
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm
new file mode 100644
index 0000000..5654783
--- /dev/null
+++ b/gnu/services/version-control.scm
@@ -0,0 +1,115 @@
+;;; 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)
+ #:use-module (srfi srfi-1)
+ ;; check for redundancy / necessity:
+ ;; #:use-module (srfi srfi-9)
+ ;; #:use-module (srfi srfi-26)
+ ;; #:use-module (srfi srfi-34)
+ #:use-module (ice-9 match)
+ #:export (git-service
+ git-service-type))
+
+;;; Commentary:
+;;;
+;;; Version Control related services.
+;;;
+;;; Code:
+
+\f
+;;;
+;;; git
+;;;
+
+(define-record-type* <git-configuration>
+ git-configuration make-git-configuration
+ git-configuration?
+ (git git-configuration-git ;<package>
+ (default git))
+ (base-path git-configuration-base-path
+ (default "/var/git/repositories")) ;string
+ (port git-configuration-port
+ (default 9418))) ;number
+
+(define git-shepherd-service
+ (match-lambda
+ (($ <git-configuration> git base-path port)
+ (list (shepherd-service
+ (provision '(git))
+ (requirement '(networking loopback syslogd))
+ (documentation "Run the git-daemon server for git repositories")
+ (start #~(make-forkexec-constructor
+ (list (string-append #$git "/bin/git")
+ "daemon" "--syslog" "--informative-errors"
+ (string-append "--base-path=" $#base-path)
+ (string-append "--port=" $#port))))
+ (stop #~(make-kill-destructor)))))))
+
+;; We maybe need it to have the git-shell instead.
+(define %git-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/git")
+ (shell #~(string-append #$shadow "/sbin/nologin")))))
+
+(define %git-activation
+ ;; Activation gexp.
+ #~(begin (use-modules (guix build utils))
+ (mkdir-p "/var/run/git-daemon")))
+
+(define git-service-type
+ (service-type
+ (name 'git)
+ (extensions
+ (list (service-extension shepherd-root-service-type
+ git-shepherd-service)
+ (service-extension activation-service-type
+ (const %git-activation))
+ ;; Add git-daemon to the global profile.
+ (service-extension profile-service-type list)))))
+
+(define* (git-service #:key
+ (git git)
+ (base-path "/var/git/repositories")
+ (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-service-type
+ (git-configuration
+ (git git)
+ (base-path base-path)
+ (port port))))
--
2.9.0
testvm.scm:
(use-modules (gnu) (gnu system nss))
1(use-service-modules networking ssh version-control dbus avahi xorg)
(use-package-modules certs)
(use-package-modules tor emacs xorg version-control avahi xorg ssh)
(operating-system
(host-name "testvm")
(timezone "UTC")
(locale "en_US.UTF-8")
(bootloader (grub-configuration (device "/dev/sda")))
(file-systems
(list (file-system
(mount-point "/")
(device "dummy")
(type "dummy"))
%binary-format-file-system))
(users (list (user-account
(name "bobthecrashtestdummy")
(comment "")
(group "users")
(supplementary-groups '("wheel" "netdev"
"audio" "video"))
(home-directory "/home/bobthecrashtestdummy")
(password ""))))
(services (cons* (slim-service #:auto-login? #t
#:default-user "bobthecrashtestdummy")
(console-keymap-service "de-latin1")
(static-networking-service "eth0" "10.0.2.10"
#:name-servers '("10.0.2.3")
#:gateway "10.0.2.2")
;;(avahi-service)
;;(dbus-service (list avahi))
(git-service)
%base-services))
;;%desktop-services))
(pam-services
(base-pam-services #:allow-empty-passwords? #t))
(packages (cons* emacs openssh git xterm
avahi findutils grep which xmodmap
%base-packages)))
ng0@shadowwalker ~/src/guix/guix-git-service$ ./pre-inst-env guix
system vm ~/src/guix/testvm.scm
Backtrace:
In ice-9/boot-9.scm:
1724: 19 [%start-stack load-stack #<procedure fc0b60 at
ice-9/boot-9.scm:4041:10 ()>]
1729: 18 [#<procedure fc5ea0 ()>]
In unknown file:
?: 17 [primitive-load
"/home/ng0/src/guix/guix-git-service/scripts/guix"]
In guix/ui.scm:
1209: 16 [run-guix-command system "vm"
"/home/ng0/src/guix/testvm.scm"]
In ice-9/boot-9.scm:
157: 15 [catch srfi-34 #<procedure 3b761a0 at
guix/ui.scm:425:2 ()> ...]
157: 14 [catch system-error ...]
In guix/scripts/system.scm:
882: 13 [#<procedure 3b78cf0 at
guix/scripts/system.scm:874:2 ()>]
788: 12 [process-action vm
("/home/ng0/src/guix/testvm.scm") ...]
In guix/store.scm:
1182: 11 [run-with-store # ...]
In guix/scripts/system.scm:
800: 10 [#<procedure 3cc3a20 at
guix/scripts/system.scm:792:8 (state)> #]
564: 9 [perform-action vm # # ...]
In gnu/system/vm.scm:
496: 8 [system-qemu-image/shared-store-script # # #
...]
In gnu/system.scm:
601: 7 [operating-system-derivation # # #f]
In gnu/services.scm:
601: 6 [loop #]
In srfi/srfi-1.scm:
578: 5 [map #<procedure 4b413c0 at
gnu/services.scm:590:4 (service)> (# # #)]
In gnu/services.scm:
463: 4 [packages->profile-entry (# # # # ...)]
In guix/profiles.scm:
187: 3 [packages->manifest (# # # # ...)]
In srfi/srfi-1.scm:
576: 2 [map #<procedure 1867a60 at
guix/profiles.scm:188:8 (expr)> (# # # # ...)]
In guix/profiles.scm:
174: 1 [package->manifest-entry # #f]
In guix/packages.scm:
638: 0 [package-transitive-propagated-inputs #]
guix/packages.scm:638:21: In procedure
package-transitive-propagated-inputs:
guix/packages.scm:638:21: In procedure
%package-propagated-inputs-real: Wrong type argument:
#<<git-configuration> git: #<package git@2.9.0
gnu/packages/version-control.scm:113 2f229c0> base-path:
"/var/git/repositories" port: 9418>
--
♥Ⓐ ng0
For non-prism friendly talk find me on http://www.psyced.org
SecuShare – http://secushare.org
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service [v2]
2016-07-13 16:37 ` pre-release [PATCH] git-service [v2] ng0
@ 2016-07-14 9:07 ` ng0
2016-08-11 15:55 ` ng0
0 siblings, 1 reply; 16+ messages in thread
From: ng0 @ 2016-07-14 9:07 UTC (permalink / raw)
To: guix-devel
As I wrote yesterday in freenode, disregard this patch. I
succeeded and currently am debugging the VM.
--
♥Ⓐ ng0
For non-prism friendly talk find me on http://www.psyced.org
SecuShare – http://secushare.org
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service [v2]
2016-07-14 9:07 ` ng0
@ 2016-08-11 15:55 ` ng0
2016-08-19 9:02 ` ng0
2016-08-22 8:03 ` Alex Kost
0 siblings, 2 replies; 16+ messages in thread
From: ng0 @ 2016-08-11 15:55 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 309 bytes --]
ng0 <ng0@we.make.ritual.n0.is> writes:
> As I wrote yesterday in freenode, disregard this patch. I
> succeeded and currently am debugging the VM.
I had it working at some point, but only to find out that I am passing
something wrong in the service.
Can someone take a look at this service and help me out?
[-- Attachment #2: testvm.scm --]
[-- Type: application/octet-stream, Size: 1658 bytes --]
;; bare bones, no X11 server.
(use-modules (gnu) (gnu system nss))
(use-service-modules networking ssh version-control dbus avahi)
(use-package-modules certs suckless admin xorg)
(use-package-modules tor emacs version-control avahi ssh)
(operating-system
(host-name "testvm")
(timezone "UTC")
(locale "en_US.UTF-8")
(bootloader (grub-configuration (device "/dev/sda")))
(file-systems
(list (file-system
(mount-point "/")
(device "dummy")
(type "dummy"))
%binary-format-file-system))
(users (list (user-account
(name "bobthecrashtestdummy")
(comment "")
(group "users")
(supplementary-groups '("wheel" "netdev"
"audio" "video"))
(home-directory "/home/bobthecrashtestdummy")
(password ""))))
(services (cons* ;;(slim-service #:auto-login? #t
;; #:default-user "bobthecrashtestdummy")
(console-keymap-service "de")
(static-networking-service "eth0" "10.0.2.10"
#:name-servers '("10.0.2.3")
#:gateway "10.0.2.2")
;;(avahi-service)
;;(dbus-service (list avahi))
(git-service)
;;(lsh-service)
%base-services))
(pam-services
(base-pam-services #:allow-empty-passwords? #t))
(packages (cons* git st sudo
avahi findutils grep which xmodmap
tcpdump %base-packages)))
[-- Attachment #3: 0001-gnu-services-Add-git-service.patch --]
[-- Type: text/x-patch, Size: 5146 bytes --]
From dc84d9e9e537a90606667a963c677111c24bb9d9 Mon Sep 17 00:00:00 2001
From: ng0 <ng0@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.
---
gnu/local.mk | 1 +
gnu/services/version-control.scm | 121 +++++++++++++++++++++++++++++++++++++++
2 files changed, 122 insertions(+)
create mode 100644 gnu/services/version-control.scm
diff --git a/gnu/local.mk b/gnu/local.mk
index af47311..ccffa90 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -386,6 +386,7 @@ GNU_SYSTEM_MODULES = \
%D%/services/herd.scm \
%D%/services/spice.scm \
%D%/services/ssh.scm \
+ %D%/services/version-control.scm \
%D%/services/web.scm \
%D%/services/xorg.scm \
\
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm
new file mode 100644
index 0000000..b566146
--- /dev/null
+++ b/gnu/services/version-control.scm
@@ -0,0 +1,121 @@
+;;; 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)
+ #:use-module (srfi srfi-1)
+ ;; check for redundancy / necessity:
+ ;; #:use-module (srfi srfi-9)
+ ;; #:use-module (srfi srfi-26)
+ ;; #:use-module (srfi srfi-34)
+ #:use-module (ice-9 match)
+ #:export (git-service
+ git-service-type
+ git-configuration
+ git-configuration?
+ git-configuration-git
+ git-configuration-port
+ git-configuration-base-path))
+
+;;; Commentary:
+;;;
+;;; Version Control related services.
+;;;
+;;; Code:
+
+\f
+;;;
+;;; git
+;;;
+
+(define-record-type* <git-configuration> git-configuration
+ make-git-configuration
+ git-configuration?
+ (git git-configuration-git ;package
+ (default git))
+ (base-path git-configuration-base-path) ;string
+ (port git-configuration-port)) ;number
+
+(define (git-shepherd-service config)
+ "Return a <shepherd-service> for git with CONFIG."
+ (define git (git-configuration-git config))
+
+ (define git-command
+ #~(list
+ (string-append #$git "/bin/git") "daemon" "--syslog"
+ "--informative-errors"
+ "--port=" (number->string (git-configuration-port config))
+ "--base-path=" (git-configuration-base-path config)))
+
+ (define requires
+ '(networking syslogd))
+
+ (list (shepherd-service
+ (documentation "Git daemon server for git repositories")
+ (requirement requires)
+ (provision '(git))
+ (start #~(make-forkexec-constructor #$@git-command))
+ (stop #~(make-kill-destructor)))))
+
+(define %git-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/git")
+ (shell #~(string-append #$shadow "/bin/git-shell")))))
+
+(define (git-activation config)
+ "Return the activation gexp for CONFIG."
+ #~(begin (use-modules (guix build utils))
+ (mkdir-p "/var/run/git-daemon")))
+
+(define git-service-type
+ (service-type (name 'git)
+ (extensions
+ (list (service-extension shepherd-root-service-type
+ git-shepherd-service)
+ (service-extension activation-service-type
+ git-activation)))))
+
+(define* (git-service #:key
+ (git git)
+ (base-path "/var/git/repositories")
+ (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-service-type
+ (git-configuration
+ (git git)
+ (base-path base-path)
+ (port port))))
--
2.9.2
[-- Attachment #4: Type: text/plain, Size: 78 bytes --]
--
♥Ⓐ ng0
For non-prism friendly talk find me on http://www.psyced.org
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service [v2]
2016-08-11 15:55 ` ng0
@ 2016-08-19 9:02 ` ng0
2016-08-22 8:03 ` Alex Kost
1 sibling, 0 replies; 16+ messages in thread
From: ng0 @ 2016-08-19 9:02 UTC (permalink / raw)
To: guix-devel
Hi,
could someone take a look at this and help me figure out what's wrong?
Thanks.
ng0 <ng0@we.make.ritual.n0.is> writes:
> ng0 <ng0@we.make.ritual.n0.is> writes:
>
>> As I wrote yesterday in freenode, disregard this patch. I
>> succeeded and currently am debugging the VM.
>
> I had it working at some point, but only to find out that I am passing
> something wrong in the service.
> Can someone take a look at this service and help me out?
>
> From dc84d9e9e537a90606667a963c677111c24bb9d9 Mon Sep 17 00:00:00 2001
> From: ng0 <ng0@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.
> ---
> gnu/local.mk | 1 +
> gnu/services/version-control.scm | 121 +++++++++++++++++++++++++++++++++++++++
> 2 files changed, 122 insertions(+)
> create mode 100644 gnu/services/version-control.scm
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index af47311..ccffa90 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -386,6 +386,7 @@ GNU_SYSTEM_MODULES = \
> %D%/services/herd.scm \
> %D%/services/spice.scm \
> %D%/services/ssh.scm \
> + %D%/services/version-control.scm \
> %D%/services/web.scm \
> %D%/services/xorg.scm \
> \
> diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm
> new file mode 100644
> index 0000000..b566146
> --- /dev/null
> +++ b/gnu/services/version-control.scm
> @@ -0,0 +1,121 @@
> +;;; 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)
> + #:use-module (srfi srfi-1)
> + ;; check for redundancy / necessity:
> + ;; #:use-module (srfi srfi-9)
> + ;; #:use-module (srfi srfi-26)
> + ;; #:use-module (srfi srfi-34)
> + #:use-module (ice-9 match)
> + #:export (git-service
> + git-service-type
> + git-configuration
> + git-configuration?
> + git-configuration-git
> + git-configuration-port
> + git-configuration-base-path))
> +
> +;;; Commentary:
> +;;;
> +;;; Version Control related services.
> +;;;
> +;;; Code:
> +
> +\f
> +;;;
> +;;; git
> +;;;
> +
> +(define-record-type* <git-configuration> git-configuration
> + make-git-configuration
> + git-configuration?
> + (git git-configuration-git ;package
> + (default git))
> + (base-path git-configuration-base-path) ;string
> + (port git-configuration-port)) ;number
> +
> +(define (git-shepherd-service config)
> + "Return a <shepherd-service> for git with CONFIG."
> + (define git (git-configuration-git config))
> +
> + (define git-command
> + #~(list
> + (string-append #$git "/bin/git") "daemon" "--syslog"
> + "--informative-errors"
> + "--port=" (number->string (git-configuration-port config))
> + "--base-path=" (git-configuration-base-path config)))
> +
> + (define requires
> + '(networking syslogd))
> +
> + (list (shepherd-service
> + (documentation "Git daemon server for git repositories")
> + (requirement requires)
> + (provision '(git))
> + (start #~(make-forkexec-constructor #$@git-command))
> + (stop #~(make-kill-destructor)))))
> +
> +(define %git-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/git")
> + (shell #~(string-append #$shadow "/bin/git-shell")))))
> +
> +(define (git-activation config)
> + "Return the activation gexp for CONFIG."
> + #~(begin (use-modules (guix build utils))
> + (mkdir-p "/var/run/git-daemon")))
> +
> +(define git-service-type
> + (service-type (name 'git)
> + (extensions
> + (list (service-extension shepherd-root-service-type
> + git-shepherd-service)
> + (service-extension activation-service-type
> + git-activation)))))
> +
> +(define* (git-service #:key
> + (git git)
> + (base-path "/var/git/repositories")
> + (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-service-type
> + (git-configuration
> + (git git)
> + (base-path base-path)
> + (port port))))
> --
> 2.9.2
>
>
> --
> ♥Ⓐ ng0
> For non-prism friendly talk find me on http://www.psyced.org
--
ng0
For non-prism friendly talk find me on http://www.psyced.org
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service [v2]
2016-08-11 15:55 ` ng0
2016-08-19 9:02 ` ng0
@ 2016-08-22 8:03 ` Alex Kost
2016-08-25 9:55 ` ng0
1 sibling, 1 reply; 16+ messages in thread
From: Alex Kost @ 2016-08-22 8:03 UTC (permalink / raw)
To: ng0; +Cc: guix-devel
ng0 (2016-08-11 18:55 +0300) wrote:
> ng0 <ng0@we.make.ritual.n0.is> writes:
>
>> As I wrote yesterday in freenode, disregard this patch. I
>> succeeded and currently am debugging the VM.
>
> I had it working at some point, but only to find out that I am passing
> something wrong in the service.
> Can someone take a look at this service and help me out?
Hi, I didn't try this service, but I see 2 mistakes in the code.
[...]
> +(define (git-shepherd-service config)
> + "Return a <shepherd-service> for git with CONFIG."
> + (define git (git-configuration-git config))
> +
> + (define git-command
> + #~(list
> + (string-append #$git "/bin/git") "daemon" "--syslog"
> + "--informative-errors"
> + "--port=" (number->string (git-configuration-port config))
> + "--base-path=" (git-configuration-base-path config)))
1. This should be:
"--port=" #$(number->string (git-configuration-port config))
"--base-path=" #$(git-configuration-base-path config)))
Note ‘#$’ before expressions. Without it, these expressions will stay
the same in the final making service code (see below).
> + (define requires
> + '(networking syslogd))
> +
> + (list (shepherd-service
> + (documentation "Git daemon server for git repositories")
> + (requirement requires)
> + (provision '(git))
> + (start #~(make-forkexec-constructor #$@git-command))
2. This should be:
(start #~(make-forkexec-constructor #$git-command))
Note ‘#$@ → #$’. With #$@, the list (I mean git-command) is "spliced",
so the result in "/gnu/store/...-shepherd-git.scm" will be:
(make <service>
...
#:start
(make-forkexec-constructor list
(string-append "/gnu/store/…" "/bin/git")
"daemon" "--syslog" "--informative-errors"
"--port=" (number->string
(git-configuration-port config))
"--base-path="
(git-configuration-base-path config))
...)
While it should be: (make-forkexec-constructor (list ...))
Also I have a question about the final command to start git daemon. It
would look like this:
git daemon --syslog --informative-errors --port=9418 --base-path=/var/git/repositories
Is it intentional? I mean "/var/git/repositories" does not exist and
you don't create it at activation time, so the service (with the default
'base-path') will fail anyway.
But you create "/var/run/git-daemon". Is it really needed? I know
nothing about "git daemon", but IIUC it starts successfully without this
directory.
--
Alex
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service [v2]
2016-08-22 8:03 ` Alex Kost
@ 2016-08-25 9:55 ` ng0
2016-08-26 4:50 ` Alex Kost
0 siblings, 1 reply; 16+ messages in thread
From: ng0 @ 2016-08-25 9:55 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
Hi,
thanks for finding the errors. I applied your suggestions but the
service still goes into respawn loop when the VM boots. Do you have any
idea why this could happen?
Alex Kost <alezost@gmail.com> writes:
> ng0 (2016-08-11 18:55 +0300) wrote:
>
>> ng0 <ng0@we.make.ritual.n0.is> writes:
>>
>>> As I wrote yesterday in freenode, disregard this patch. I
>>> succeeded and currently am debugging the VM.
>>
>> I had it working at some point, but only to find out that I am passing
>> something wrong in the service.
>> Can someone take a look at this service and help me out?
>
> Hi, I didn't try this service, but I see 2 mistakes in the code.
>
> [...]
>> +(define (git-shepherd-service config)
>> + "Return a <shepherd-service> for git with CONFIG."
>> + (define git (git-configuration-git config))
>> +
>> + (define git-command
>> + #~(list
>> + (string-append #$git "/bin/git") "daemon" "--syslog"
>> + "--informative-errors"
>> + "--port=" (number->string (git-configuration-port config))
>> + "--base-path=" (git-configuration-base-path config)))
>
> 1. This should be:
>
> "--port=" #$(number->string (git-configuration-port config))
> "--base-path=" #$(git-configuration-base-path config)))
>
> Note ‘#$’ before expressions. Without it, these expressions will stay
> the same in the final making service code (see below).
>
>> + (define requires
>> + '(networking syslogd))
>> +
>> + (list (shepherd-service
>> + (documentation "Git daemon server for git repositories")
>> + (requirement requires)
>> + (provision '(git))
>> + (start #~(make-forkexec-constructor #$@git-command))
>
> 2. This should be:
>
> (start #~(make-forkexec-constructor #$git-command))
>
> Note ‘#$@ → #$’. With #$@, the list (I mean git-command) is "spliced",
> so the result in "/gnu/store/...-shepherd-git.scm" will be:
>
> (make <service>
> ...
> #:start
> (make-forkexec-constructor list
> (string-append "/gnu/store/…" "/bin/git")
> "daemon" "--syslog" "--informative-errors"
> "--port=" (number->string
> (git-configuration-port config))
> "--base-path="
> (git-configuration-base-path config))
> ...)
>
> While it should be: (make-forkexec-constructor (list ...))
>
> Also I have a question about the final command to start git daemon. It
> would look like this:
>
> git daemon --syslog --informative-errors --port=9418 --base-path=/var/git/repositories
>
> Is it intentional? I mean "/var/git/repositories" does not exist and
> you don't create it at activation time, so the service (with the default
> 'base-path') will fail anyway.
>
> But you create "/var/run/git-daemon". Is it really needed? I know
> nothing about "git daemon", but IIUC it starts successfully without this
> directory.
>
> --
> Alex
--
ng0
For non-prism friendly talk find me on http://www.psyced.org
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service [v2]
2016-08-25 9:55 ` ng0
@ 2016-08-26 4:50 ` Alex Kost
2016-08-27 15:39 ` ng0
0 siblings, 1 reply; 16+ messages in thread
From: Alex Kost @ 2016-08-26 4:50 UTC (permalink / raw)
To: ng0; +Cc: guix-devel
ng0 (2016-08-25 12:55 +0300) wrote:
> Hi,
>
> thanks for finding the errors. I applied your suggestions but the
> service still goes into respawn loop when the VM boots. Do you have any
> idea why this could happen?
Is there any output in syslog? How does you patch look now? What is
the exact "git daemon" command that is executing? You can find this
command by looking at "/gnu/store/…-shepherd-git.scm" file: when you
built the system, guix told you that it would build this file. If you
missed it, you can still find it by looking at
"/run/current-system/boot", there is a reference to
"/gnu/store/…-shepherd.conf", and there you can find a link to
"…-shepherd-git.scm" file.
--
Alex
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service [v2]
2016-08-26 4:50 ` Alex Kost
@ 2016-08-27 15:39 ` ng0
2016-08-27 20:09 ` Alex Kost
0 siblings, 1 reply; 16+ messages in thread
From: ng0 @ 2016-08-27 15:39 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 570 bytes --]
Alex Kost <alezost@gmail.com> writes:
> ng0 (2016-08-25 12:55 +0300) wrote:
>
>> Hi,
>>
>> thanks for finding the errors. I applied your suggestions but the
>> service still goes into respawn loop when the VM boots. Do you have any
>> idea why this could happen?
>
> Is there any output in syslog?
Difficult to capture when it is running in a VM.
> How does you patch look now?
Patch is attached. The mkdir-p for the default location could be more
flexible, but first I want to have a service which does not respawn
so many times at boot that shepherd disables it.
[-- Attachment #2: 0001-gnu-services-Add-git-service.patch --]
[-- Type: text/x-patch, Size: 5195 bytes --]
From accd6f983ea01743398ed2f2d6db9eaf8bb75855 Mon Sep 17 00:00:00 2001
From: ng0 <ng0@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.
---
gnu/local.mk | 1 +
gnu/services/version-control.scm | 122 +++++++++++++++++++++++++++++++++++++++
2 files changed, 123 insertions(+)
create mode 100644 gnu/services/version-control.scm
diff --git a/gnu/local.mk b/gnu/local.mk
index b8c5378..67989ed 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -390,6 +390,7 @@ GNU_SYSTEM_MODULES = \
%D%/services/herd.scm \
%D%/services/spice.scm \
%D%/services/ssh.scm \
+ %D%/services/version-control.scm \
%D%/services/web.scm \
%D%/services/xorg.scm \
\
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm
new file mode 100644
index 0000000..f5dfee4
--- /dev/null
+++ b/gnu/services/version-control.scm
@@ -0,0 +1,122 @@
+;;; 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)
+ #:use-module (srfi srfi-1)
+ ;; check for redundancy / necessity:
+ ;; #:use-module (srfi srfi-9)
+ ;; #:use-module (srfi srfi-26)
+ ;; #:use-module (srfi srfi-34)
+ #:use-module (ice-9 match)
+ #:export (git-service
+ git-service-type
+ git-configuration
+ git-configuration?
+ git-configuration-git
+ git-configuration-port
+ git-configuration-base-path))
+
+;;; Commentary:
+;;;
+;;; Version Control related services.
+;;;
+;;; Code:
+
+\f
+;;;
+;;; git
+;;;
+
+(define-record-type* <git-configuration> git-configuration
+ make-git-configuration
+ git-configuration?
+ (git git-configuration-git ;package
+ (default git))
+ (base-path git-configuration-base-path) ;string
+ (port git-configuration-port)) ;number
+
+(define (git-shepherd-service config)
+ "Return a <shepherd-service> for git with CONFIG."
+ (define git (git-configuration-git config))
+
+ (define git-command
+ #~(list
+ (string-append #$git "/bin/git") "daemon" "--syslog"
+ "--informative-errors"
+ "--port=" #$(number->string (git-configuration-port config))
+ "--base-path=" #$(git-configuration-base-path config)))
+
+ (define requires
+ '(networking syslogd))
+
+ (list (shepherd-service
+ (documentation "Git daemon server for git repositories")
+ (requirement requires)
+ (provision '(git))
+ (start #~(make-forkexec-constructor #$git-command))
+ (stop #~(make-kill-destructor)))))
+
+(define %git-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/git")
+ (shell #~(string-append #$shadow "/bin/git-shell")))))
+
+(define (git-activation config)
+ "Return the activation gexp for CONFIG."
+ #~(begin (use-modules (guix build utils))
+ ;; Create the default base-path
+ (mkdir-p "/var/git/repositories")))
+
+(define git-service-type
+ (service-type (name 'git)
+ (extensions
+ (list (service-extension shepherd-root-service-type
+ git-shepherd-service)
+ (service-extension activation-service-type
+ git-activation)))))
+
+(define* (git-service #:key
+ (git git)
+ (base-path "/var/git/repositories")
+ (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-service-type
+ (git-configuration
+ (git git)
+ (base-path base-path)
+ (port port))))
--
2.9.3
[-- Attachment #3: Type: text/plain, Size: 39 bytes --]
The updated testvm is also attached.
[-- Attachment #4: testvm.scm --]
[-- Type: application/octet-stream, Size: 1658 bytes --]
;; bare bones, no X11 server.
(use-modules (gnu) (gnu system nss))
(use-service-modules networking ssh version-control dbus avahi)
(use-package-modules certs suckless admin xorg)
(use-package-modules tor emacs version-control avahi ssh)
(operating-system
(host-name "testvm")
(timezone "UTC")
(locale "en_US.UTF-8")
(bootloader (grub-configuration (device "/dev/sda")))
(file-systems
(list (file-system
(mount-point "/")
(device "dummy")
(type "dummy"))
%binary-format-file-system))
(users (list (user-account
(name "bobthecrashtestdummy")
(comment "")
(group "users")
(supplementary-groups '("wheel" "netdev"
"audio" "video"))
(home-directory "/home/bobthecrashtestdummy")
(password ""))))
(services (cons* ;;(slim-service #:auto-login? #t
;; #:default-user "bobthecrashtestdummy")
(console-keymap-service "de")
(static-networking-service "eth0" "10.0.2.10"
#:name-servers '("10.0.2.3")
#:gateway "10.0.2.2")
;;(avahi-service)
;;(dbus-service (list avahi))
(git-service)
;;(lsh-service)
%base-services))
(pam-services
(base-pam-services #:allow-empty-passwords? #t))
(packages (cons* git st sudo
avahi findutils grep which xmodmap
tcpdump %base-packages)))
[-- Attachment #5: Type: text/plain, Size: 1561 bytes --]
> What is
> the exact "git daemon" command that is executing? You can find this
> command by looking at "/gnu/store/…-shepherd-git.scm" file: when you
> built the system, guix told you that it would build this file. If you
> missed it, you can still find it by looking at
> "/run/current-system/boot", there is a reference to
> "/gnu/store/…-shepherd.conf", and there you can find a link to
> "…-shepherd-git.scm" file.
(eval-when (expand load eval) (set! %load-path (cons "/gnu/store/8s6z5k9nfp3fyfj39vq6js8sfhxkn0y6-module-import" %load-path))
(set! %load-compiled-path (cons "/gnu/store/lc0bj2nlmdgyqkkpd008hcnrpl068yr8-module-import-compiled"
%load-compiled-path)))(begin (use-modules (shepherd service) (oop goops)
(guix build utils) (guix build syscalls)) (make <service> #:docstring
(quote "Git daemon server for git repositories") #:provides (quote
(git)) #:requires (quote (networking syslogd)) #:respawn? (quote #t)
#:start (make-forkexec-constructor (list (string-append "/gnu/store/f6b2a4ic4lzjv48s1w0kn6m5mxkj0qs4-git-2.9.3" "/bin/git")
"daemon" "--syslog" "--informative-errors" "--port=" "9418" "--base-path=" "/var/git/repositories")) #:stop (make-kill-destructor)))
^______^ ^_____________^
those two should be
combined, same for the
two afterwards?
> --
> Alex
--
ng0
For non-prism friendly talk find me on http://www.psyced.org
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service [v2]
2016-08-27 15:39 ` ng0
@ 2016-08-27 20:09 ` Alex Kost
2016-08-27 20:44 ` ng0
0 siblings, 1 reply; 16+ messages in thread
From: Alex Kost @ 2016-08-27 20:09 UTC (permalink / raw)
To: ng0; +Cc: guix-devel
ng0 (2016-08-27 18:39 +0300) wrote:
[...]
> (eval-when (expand load eval) (set! %load-path (cons "/gnu/store/8s6z5k9nfp3fyfj39vq6js8sfhxkn0y6-module-import" %load-path))
> (set! %load-compiled-path (cons "/gnu/store/lc0bj2nlmdgyqkkpd008hcnrpl068yr8-module-import-compiled"
> %load-compiled-path)))(begin (use-modules (shepherd service) (oop goops)
> (guix build utils) (guix build syscalls)) (make <service> #:docstring
> (quote "Git daemon server for git repositories") #:provides (quote
> (git)) #:requires (quote (networking syslogd)) #:respawn? (quote #t)
> #:start (make-forkexec-constructor (list (string-append "/gnu/store/f6b2a4ic4lzjv48s1w0kn6m5mxkj0qs4-git-2.9.3" "/bin/git")
> "daemon" "--syslog" "--informative-errors" "--port=" "9418" "--base-path=" "/var/git/repositories")) #:stop (make-kill-destructor)))
> ^______^ ^_____________^
> those two should be
> combined, same for the
> two afterwards?
Indeed! See how useful it is to look at the result .scm file :-)
You can be assured that the above thing doesn't work by running
something like this in a guile REPL:
(system* "git" "daemon" "--port=" "9418" "--base-path=/tmp/git-daemon-dir")
while this works (assuming that "/tmp/git-daemon-dir" exists):
(system* "git" "daemon" "--port=9418" "--base-path=/tmp/git-daemon-dir")
So you need to 'string-append' the port and base-path as you did for the
git command.
(I didn't try the service, so I don't know if there are other problems,
but you are getting closer, keep going!)
--
Alex
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service [v2]
2016-08-27 20:09 ` Alex Kost
@ 2016-08-27 20:44 ` ng0
2016-08-28 0:04 ` ng0
0 siblings, 1 reply; 16+ messages in thread
From: ng0 @ 2016-08-27 20:44 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
Alex Kost <alezost@gmail.com> writes:
> ng0 (2016-08-27 18:39 +0300) wrote:
>
> [...]
>> (eval-when (expand load eval) (set! %load-path (cons "/gnu/store/8s6z5k9nfp3fyfj39vq6js8sfhxkn0y6-module-import" %load-path))
>> (set! %load-compiled-path (cons "/gnu/store/lc0bj2nlmdgyqkkpd008hcnrpl068yr8-module-import-compiled"
>> %load-compiled-path)))(begin (use-modules (shepherd service) (oop goops)
>> (guix build utils) (guix build syscalls)) (make <service> #:docstring
>> (quote "Git daemon server for git repositories") #:provides (quote
>> (git)) #:requires (quote (networking syslogd)) #:respawn? (quote #t)
>> #:start (make-forkexec-constructor (list (string-append "/gnu/store/f6b2a4ic4lzjv48s1w0kn6m5mxkj0qs4-git-2.9.3" "/bin/git")
>> "daemon" "--syslog" "--informative-errors" "--port=" "9418" "--base-path=" "/var/git/repositories")) #:stop (make-kill-destructor)))
>> ^______^ ^_____________^
>> those two should be
>> combined, same for the
>> two afterwards?
>
> Indeed! See how useful it is to look at the result .scm file :-)
>
> You can be assured that the above thing doesn't work by running
> something like this in a guile REPL:
>
> (system* "git" "daemon" "--port=" "9418" "--base-path=/tmp/git-daemon-dir")
>
> while this works (assuming that "/tmp/git-daemon-dir" exists):
>
> (system* "git" "daemon" "--port=9418" "--base-path=/tmp/git-daemon-dir")
>
> So you need to 'string-append' the port and base-path as you did for the
> git command.
>
> (I didn't try the service, so I don't know if there are other problems,
> but you are getting closer, keep going!)
>
> --
> Alex
Wooo :) Thanks, this works. Now I just need to configure the testvm.scm
in a way that I create a simple repository and clone it from the host
and send changes to it.
--
ng0
For non-prism friendly talk find me on http://www.psyced.org
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: pre-release [PATCH] git-service [v2]
2016-08-27 20:44 ` ng0
@ 2016-08-28 0:04 ` ng0
0 siblings, 0 replies; 16+ messages in thread
From: ng0 @ 2016-08-28 0:04 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
ng0 <ng0@we.make.ritual.n0.is> writes:
> Alex Kost <alezost@gmail.com> writes:
>
>> ng0 (2016-08-27 18:39 +0300) wrote:
>>
>> [...]
>>> (eval-when (expand load eval) (set! %load-path (cons "/gnu/store/8s6z5k9nfp3fyfj39vq6js8sfhxkn0y6-module-import" %load-path))
>>> (set! %load-compiled-path (cons "/gnu/store/lc0bj2nlmdgyqkkpd008hcnrpl068yr8-module-import-compiled"
>>> %load-compiled-path)))(begin (use-modules (shepherd service) (oop goops)
>>> (guix build utils) (guix build syscalls)) (make <service> #:docstring
>>> (quote "Git daemon server for git repositories") #:provides (quote
>>> (git)) #:requires (quote (networking syslogd)) #:respawn? (quote #t)
>>> #:start (make-forkexec-constructor (list (string-append "/gnu/store/f6b2a4ic4lzjv48s1w0kn6m5mxkj0qs4-git-2.9.3" "/bin/git")
>>> "daemon" "--syslog" "--informative-errors" "--port=" "9418" "--base-path=" "/var/git/repositories")) #:stop (make-kill-destructor)))
>>> ^______^ ^_____________^
>>> those two should be
>>> combined, same for the
>>> two afterwards?
>>
>> Indeed! See how useful it is to look at the result .scm file :-)
>>
>> You can be assured that the above thing doesn't work by running
>> something like this in a guile REPL:
>>
>> (system* "git" "daemon" "--port=" "9418" "--base-path=/tmp/git-daemon-dir")
>>
>> while this works (assuming that "/tmp/git-daemon-dir" exists):
>>
>> (system* "git" "daemon" "--port=9418" "--base-path=/tmp/git-daemon-dir")
>>
>> So you need to 'string-append' the port and base-path as you did for the
>> git command.
>>
>> (I didn't try the service, so I don't know if there are other problems,
>> but you are getting closer, keep going!)
>>
>> --
>> Alex
>
> Wooo :) Thanks, this works. Now I just need to configure the testvm.scm
> in a way that I create a simple repository and clone it from the host
> and send changes to it.
Okay, it works, but for the full functionality test I want to do a git
pull+push from / to the VM. This is something I can not achieve at the
moment, even with changes applied in the gnu/services/vm.scm:
-redir tcp:2222::22 \ didn't work, and
the newer method, adding something after "-net user," didn't work
either.
Where in this case "did not work" means I am unable to
ssh 127.0.0.1:2222 or ssh localhost:2222 or whatever.. I use the same to
connect from NixOS to Gentoo, so I don't understand why Guix would
fail. isolation is good, but I need to test the git service.
In my opinion this should be a switch option,
--with-forward-ports 2222:22
or similar.
--
ng0
For non-prism friendly talk find me on http://www.psyced.org
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2016-08-28 0:04 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-08 15:53 pre-release [PATCH] git-service ng0
2016-07-08 18:24 ` Thompson, David
2016-07-08 20:41 ` Ricardo Wurmus
2016-07-09 1:08 ` ng0
2016-07-13 10:23 ` ng0
2016-07-13 16:37 ` pre-release [PATCH] git-service [v2] ng0
2016-07-14 9:07 ` ng0
2016-08-11 15:55 ` ng0
2016-08-19 9:02 ` ng0
2016-08-22 8:03 ` Alex Kost
2016-08-25 9:55 ` ng0
2016-08-26 4:50 ` Alex Kost
2016-08-27 15:39 ` ng0
2016-08-27 20:09 ` Alex Kost
2016-08-27 20:44 ` ng0
2016-08-28 0:04 ` ng0
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).