From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
To: 61483@debbugs.gnu.org
Subject: [bug#61483] [PATCH v2 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type.
Date: Thu, 16 Feb 2023 16:53:51 +0100 [thread overview]
Message-ID: <20230216155355.11106-1-janneke@gnu.org> (raw)
In-Reply-To: <20230213164642.24419-1-janneke@gnu.org>
* gnu/home/services/shepherd-xyz.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
gnu/home/services/shepherd-xyz.scm | 122 +++++++++++++++++++++++++++++
gnu/local.mk | 3 +-
2 files changed, 124 insertions(+), 1 deletion(-)
create mode 100644 gnu/home/services/shepherd-xyz.scm
diff --git a/gnu/home/services/shepherd-xyz.scm b/gnu/home/services/shepherd-xyz.scm
new file mode 100644
index 0000000000..4d84008dae
--- /dev/null
+++ b/gnu/home/services/shepherd-xyz.scm
@@ -0,0 +1,122 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
+;;;
+;;; 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 home services shepherd-xyz)
+ #:use-module (srfi srfi-26)
+
+ #:use-module (ice-9 match)
+
+ #:use-module (shepherd support)
+
+ #:use-module (gnu home services)
+ #:use-module (gnu home services shepherd)
+ #:use-module (gnu packages version-control)
+ #:use-module (gnu services configuration)
+ #:use-module (gnu services shepherd)
+ #:use-module (guix records)
+ #:use-module (guix gexp)
+
+ #:export (home-git-daemon-configuration
+ home-git-daemon-service-type))
+
+;;; Commentary:
+;;
+;; Home Services for the Shepherd.
+;;
+;; Example configurations.
+;;
+;; Git daemon: use $HOME/src as the base directory.
+;;
+;; (service home-git-service-type
+;; (home-git-configuration
+;; (root (string-append (getenv "HOME") "/src"))))
+;;
+;;; Code:
+
+;;;
+;;; Directories.
+;;;
+(define %user-data-home
+ ;; Default cache directory if shepherd is run as a normal user.
+ (string-append (or (getenv "XDG_DATA_HOME")
+ (string-append user-homedir "/.local/share"))))
+
+(define %user-log-dir
+ ;; Default log directory if shepherd is run as a normal user.
+ (string-append (or (getenv "XDG_DATA_HOME")
+ (string-append user-homedir "/.local/var/log"))))
+
+\f
+;;;
+;;; Git daemon.
+;;;
+(define-record-type* <home-git-daemon-configuration>
+ home-git-daemon-configuration make-home-git-daemon-configuration
+ home-git-daemon-configuration?
+ (git home-git-daemon-git ;file-like
+ (default git))
+ (root home-git-daemon-root ;string
+ (default (string-append %user-data-home
+ "/git-daemon")))
+ (export-all? home-git-daemon-export-all? ;boolean
+ (default #f))
+ (listen home-git-daemon-configuration-listen ;list of string
+ (default '()))
+ (port home-git-daemon-configuration-port ;number | #f
+ (default #f))
+ (whitelist home-git-daemon-configuration-whitelist ;list of string
+ (default '()))
+ (extra-options home-git-daemon-extra-options ;list of string
+ (default '())))
+
+(define (home-git-daemon-services config)
+ "Return a <shepherd-service> for a git daemon with CONFIG."
+ (match config
+ (($ <home-git-daemon-configuration>
+ git root export-all? listen port whitelist extra-options)
+ (let* ((git (file-append git "/bin/git"))
+ (command `(,git
+ "daemon"
+ ,(string-append "--base-path=" root)
+ ,@(if export-all?
+ '("--export-all")
+ '())
+ ,@(map (cute string-append "--listen=" <>) listen)
+ ,@(if port
+ `(,(string-append
+ "--port=" (number->string port)))
+ '())
+ ,@extra-options
+ ,@whitelist))
+ (log-file (string-append %user-log-dir "/git-daemon.log")))
+ (list (shepherd-service
+ (documentation "Run the git daemon.")
+ (provision '(git-daemon))
+ (start #~(make-forkexec-constructor '#$command
+ #:log-file #$log-file))
+ (stop #~(make-kill-destructor))))))))
+
+(define home-git-daemon-service-type
+ (service-type
+ (name 'home-git-daemon)
+ (default-value (home-git-daemon-configuration))
+ (extensions
+ (list (service-extension home-shepherd-service-type
+ home-git-daemon-services)))
+ (description
+ "Install and configure the git-daemon as a shepherd service.")))
diff --git a/gnu/local.mk b/gnu/local.mk
index 7278c50e4f..134b81f24f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -11,7 +11,7 @@
# Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
# Copyright © 2016, 2017, 2018, 2019 Alex Vong <alexvong1995@gmail.com>
# Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
-# Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+# Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
# Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
# Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
@@ -94,6 +94,7 @@ GNU_SYSTEM_MODULES = \
%D%/home/services/pm.scm \
%D%/home/services/shells.scm \
%D%/home/services/shepherd.scm \
+ %D%/home/services/shepherd-xyz.scm \
%D%/home/services/ssh.scm \
%D%/home/services/mcron.scm \
%D%/home/services/utils.scm \
--
2.38.1
next prev parent reply other threads:[~2023-02-16 15:55 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 16:46 [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Jan (janneke) Nieuwenhuizen
2023-02-13 16:50 ` [bug#61483] [PATCH 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type Janneke Nieuwenhuizen
2023-02-13 16:50 ` [bug#61483] [PATCH 2/5] DRAFT gnu: home: services: Add home-ssh-agent-service-type Janneke Nieuwenhuizen
2023-02-13 16:50 ` [bug#61483] [PATCH 3/5] DRAFT gnu: home: services: Add home-znc-service-type Janneke Nieuwenhuizen
2023-02-13 16:50 ` [bug#61483] [PATCH 4/5] DRAFT gnu: home: services: Add home-kodi-service-type Janneke Nieuwenhuizen
2023-02-13 16:50 ` [bug#61483] [PATCH 5/5] DRAFT doc: Document Home Shepherd Services Janneke Nieuwenhuizen
2023-02-14 13:45 ` [bug#61483] [PATCH 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type Bruno Victal
2023-02-14 15:17 ` [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Jan Nieuwenhuizen
2023-02-14 15:14 ` Janneke Nieuwenhuizen
2023-02-16 15:53 ` Jan (janneke) Nieuwenhuizen [this message]
2023-02-16 15:53 ` [bug#61483] [PATCH v2 2/5] DRAFT gnu: home: services: Add home-ssh-agent-service-type Jan (janneke) Nieuwenhuizen
2023-03-04 17:08 ` [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Ludovic Courtès
2023-02-16 15:53 ` [bug#61483] [PATCH v2 3/5] DRAFT gnu: home: services: Add home-znc-service-type Jan (janneke) Nieuwenhuizen
2023-03-04 17:06 ` [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Ludovic Courtès
2023-02-16 15:53 ` [bug#61483] [PATCH v2 4/5] DRAFT gnu: home: services: Add home-kodi-service-type Jan (janneke) Nieuwenhuizen
2023-03-04 17:10 ` [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Ludovic Courtès
2023-03-05 18:11 ` Janneke Nieuwenhuizen
2023-02-16 15:53 ` [bug#61483] [PATCH v2 5/5] DRAFT doc: Document " Jan (janneke) Nieuwenhuizen
2023-03-04 17:14 ` [bug#61483] [PATCH 0/5] Some basic " Ludovic Courtès
2023-03-05 18:09 ` Janneke Nieuwenhuizen
2023-03-04 17:05 ` Ludovic Courtès
2023-03-05 17:41 ` Janneke Nieuwenhuizen
2023-03-04 17:01 ` Ludovic Courtès
2023-03-05 18:18 ` Janneke Nieuwenhuizen
2023-03-05 18:13 ` [bug#61483] [PATCH v3 1/3] gnu: home: services: Add home-ssh-agent-service-type Janneke Nieuwenhuizen
2023-03-05 18:13 ` [bug#61483] [PATCH v3 2/3] gnu: home: services: Add home-znc-service-type Janneke Nieuwenhuizen
2023-03-16 11:01 ` [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Ludovic Courtès
2023-03-16 14:06 ` Janneke Nieuwenhuizen
2023-03-05 18:13 ` [bug#61483] [PATCH v3 3/3] gnu: home: services: Add home-kodi-service-type Janneke Nieuwenhuizen
2023-03-16 11:04 ` [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Ludovic Courtès
2023-03-16 14:07 ` Jan Nieuwenhuizen
2023-03-16 15:21 ` Jannneke Nieuwenhuizen
2023-03-16 16:16 ` Ludovic Courtès
2023-03-17 11:57 ` Janneke Nieuwenhuizen
2023-03-16 11:01 ` Ludovic Courtès
2023-03-16 14:08 ` Janneke Nieuwenhuizen
2023-03-17 11:53 ` bug#61483: " Janneke Nieuwenhuizen
2023-03-17 21:07 ` [bug#61483] " 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230216155355.11106-1-janneke@gnu.org \
--to=janneke@gnu.org \
--cc=61483@debbugs.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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.