From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QPUWJw1S7mMKbAEAbAwnHQ (envelope-from ) for ; Thu, 16 Feb 2023 16:55:57 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id iM3xJg1S7mOwkgAAauVa8A (envelope-from ) for ; Thu, 16 Feb 2023 16:55:57 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 502C93A6BD for ; Thu, 16 Feb 2023 16:55:57 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSgbA-0001bt-Ie; Thu, 16 Feb 2023 10:55:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSgb8-0001aj-HI for guix-patches@gnu.org; Thu, 16 Feb 2023 10:55:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSgb8-000227-6w for guix-patches@gnu.org; Thu, 16 Feb 2023 10:55:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pSgb8-0007qz-01 for guix-patches@gnu.org; Thu, 16 Feb 2023 10:55:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61483] [PATCH v2 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type. References: <20230213164642.24419-1-janneke@gnu.org> In-Reply-To: <20230213164642.24419-1-janneke@gnu.org> Resent-From: "Jan (janneke) Nieuwenhuizen" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 16 Feb 2023 15:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61483 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 61483@debbugs.gnu.org Received: via spool by 61483-submit@debbugs.gnu.org id=B61483.167656285030100 (code B ref 61483); Thu, 16 Feb 2023 15:55:01 +0000 Received: (at 61483) by debbugs.gnu.org; 16 Feb 2023 15:54:10 +0000 Received: from localhost ([127.0.0.1]:37438 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSgaH-0007pP-OR for submit@debbugs.gnu.org; Thu, 16 Feb 2023 10:54:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSgaC-0007oR-Lw for 61483@debbugs.gnu.org; Thu, 16 Feb 2023 10:54:08 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSga6-0001p2-NS; Thu, 16 Feb 2023 10:53:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=pa+fxN2A/m3+RqloYeCX7v3Qw/e+gOXV+Vz535mw9+I=; b=gdfQyDUZ4hM8sT zx3AGey6q3si1hZcbfoXoy5cnbpNtc1gz9XkH9U9CZDp3w88XAsacMhLfnXRJw3GQXoo8Hvkmfbdx +09LG1KSbVcgyBxLWpVJ2Now6roo0vfjOXpMjR13cDuY9Cnb3CoYgrtOTFpQwA81Q0FoWvWf9qTiT J1p4E1n2ppCX0S4t3lnqu5/ooQQBo93Sv+zTH6p+K4j8H3s4zrI6mAwpEaDo80gE/LaQuTH8CdsVa fVcrCl7H9n+1cMeqxxDEBECQGGWf8qHCP7fpx/NNcFYU0gHbE/B1m51DquEmzjQ4wMaZkkBGvy0Wf rBNiGvDtpPWhW+fABbLA==; Received: from 2a02-a462-da03-1-2701-7f81-a736-4607.fixed6.kpn.net ([2a02:a462:da03:1:2701:7f81:a736:4607] helo=drakenpad.fritz.box) by fencepost.gnu.org with esmtpa (Exim 4.90_1) (envelope-from ) id 1pSga6-0005sK-AV; Thu, 16 Feb 2023 10:53:58 -0500 From: "Jan (janneke) Nieuwenhuizen" Date: Thu, 16 Feb 2023 16:53:51 +0100 Message-Id: <20230216155355.11106-1-janneke@gnu.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1676562957; a=rsa-sha256; cv=none; b=U2PfQaup+Df6GygVsR5Fbyzf/CSbYFinUoaD3raQ97/ukwiIkpfYmvoL2MW88jiYD5h+od TneeNGZAOkZ0yGV6Kbeja+d/5luEBc1TmqRtF9YlqQ8SM0Mla66B1+Oqwv1YiPAyZvwgIO MLr++tVmVOxZFNTfSq4vFiJ9W1SGFeQkIQ4Ubt8STlHmnMfXNYAmPnIHaashZSrDtZ1wwr 70UYaEWofQJ3EnS1TAn0Tyc7S+Tc4sBanDYlF17iBS5Bc+mlD8GVDLOvn437GtsgKNg5wF 7JKM6PUENaXAIfVeS2Qofk3s5N0WsBqLvCSPKa0pbdFUTP26YoCRfSfKAr2ZeQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gnu.org header.s=fencepost-gnu-org header.b=gdfQyDUZ; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676562957; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=sMLGfRAjiH9JG74TkSwzM4b92t7mRSFKC4Qtnz8nzB4=; b=JY5Iihk9GBrKUrRFolE2JuFQD+gEhIW3PL/y9EtKww6hrvx7S5T+i1hXNW+elC02w5ky9A u1D7Lh6I5d0CXyTf9NmBiCLgY0lQMfWZy/HmAYTFC2dicDHl0lSEs7uHhN43X3IZvXo6al nb0fVkJrDMTvO3POR2AvdNO2dtbhr3aQPVhOqUCgoCtJPU7hIfqrHRHD9wkSZMpR9I0229 2hojtvDK/AB92vwxX6xAw5nF87P/hKcXVMMZAt/fT93H1NQxjffV7GOWErVU0rEzqvXV3f G9IwZIs2xE34CzyyfKUlZm1jbsN0F48Q6nnqX8b4t0sk9Yp8JuJO/6wtjYQJkw== Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gnu.org header.s=fencepost-gnu-org header.b=gdfQyDUZ; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org X-Migadu-Spam-Score: -1.52 X-Spam-Score: -1.52 X-Migadu-Queue-Id: 502C93A6BD X-Migadu-Scanner: scn1.migadu.com X-TUID: /CBjGTBw3kpw * 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 +;;; +;;; 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 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")))) + + +;;; +;;; Git daemon. +;;; +(define-record-type* + 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 for a git daemon with CONFIG." + (match config + (($ + 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 # Copyright © 2016, 2017, 2018, 2019 Alex Vong # Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Efraim Flashner -# Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Jan (janneke) Nieuwenhuizen +# Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Jan (janneke) Nieuwenhuizen # Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice # Copyright © 2017, 2018 Clément Lassieur # Copyright © 2017, 2020 Mathieu Othacehe @@ -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