From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QMvWHdNq6mPvLAEAbAwnHQ (envelope-from ) for ; Mon, 13 Feb 2023 17:52:35 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id SEi7HdNq6mNAMgEA9RJhRA (envelope-from ) for ; Mon, 13 Feb 2023 17:52:35 +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 B4459976F for ; Mon, 13 Feb 2023 17:52:34 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gnu.org header.s=fencepost-gnu-org header.b=K30NGSLV; 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=1676307155; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=qAWABjgod1BijKXhIhPyetCYdNU+pH0gLGO+FTT79go=; b=oksZGRyjcetigy+erOLyiOLm3g9blBY52vH58tL9BprSiydIiZSXi0ZcVdpc4ZffuJ58nO X/KTr+BsRJNsdJRFQ4e0T4C8O/fMx13n9k/NVI2Aa/XKjW0o2ekVKjnU25og3iSBZ/x0/Y Tqf/oVmEeeZOeErefY9FyMoUqzqtRVVpW6VDD9wHkK6hikCJiYlw88vvSVcuAeOyoUVSOU hvQzhmtOf/DWjYXs6WFG4chIuFige6T6NvkywU9IkgSdrPrbZFn6yFkGgJC214C8huRJOx fhk2VqnaOzaZJytqd8NA9+vyQvMXbilnXmEzKmydnZMfdW1htK3n0hUvau+Mpw== 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=K30NGSLV; 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-Seal: i=1; s=key1; d=yhetil.org; t=1676307155; a=rsa-sha256; cv=none; b=ATBcDHZ3jxvRsevH4lIMp5ZM8MnHHOS/p3ry4X1qhyp509xsLz1cmDPqjdtHfWY+/fs1au GfAOdUGHAgA0sPBz+wdeNrH0BatpempKKcQTAa4tYLYhKP25qoWFLvV/T7Jp6RToL0bf1T TFiHgghrwi5o+k77dtCI9YeDUwonzqqen/K7oYxSJ/xuyLj234PJuhsu0qGMFka8YdScAH zlCxjBmR1Nk8UXQViYv5x7p6vDeX4MOPykT+ErZG/ia/ROU4j7e3+sdtnujir041zk7wOF 0j373QxhG7TtY1Dt3v+iety+Ts1/rxG36CEIXOIdvY1DIBxyewBYehfUIhyUeQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRc3m-00089U-QM; Mon, 13 Feb 2023 11:52:10 -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 1pRc3f-00088P-A7 for guix-patches@gnu.org; Mon, 13 Feb 2023 11:52:04 -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 1pRc3f-0005aE-19 for guix-patches@gnu.org; Mon, 13 Feb 2023 11:52:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pRc3e-0003yF-TY for guix-patches@gnu.org; Mon, 13 Feb 2023 11:52:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61483] [PATCH 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: Janneke Nieuwenhuizen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Feb 2023 16:52:02 +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 Cc: Janneke Nieuwenhuizen Received: via spool by 61483-submit@debbugs.gnu.org id=B61483.167630708115185 (code B ref 61483); Mon, 13 Feb 2023 16:52:02 +0000 Received: (at 61483) by debbugs.gnu.org; 13 Feb 2023 16:51:21 +0000 Received: from localhost ([127.0.0.1]:51351 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRc2y-0003wq-Sp for submit@debbugs.gnu.org; Mon, 13 Feb 2023 11:51:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRc2q-0003vp-Ur for 61483@debbugs.gnu.org; Mon, 13 Feb 2023 11:51:14 -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 1pRc2g-0005Qh-2q; Mon, 13 Feb 2023 11:51:07 -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=iJrJYukBnWlmeukqA5fgG6brrx7rkiP+xZuIByqCa/4=; b=K30NGSLVstX3Xa Nep3bWtL2BaJx3I/IScRDqMLJw2UOLmVoDDz2aXml6hPhP0ckNGGMAJ6Km2YApOl6QO2Uve1jAS1e zXppdTU2gwyUViXr5hugsommk/ssgG8B7ezT/BHXAwgkpTHB92d+9SI5iJJp90mnDKsXq5ZTXLosr XdkuD5vr91yhu6qaNHaleSog+aiREPtDRLCSwIc8zSNRLl+CeLqECYgz42iCxGy4PRwa3OfX6a7Zj aKu7L6g9eRQ2u6zGq3CUC46uaXjgm6/43WzQ/fnZLSKZpAM1rGuOPGVTgWnEGGG3Vyd53akkzsXFG 7D4/c2gCyQz9+8i5cUQg==; 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 1pRc2e-0001Mq-Fl; Mon, 13 Feb 2023 11:51:01 -0500 From: Janneke Nieuwenhuizen Date: Mon, 13 Feb 2023 17:50:53 +0100 Message-Id: <20230213165057.24518-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: X-Migadu-Queue-Id: B4459976F X-Spam-Score: -3.92 X-Migadu-Spam-Score: -3.92 X-Migadu-Scanner: scn0.migadu.com 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 X-TUID: aHM9Q4jDCSpz From: "Janneke Nieuwenhuizen" * gnu/home/services/shepherd-xyz.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. --- gnu/home/services/shepherd-xyz.scm | 102 +++++++++++++++++++++++++++++ gnu/local.mk | 3 +- 2 files changed, 104 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..1bf857b591 --- /dev/null +++ b/gnu/home/services/shepherd-xyz.scm @@ -0,0 +1,102 @@ +;;; 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 (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/share")) + "/shepherd")) + + +;;; +;;; Git daemon. +;;; +(define-record-type* + home-git-daemon-configuration make-home-git-daemon-configuration + home-git-daemon-configuration? + (git home-git-daemon-git ;string + (default #~(string-append #$git "/bin/git"))) + (root home-git-daemon-root ;string + (default (string-append %user-data-home "/git-daemon"))) + (log-dir home-git-daemon-log-dir ;string + (default %user-log-dir))) + +(define (home-git-daemon-services config) + "Return a for a git daemon with CONFIG." + (match config + (($ git root log-dir) + (list (shepherd-service + (documentation "Run the git daemon.") + (provision '(git-daemon)) + (start #~(lambda _ + (unless (file-exists? #$log-dir) + (mkdir-p #$log-dir)) + (fork+exec-command + (list #$git + "daemon" + (string-append "--base-path=" #$root) + "--export-all") + #:log-file (string-append #$log-dir "/git-daemon.log")))) + (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