* [bug#61483] [PATCH 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type.
2023-02-13 16:46 [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Jan (janneke) Nieuwenhuizen
@ 2023-02-13 16:50 ` Janneke Nieuwenhuizen
2023-02-13 16:50 ` [bug#61483] [PATCH 2/5] DRAFT gnu: home: services: Add home-ssh-agent-service-type Janneke Nieuwenhuizen
` (4 more replies)
2023-02-14 15:14 ` Janneke Nieuwenhuizen
` (3 subsequent siblings)
4 siblings, 5 replies; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-02-13 16:50 UTC (permalink / raw)
To: 61483; +Cc: Janneke Nieuwenhuizen
From: "Janneke Nieuwenhuizen" <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 | 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 <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 (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"))
+
+\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 ;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 <shepherd-service> for a git daemon with CONFIG."
+ (match config
+ (($ <home-git-daemon-configuration> 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 <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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 2/5] DRAFT gnu: home: services: Add home-ssh-agent-service-type.
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 ` Janneke Nieuwenhuizen
2023-02-13 16:50 ` [bug#61483] [PATCH 3/5] DRAFT gnu: home: services: Add home-znc-service-type Janneke Nieuwenhuizen
` (3 subsequent siblings)
4 siblings, 0 replies; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-02-13 16:50 UTC (permalink / raw)
To: 61483; +Cc: Janneke Nieuwenhuizen
From: "Janneke Nieuwenhuizen" <janneke@gnu.org>
* gnu/home/services/shepherd-xyz.scm
(<home-ssh-agent-configuration>): New type.
(home-ssh-agent-services): New procedure.
(home-ssh-agent-service-type): New variable.
---
gnu/home/services/shepherd-xyz.scm | 58 +++++++++++++++++++++++++++++-
1 file changed, 57 insertions(+), 1 deletion(-)
diff --git a/gnu/home/services/shepherd-xyz.scm b/gnu/home/services/shepherd-xyz.scm
index 1bf857b591..38ab7d60ef 100644
--- a/gnu/home/services/shepherd-xyz.scm
+++ b/gnu/home/services/shepherd-xyz.scm
@@ -22,6 +22,7 @@ (define-module (gnu home services shepherd-xyz)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
+ #:use-module (gnu packages ssh)
#:use-module (gnu packages version-control)
#:use-module (gnu services configuration)
#:use-module (gnu services shepherd)
@@ -29,7 +30,9 @@ (define-module (gnu home services shepherd-xyz)
#:use-module (guix gexp)
#:export (home-git-daemon-configuration
- home-git-daemon-service-type))
+ home-git-daemon-service-type
+ home-ssh-agent-configuration
+ home-ssh-agent-service-type))
;;; Commentary:
;;
@@ -43,6 +46,15 @@ (define-module (gnu home services shepherd-xyz)
;; (home-git-configuration
;; (root (string-append (getenv "HOME") "/src"))))
;;
+;; Ssh-agent
+;;
+;; Add to your ~/.bash_profile:
+;;
+;; SSH_AUTH_SOCK=${XDG_RUNTIME_DIR-$HOME/.cache}/ssh-agent/socket
+;; export SSH_AUTH_SOCK
+;;
+;; (service home-ssh-agent-service-type)
+;;
;;; Code:
;;;
@@ -100,3 +112,47 @@ (define home-git-daemon-service-type
home-git-daemon-services)))
(description
"Install and configure the git-daemon as a shepherd service.")))
+
+\f
+;;;
+;;; Ssh-agent.
+;;;
+(define-record-type* <home-ssh-agent-configuration>
+ home-ssh-agent-configuration make-home-ssh-agent-configuration
+ home-ssh-agent-configuration?
+ (ssh-agent home-ssh-agent-ssh-agent ;string
+ (default #~(string-append #$openssh "/bin/ssh-agent")))
+ (socket-dir home-ssh-agent-socket-dir ;string
+ (default (string-append %user-runtime-dir "/ssh-agent")))
+ (log-dir home-ssh-agent-log-dir ;string
+ (default %user-log-dir)))
+
+(define (home-ssh-agent-services config)
+ "Return a <shepherd-service> for an ssh-agent with CONFIG."
+ (match config
+ (($ <home-ssh-agent-configuration> ssh-agent socket-dir log-dir)
+ (list (shepherd-service
+ (documentation "Run the ssh-agent.")
+ (provision '(ssh-agent))
+ (start #~(lambda _
+ (unless (file-exists? #$socket-dir)
+ (mkdir-p #$socket-dir)
+ (chmod #$socket-dir #o700))
+ (unless (file-exists? #$log-dir)
+ (mkdir-p #$log-dir))
+ (fork+exec-command
+ (list #$ssh-agent
+ "-D"
+ "-a" (string-append #$socket-dir "/socket"))
+ #:log-file (string-append #$log-dir "/ssh-agent.log"))))
+ (stop #~(make-kill-destructor)))))))
+
+(define home-ssh-agent-service-type
+ (service-type
+ (name 'home-ssh-agent)
+ (default-value (home-ssh-agent-configuration))
+ (extensions
+ (list (service-extension home-shepherd-service-type
+ home-ssh-agent-services)))
+ (description
+ "Install and configure the ssh-agent as a shepherd service.")))
--
2.38.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 3/5] DRAFT gnu: home: services: Add home-znc-service-type.
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 ` Janneke Nieuwenhuizen
2023-02-13 16:50 ` [bug#61483] [PATCH 4/5] DRAFT gnu: home: services: Add home-kodi-service-type Janneke Nieuwenhuizen
` (2 subsequent siblings)
4 siblings, 0 replies; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-02-13 16:50 UTC (permalink / raw)
To: 61483; +Cc: Janneke Nieuwenhuizen
From: "Janneke Nieuwenhuizen" <janneke@gnu.org>
* gnu/home/services/shepherd-xyz.scm
(<home-znc-configuration>): New type.
(home-znc-services): New procedure.
(home-znc-service-type): New variable.
---
gnu/home/services/shepherd-xyz.scm | 43 +++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/gnu/home/services/shepherd-xyz.scm b/gnu/home/services/shepherd-xyz.scm
index 38ab7d60ef..4f2a2435ac 100644
--- a/gnu/home/services/shepherd-xyz.scm
+++ b/gnu/home/services/shepherd-xyz.scm
@@ -22,6 +22,7 @@ (define-module (gnu home services shepherd-xyz)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
+ #:use-module (gnu packages messaging)
#:use-module (gnu packages ssh)
#:use-module (gnu packages version-control)
#:use-module (gnu services configuration)
@@ -32,7 +33,9 @@ (define-module (gnu home services shepherd-xyz)
#:export (home-git-daemon-configuration
home-git-daemon-service-type
home-ssh-agent-configuration
- home-ssh-agent-service-type))
+ home-ssh-agent-service-type
+ home-znc-configuration
+ home-znc-service-type))
;;; Commentary:
;;
@@ -156,3 +159,41 @@ (define home-ssh-agent-service-type
home-ssh-agent-services)))
(description
"Install and configure the ssh-agent as a shepherd service.")))
+
+\f
+;;;
+;;; Znc.
+;;;
+(define-record-type* <home-znc-configuration>
+ home-znc-configuration make-home-znc-configuration
+ home-znc-configuration?
+ (znc home-znc-znc ;string
+ (default #~(string-append #$znc "/bin/znc")))
+ (log-dir home-znc-log-dir ;string
+ (default %user-log-dir)))
+
+(define (home-znc-services config)
+ "Return a <shepherd-service> for znc with CONFIG."
+ (match config
+ (($ <home-znc-configuration> znc log-dir)
+ (list (shepherd-service
+ (documentation "Run the znc IRC bouncer.")
+ (provision '(znc))
+ (start #~(lambda _
+ (unless (file-exists? #$log-dir)
+ (mkdir-p #$log-dir))
+ (fork+exec-command
+ (list #$znc
+ "--foreground")
+ #:log-file (string-append #$log-dir "/znc.log"))))
+ (stop #~(make-kill-destructor)))))))
+
+(define home-znc-service-type
+ (service-type
+ (name 'home-znc)
+ (default-value (home-znc-configuration))
+ (extensions
+ (list (service-extension home-shepherd-service-type
+ home-znc-services)))
+ (description
+ "Install and configure znc as a shepherd service.")))
--
2.38.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 4/5] DRAFT gnu: home: services: Add home-kodi-service-type.
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 ` 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
4 siblings, 0 replies; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-02-13 16:50 UTC (permalink / raw)
To: 61483; +Cc: Janneke Nieuwenhuizen
From: "Janneke Nieuwenhuizen" <janneke@gnu.org>
* gnu/home/services/shepherd-xyz.scm
(<home-kodi-configuration>): New type.
(home-kodi-services): New procedure.
(home-kodi-service-type): New variable.
---
gnu/home/services/shepherd-xyz.scm | 40 ++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/gnu/home/services/shepherd-xyz.scm b/gnu/home/services/shepherd-xyz.scm
index 4f2a2435ac..8bb9aa96cd 100644
--- a/gnu/home/services/shepherd-xyz.scm
+++ b/gnu/home/services/shepherd-xyz.scm
@@ -22,6 +22,7 @@ (define-module (gnu home services shepherd-xyz)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
+ #:use-module (gnu packages kodi)
#:use-module (gnu packages messaging)
#:use-module (gnu packages ssh)
#:use-module (gnu packages version-control)
@@ -32,6 +33,8 @@ (define-module (gnu home services shepherd-xyz)
#:export (home-git-daemon-configuration
home-git-daemon-service-type
+ home-kodi-configuration
+ home-kodi-service-type
home-ssh-agent-configuration
home-ssh-agent-service-type
home-znc-configuration
@@ -116,6 +119,43 @@ (define home-git-daemon-service-type
(description
"Install and configure the git-daemon as a shepherd service.")))
+\f
+;;;
+;;; Kodi.
+;;;
+(define-record-type* <home-kodi-configuration>
+ home-kodi-configuration make-home-kodi-configuration
+ home-kodi-configuration?
+ (kodi home-kodi-kodi ;string
+ (default #~(string-append #$kodi "/bin/kodi")))
+ (log-dir home-kodi-log-dir ;string
+ (default %user-log-dir)))
+
+(define (home-kodi-services config)
+ "Return a <shepherd-service> for kodi with CONFIG."
+ (match config
+ (($ <home-kodi-configuration> kodi log-dir)
+ (list (shepherd-service
+ (documentation "Run the kodi media center.")
+ (provision '(kodi))
+ (start #~(lambda _
+ (unless (file-exists? #$log-dir)
+ (mkdir-p #$log-dir))
+ (fork+exec-command
+ (list #$kodi "-fs")
+ #:log-file (string-append #$log-dir "/kodi.log"))))
+ (stop #~(make-kill-destructor)))))))
+
+(define home-kodi-service-type
+ (service-type
+ (name 'home-kodi)
+ (default-value (home-kodi-configuration))
+ (extensions
+ (list (service-extension home-shepherd-service-type
+ home-kodi-services)))
+ (description
+ "Install and configure kodi as a shepherd service.")))
+
\f
;;;
;;; Ssh-agent.
--
2.38.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 5/5] DRAFT doc: Document Home Shepherd Services.
2023-02-13 16:50 ` [bug#61483] [PATCH 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type Janneke Nieuwenhuizen
` (2 preceding siblings ...)
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 ` Janneke Nieuwenhuizen
2023-02-14 13:45 ` [bug#61483] [PATCH 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type Bruno Victal
4 siblings, 0 replies; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-02-13 16:50 UTC (permalink / raw)
To: 61483; +Cc: Janneke Nieuwenhuizen
From: "Janneke Nieuwenhuizen" <janneke@gnu.org>
* doc/guix.texi (Shepherd Home Services): New subsubsection.
---
doc/guix.texi | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 89 insertions(+), 1 deletion(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 784114f0bb..04ce076784 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -36,7 +36,7 @@ Copyright @copyright{} 2016, 2017, 2018, 2021 Chris Marusich@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021, 2022 Efraim Flashner@*
Copyright @copyright{} 2016 John Darrington@*
Copyright @copyright{} 2016, 2017 Nikita Gillmann@*
-Copyright @copyright{} 2016, 2017, 2018, 2019, 2020 Jan Nieuwenhuizen@*
+Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2023 Jan Nieuwenhuizen@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021 Julien Lepiller@*
Copyright @copyright{} 2016 Alex ter Weele@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021 Christopher Baines@*
@@ -41285,6 +41285,94 @@ mechanism instead (@pxref{Shepherd Services}).
@end table
@end deftp
+@menu
+* Shepherd Home Services::
+@end menu
+
+@node Shepherd Home Services
+@subsubsection e Shepherd Home Services
+
+The @code{(gnu home services shepherd-xyz)} module provides serveral
+home shepherd services.
+
+@defvr {Scheme Variable} home-git-daemon-service-type
+This is the type of the @code{git daemon} home service, whose value is an
+@code{home-git-daemon-configuration} object.
+@end defvr
+
+@deftp {Data Type} home-git-daemon-configuration
+Available @code{home-git-daemon-configuration} fields are:
+
+@table @asis
+@item @code{git} (default: @code{git}) (type: file-like)
+The git package to use.
+
+@item @code{root} (default: @code{"~/git-daemon"}) (type: string)
+The git deamon's base directory.
+
+@item @code{log-dir} (default: @code{@env{XDG_CONFIG_HOME}/shepherd"}) (type: string)
+The directory to write the @file{git-daemon.log} file.
+
+@end table
+@end deftp
+
+@defvr {Scheme Variable} home-kodi-service-type
+This is the type of the @code{git daemon} home service, whose value is an
+@code{home-kodi-configuration} object.
+@end defvr
+
+@deftp {Data Type} home-kodi-configuration
+Available @code{home-kodi-configuration} fields are:
+
+@table @asis
+@item @code{git} (default: @code{git}) (type: file-like)
+The git package to use.
+
+@item @code{log-dir} (default: @code{@env{XDG_CONFIG_HOME}/shepherd"}) (type: string)
+The directory to write the @file{kodi.log} file.
+
+@end table
+@end deftp
+
+@defvr {Scheme Variable} home-ssh-agent-service-type
+This is the type of the @code{git daemon} home service, whose value is an
+@code{home-ssh-agent-configuration} object.
+@end defvr
+
+@deftp {Data Type} home-ssh-agent-configuration
+Available @code{home-ssh-agent-configuration} fields are:
+
+@table @asis
+@item @code{git} (default: @code{git}) (type: file-like)
+The git package to use.
+
+@item @code{socket-dir} (default: @code{@env{XDG_RUNTIME_DIR}/ssh-agent"}) (type: string)
+The directory to write the ssh-agent's @file{socket} file.
+
+@item @code{log-dir} (default: @code{@env{XDG_CONFIG_HOME}/shepherd"}) (type: string)
+The directory to write the @file{ssh-agent.log} file.
+
+@end table
+@end deftp
+
+@defvr {Scheme Variable} home-znc-service-type
+This is the type of the @code{git daemon} home service, whose value is an
+@code{home-znc-configuration} object.
+@end defvr
+
+@deftp {Data Type} home-znc-configuration
+Available @code{home-znc-configuration} fields are:
+
+@table @asis
+@item @code{git} (default: @code{git}) (type: file-like)
+The git package to use.
+
+@item @code{log-dir} (default: @code{@env{XDG_CONFIG_HOME}/shepherd"}) (type: string)
+The directory to write the @file{znc.log} file.
+
+@end table
+@end deftp
+
@node Secure Shell
@subsection Secure Shell
--
2.38.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type.
2023-02-13 16:50 ` [bug#61483] [PATCH 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type Janneke Nieuwenhuizen
` (3 preceding siblings ...)
2023-02-13 16:50 ` [bug#61483] [PATCH 5/5] DRAFT doc: Document Home Shepherd Services Janneke Nieuwenhuizen
@ 2023-02-14 13:45 ` Bruno Victal
2023-02-14 15:17 ` [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Jan Nieuwenhuizen
4 siblings, 1 reply; 38+ messages in thread
From: Bruno Victal @ 2023-02-14 13:45 UTC (permalink / raw)
To: Janneke Nieuwenhuizen; +Cc: 61483
Hi,
Have you tried using (non-home) git-daemon-service-type as a home service?
I think it should work.
Cheers,
Bruno
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
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 ` Jan Nieuwenhuizen
0 siblings, 0 replies; 38+ messages in thread
From: Jan Nieuwenhuizen @ 2023-02-14 15:17 UTC (permalink / raw)
To: Bruno Victal; +Cc: 61483
Bruno Victal writes:
> Have you tried using (non-home) git-daemon-service-type as a home service?
Yeah, I tried
--8<---------------cut here---------------start------------->8---
(use-modules (gnu services version-control))
;; [..]
,@(let ((root (string-append (getenv "HOME") "/git-daemon")))
(if (not (file-exists? root)) '()
`(,(service
git-daemon-service-type
(git-daemon-configuration
(base-path root)
(export-all? #t))))))
--8<---------------cut here---------------end--------------->8---
and upon guix home reconfigure I got
guix home: error: no target of type 'account' for service 'git-daemon'
> I think it should work.
It might, and that would be nice, but I would need some more guidance as
to handle the account setup thing?
Greetings,
Janneke
--
Janneke Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
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-14 15:14 ` Janneke Nieuwenhuizen
2023-02-16 15:53 ` [bug#61483] [PATCH v2 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type Jan (janneke) Nieuwenhuizen
` (2 subsequent siblings)
4 siblings, 0 replies; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-02-14 15:14 UTC (permalink / raw)
To: 61483
Jan (janneke) Nieuwenhuizen writes:
> The weird thing is that after running
>
> ./pre-inst-env guix home reconfigure home-configuration.scm
>
> the shepherd starts automatically, starting ssh-agent and git-daemon. Upon a
> fresh login, however, it seems the shepherd must still be started manually,
> kind of defeating its purpose as a home service...
>
> Thoughts?
Okay, after playing with this some more using a clean account all seems
to work fine. Apparently there was some weird interaction with my
current shepherd-service setup interacted.
Greetings,
Janneke
--
Janneke Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH v2 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type.
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-14 15:14 ` Janneke Nieuwenhuizen
@ 2023-02-16 15:53 ` Jan (janneke) Nieuwenhuizen
2023-02-16 15:53 ` [bug#61483] [PATCH v2 2/5] DRAFT gnu: home: services: Add home-ssh-agent-service-type Jan (janneke) Nieuwenhuizen
` (4 more replies)
2023-03-04 17:01 ` Ludovic Courtès
2023-03-05 18:13 ` [bug#61483] [PATCH v3 1/3] gnu: home: services: Add home-ssh-agent-service-type Janneke Nieuwenhuizen
4 siblings, 5 replies; 38+ messages in thread
From: Jan (janneke) Nieuwenhuizen @ 2023-02-16 15:53 UTC (permalink / raw)
To: 61483
* 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
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH v2 2/5] DRAFT gnu: home: services: Add home-ssh-agent-service-type.
2023-02-16 15:53 ` [bug#61483] [PATCH v2 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type Jan (janneke) Nieuwenhuizen
@ 2023-02-16 15:53 ` 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
` (3 subsequent siblings)
4 siblings, 1 reply; 38+ messages in thread
From: Jan (janneke) Nieuwenhuizen @ 2023-02-16 15:53 UTC (permalink / raw)
To: 61483
* gnu/home/services/shepherd-xyz.scm
(<home-ssh-agent-configuration>): New type.
(home-ssh-agent-services): New procedure.
(home-ssh-agent-service-type): New variable.
---
gnu/home/services/shepherd-xyz.scm | 60 +++++++++++++++++++++++++++++-
1 file changed, 59 insertions(+), 1 deletion(-)
diff --git a/gnu/home/services/shepherd-xyz.scm b/gnu/home/services/shepherd-xyz.scm
index 4d84008dae..75f3770ffc 100644
--- a/gnu/home/services/shepherd-xyz.scm
+++ b/gnu/home/services/shepherd-xyz.scm
@@ -25,6 +25,7 @@ (define-module (gnu home services shepherd-xyz)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
+ #:use-module (gnu packages ssh)
#:use-module (gnu packages version-control)
#:use-module (gnu services configuration)
#:use-module (gnu services shepherd)
@@ -32,7 +33,9 @@ (define-module (gnu home services shepherd-xyz)
#:use-module (guix gexp)
#:export (home-git-daemon-configuration
- home-git-daemon-service-type))
+ home-git-daemon-service-type
+ home-ssh-agent-configuration
+ home-ssh-agent-service-type))
;;; Commentary:
;;
@@ -46,6 +49,15 @@ (define-module (gnu home services shepherd-xyz)
;; (home-git-configuration
;; (root (string-append (getenv "HOME") "/src"))))
;;
+;; Ssh-agent
+;;
+;; Add to your ~/.bash_profile:
+;;
+;; SSH_AUTH_SOCK=${XDG_RUNTIME_DIR-$HOME/.cache}/ssh-agent/socket
+;; export SSH_AUTH_SOCK
+;;
+;; (service home-ssh-agent-service-type)
+;;
;;; Code:
;;;
@@ -120,3 +132,49 @@ (define home-git-daemon-service-type
home-git-daemon-services)))
(description
"Install and configure the git-daemon as a shepherd service.")))
+
+\f
+;;;
+;;; Ssh-agent.
+;;;
+(define-record-type* <home-ssh-agent-configuration>
+ home-ssh-agent-configuration make-home-ssh-agent-configuration
+ home-ssh-agent-configuration?
+ (openssh home-ssh-agent-openssh ;file-like
+ (default openssh))
+ (socket-dir home-ssh-agent-socket-dir ;string
+ (default (string-append %user-runtime-dir "/ssh-agent")))
+ (extra-options home-ssh-agent-extra-options ;list of string
+ (default '())))
+
+(define (home-ssh-agent-services config)
+ "Return a <shepherd-service> for an ssh-agent with CONFIG."
+ (match config
+ (($ <home-ssh-agent-configuration>
+ openssh socket-dir extra-options)
+ (let* ((ssh-agent (file-append openssh "/bin/ssh-agent"))
+ (socket-file (string-append socket-dir "/socket"))
+ (command `(,ssh-agent
+ "-D"
+ "-a" ,socket-file
+ ,@extra-options))
+ (log-file (string-append %user-log-dir "/ssh-agent.log")))
+ (list (shepherd-service
+ (documentation "Run the ssh-agent.")
+ (provision '(ssh-agent))
+ (start #~(lambda _
+ (unless (file-exists? #$socket-dir)
+ (mkdir-p #$socket-dir)
+ (chmod #$socket-dir #o700))
+ (fork+exec-command '#$command #:log-file #$log-file)))
+ (stop #~(make-kill-destructor))))))))
+
+(define home-ssh-agent-service-type
+ (service-type
+ (name 'home-ssh-agent)
+ (default-value (home-ssh-agent-configuration))
+ (extensions
+ (list (service-extension home-shepherd-service-type
+ home-ssh-agent-services)))
+ (description
+ "Install and configure the ssh-agent as a shepherd service.")))
--
2.38.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
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 ` Ludovic Courtès
0 siblings, 0 replies; 38+ messages in thread
From: Ludovic Courtès @ 2023-03-04 17:08 UTC (permalink / raw)
To: Jan (janneke) Nieuwenhuizen; +Cc: 61483
"Jan (janneke) Nieuwenhuizen" <janneke@gnu.org> skribis:
> * gnu/home/services/shepherd-xyz.scm
> (<home-ssh-agent-configuration>): New type.
> (home-ssh-agent-services): New procedure.
> (home-ssh-agent-service-type): New variable.
Rather in ‘ssh.scm’ IMO.
> + (socket-dir home-ssh-agent-socket-dir ;string
Rather s/socket-dir/socket-directory/
> + (description
> + "Install and configure the ssh-agent as a shepherd service.")))
“Install and configure @command{ssh-agent} as a Shepherd service.”
With these changes and an entry in the manual, we’re all set!
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH v2 3/5] DRAFT gnu: home: services: Add home-znc-service-type.
2023-02-16 15:53 ` [bug#61483] [PATCH v2 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type Jan (janneke) Nieuwenhuizen
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-02-16 15:53 ` 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
` (2 subsequent siblings)
4 siblings, 1 reply; 38+ messages in thread
From: Jan (janneke) Nieuwenhuizen @ 2023-02-16 15:53 UTC (permalink / raw)
To: 61483
* gnu/home/services/shepherd-xyz.scm
(<home-znc-configuration>): New type.
(home-znc-services): New procedure.
(home-znc-service-type): New variable.
---
gnu/home/services/shepherd-xyz.scm | 43 +++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/gnu/home/services/shepherd-xyz.scm b/gnu/home/services/shepherd-xyz.scm
index 75f3770ffc..856a5e7246 100644
--- a/gnu/home/services/shepherd-xyz.scm
+++ b/gnu/home/services/shepherd-xyz.scm
@@ -25,6 +25,7 @@ (define-module (gnu home services shepherd-xyz)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
+ #:use-module (gnu packages messaging)
#:use-module (gnu packages ssh)
#:use-module (gnu packages version-control)
#:use-module (gnu services configuration)
@@ -35,7 +36,9 @@ (define-module (gnu home services shepherd-xyz)
#:export (home-git-daemon-configuration
home-git-daemon-service-type
home-ssh-agent-configuration
- home-ssh-agent-service-type))
+ home-ssh-agent-service-type
+ home-znc-configuration
+ home-znc-service-type))
;;; Commentary:
;;
@@ -178,3 +181,41 @@ (define home-ssh-agent-service-type
home-ssh-agent-services)))
(description
"Install and configure the ssh-agent as a shepherd service.")))
+
+\f
+;;;
+;;; Znc.
+;;;
+(define-record-type* <home-znc-configuration>
+ home-znc-configuration make-home-znc-configuration
+ home-znc-configuration?
+ (znc home-znc-znc ;string
+ (default znc))
+ (extra-options home-znc-extra-options ;list of string
+ (default '())))
+
+(define (home-znc-services config)
+ "Return a <shepherd-service> for znc with CONFIG."
+ (match config
+ (($ <home-znc-configuration> znc extra-options)
+ (let* ((znc (file-append znc "/bin/znc"))
+ (command `(,znc
+ "--foreground"
+ ,@extra-options))
+ (log-file (string-append %user-log-dir "/znc.log")))
+ (list (shepherd-service
+ (documentation "Run the znc IRC bouncer.")
+ (provision '(znc))
+ (start #~(make-forkexec-constructor '#$command
+ #:log-file #$log-file))
+ (stop #~(make-kill-destructor))))))))
+
+(define home-znc-service-type
+ (service-type
+ (name 'home-znc)
+ (default-value (home-znc-configuration))
+ (extensions
+ (list (service-extension home-shepherd-service-type
+ home-znc-services)))
+ (description
+ "Install and configure znc as a shepherd service.")))
--
2.38.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH v2 4/5] DRAFT gnu: home: services: Add home-kodi-service-type.
2023-02-16 15:53 ` [bug#61483] [PATCH v2 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type Jan (janneke) Nieuwenhuizen
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-02-16 15:53 ` [bug#61483] [PATCH v2 3/5] DRAFT gnu: home: services: Add home-znc-service-type Jan (janneke) Nieuwenhuizen
@ 2023-02-16 15:53 ` Jan (janneke) Nieuwenhuizen
2023-03-04 17:10 ` [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Ludovic Courtès
2023-02-16 15:53 ` [bug#61483] [PATCH v2 5/5] DRAFT doc: Document " Jan (janneke) Nieuwenhuizen
2023-03-04 17:05 ` Ludovic Courtès
4 siblings, 1 reply; 38+ messages in thread
From: Jan (janneke) Nieuwenhuizen @ 2023-02-16 15:53 UTC (permalink / raw)
To: 61483
* gnu/home/services/shepherd-xyz.scm
(<home-kodi-configuration>): New type.
(home-kodi-services): New procedure.
(home-kodi-service-type): New variable.
---
gnu/home/services/shepherd-xyz.scm | 41 ++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/gnu/home/services/shepherd-xyz.scm b/gnu/home/services/shepherd-xyz.scm
index 856a5e7246..f5bedf60c7 100644
--- a/gnu/home/services/shepherd-xyz.scm
+++ b/gnu/home/services/shepherd-xyz.scm
@@ -25,6 +25,7 @@ (define-module (gnu home services shepherd-xyz)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
+ #:use-module (gnu packages kodi)
#:use-module (gnu packages messaging)
#:use-module (gnu packages ssh)
#:use-module (gnu packages version-control)
@@ -35,6 +36,8 @@ (define-module (gnu home services shepherd-xyz)
#:export (home-git-daemon-configuration
home-git-daemon-service-type
+ home-kodi-configuration
+ home-kodi-service-type
home-ssh-agent-configuration
home-ssh-agent-service-type
home-znc-configuration
@@ -136,6 +139,44 @@ (define home-git-daemon-service-type
(description
"Install and configure the git-daemon as a shepherd service.")))
+\f
+;;;
+;;; Kodi.
+;;;
+(define-record-type* <home-kodi-configuration>
+ home-kodi-configuration make-home-kodi-configuration
+ home-kodi-configuration?
+ (kodi home-kodi-kodi ;file-like
+ (default kodi))
+ (extra-options home-kodi-extra-options ;list of string
+ (default '())))
+
+(define (home-kodi-services config)
+ "Return a <shepherd-service> for kodi with CONFIG."
+ (match config
+ (($ <home-kodi-configuration> kodi extra-options)
+ (let* ((kodi (file-append kodi "/bin/kodi"))
+ (command `(kodi
+ "-fs"
+ ,@extra-options))
+ (log-file (string-append %user-log-dir "/kodi.log")))
+ (list (shepherd-service
+ (documentation "Run the kodi media center.")
+ (provision '(kodi))
+ (start #~(make-forkexec-constructor '#$command
+ #:log-file #$log-file))
+ (stop #~(make-kill-destructor))))))))
+
+(define home-kodi-service-type
+ (service-type
+ (name 'home-kodi)
+ (default-value (home-kodi-configuration))
+ (extensions
+ (list (service-extension home-shepherd-service-type
+ home-kodi-services)))
+ (description
+ "Install and configure kodi as a shepherd service.")))
+
\f
;;;
;;; Ssh-agent.
--
2.38.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
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 ` Ludovic Courtès
2023-03-05 18:11 ` Janneke Nieuwenhuizen
0 siblings, 1 reply; 38+ messages in thread
From: Ludovic Courtès @ 2023-03-04 17:10 UTC (permalink / raw)
To: Jan (janneke) Nieuwenhuizen; +Cc: 61483
"Jan (janneke) Nieuwenhuizen" <janneke@gnu.org> skribis:
> * gnu/home/services/shepherd-xyz.scm
> (<home-kodi-configuration>): New type.
> (home-kodi-services): New procedure.
> (home-kodi-service-type): New variable.
Rather ‘media.scm’?
> +(define home-kodi-service-type
> + (service-type
> + (name 'home-kodi)
> + (default-value (home-kodi-configuration))
> + (extensions
> + (list (service-extension home-shepherd-service-type
> + home-kodi-services)))
> + (description
> + "Install and configure kodi as a shepherd service.")))
Maybe something like: “Install and configure the Kodi media center so
that it runs as a Shepherd service.”
Likewise: this + manual entry and we’re all set IMO!
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH v2 5/5] DRAFT doc: Document Home Shepherd Services.
2023-02-16 15:53 ` [bug#61483] [PATCH v2 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type Jan (janneke) Nieuwenhuizen
` (2 preceding siblings ...)
2023-02-16 15:53 ` [bug#61483] [PATCH v2 4/5] DRAFT gnu: home: services: Add home-kodi-service-type Jan (janneke) Nieuwenhuizen
@ 2023-02-16 15:53 ` Jan (janneke) Nieuwenhuizen
2023-03-04 17:14 ` [bug#61483] [PATCH 0/5] Some basic " Ludovic Courtès
2023-03-04 17:05 ` Ludovic Courtès
4 siblings, 1 reply; 38+ messages in thread
From: Jan (janneke) Nieuwenhuizen @ 2023-02-16 15:53 UTC (permalink / raw)
To: 61483
* doc/guix.texi (Shepherd Home Services): New subsubsection.
---
doc/guix.texi | 124 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 123 insertions(+), 1 deletion(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 784114f0bb..a5a62010b6 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -36,7 +36,7 @@ Copyright @copyright{} 2016, 2017, 2018, 2021 Chris Marusich@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021, 2022 Efraim Flashner@*
Copyright @copyright{} 2016 John Darrington@*
Copyright @copyright{} 2016, 2017 Nikita Gillmann@*
-Copyright @copyright{} 2016, 2017, 2018, 2019, 2020 Jan Nieuwenhuizen@*
+Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2023 Jan Nieuwenhuizen@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021 Julien Lepiller@*
Copyright @copyright{} 2016 Alex ter Weele@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021 Christopher Baines@*
@@ -41285,6 +41285,128 @@ mechanism instead (@pxref{Shepherd Services}).
@end table
@end deftp
+@menu
+* Shepherd Home Services::
+@end menu
+
+@node Shepherd Home Services
+@subsubsection e Shepherd Home Services
+
+The @code{(gnu home services shepherd-xyz)} module provides serveral
+home shepherd services.
+
+@defvr {Scheme Variable} home-git-daemon-service-type
+This is the type of the @code{git daemon} home service, whose value is an
+@code{home-git-daemon-configuration} object.
+@end defvr
+
+@deftp {Data Type} home-git-daemon-configuration
+Available @code{home-git-daemon-configuration} fields are:
+
+@table @asis
+@item @code{git} (default: @code{git}) (type: file-like)
+The git package to use.
+
+@item @code{root} (default: @file{@env{XDG_DATA_HOME}/git-daemon}) (type: string)
+The git deamon's base directory.
+
+@item @code{export-all?} (default: @code{#f})
+Whether to allow access for all Git repositories, even if they do not
+have the @file{git-daemon-export-ok} file.
+
+@item @code{base-path} (default: @file{/srv/git})
+Whether to remap all the path requests as relative to the given path.
+If you run @command{git daemon} with @code{(base-path "/srv/git")} on
+@samp{example.com}, then if you later try to pull
+@indicateurl{git://example.com/hello.git}, git daemon will interpret the
+path as @file{/srv/git/hello.git}.
+
+@item @code{user-path} (default: @code{#f})
+Whether to allow @code{~user} notation to be used in requests. When
+specified with empty string, requests to
+@indicateurl{git://host/~alice/foo} is taken as a request to access
+@code{foo} repository in the home directory of user @code{alice}. If
+@code{(user-path "@var{path}")} is specified, the same request is taken
+as a request to access @file{@var{path}/foo} repository in the home
+directory of user @code{alice}.
+
+@item @code{listen} (default: @code{'()})
+Whether to listen on specific IP addresses or hostnames, defaults to
+all.
+
+@item @code{port} (default: @code{#f})
+Whether to listen on an alternative port, which defaults to 9418.
+
+@item @code{whitelist} (default: @code{'()})
+If not empty, only allow access to this list of directories.
+
+@item @code{extra-options} (default: @code{'()})
+Extra options will be passed to @command{git daemon}, please run
+@command{man git-daemon} for more information.
+
+@end table
+@end deftp
+
+@defvr {Scheme Variable} home-kodi-service-type
+This is the type of the @code{git daemon} home service, whose value is an
+@code{home-kodi-configuration} object.
+@end defvr
+
+@deftp {Data Type} home-kodi-configuration
+Available @code{home-kodi-configuration} fields are:
+
+@table @asis
+@item @code{git} (default: @code{git}) (type: file-like)
+The git package to use.
+
+@item @code{extra-options} (default: @code{'()})
+Extra options will be passed to @command{kodi}, please run @command{man
+kodi} for more information.
+
+@end table
+@end deftp
+
+@defvr {Scheme Variable} home-ssh-agent-service-type
+This is the type of the @code{git daemon} home service, whose value is an
+@code{home-ssh-agent-configuration} object.
+@end defvr
+
+@deftp {Data Type} home-ssh-agent-configuration
+Available @code{home-ssh-agent-configuration} fields are:
+
+@table @asis
+@item @code{git} (default: @code{git}) (type: file-like)
+The git package to use.
+
+@item @code{socket-dir} (default: @code{@env{XDG_RUNTIME_DIR}/ssh-agent"}) (type: string)
+The directory to write the ssh-agent's @file{socket} file.
+
+@item @code{extra-options} (default: @code{'()})
+Extra options will be passed to @command{ssh-agent}, please run
+@command{man ssh-agent} for more information.
+
+@end table
+@end deftp
+
+@defvr {Scheme Variable} home-znc-service-type
+This is the type of the @code{git daemon} home service, whose value is an
+@code{home-znc-configuration} object.
+@end defvr
+
+@deftp {Data Type} home-znc-configuration
+Available @code{home-znc-configuration} fields are:
+
+@table @asis
+@item @code{git} (default: @code{git}) (type: file-like)
+The git package to use.
+
+@item @code{extra-options} (default: @code{'()})
+Extra options will be passed to @command{znc}, please run @command{man
+znc} for more information.
+
+@end table
+@end deftp
+
@node Secure Shell
@subsection Secure Shell
--
2.38.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
2023-02-16 15:53 ` [bug#61483] [PATCH v2 5/5] DRAFT doc: Document " Jan (janneke) Nieuwenhuizen
@ 2023-03-04 17:14 ` Ludovic Courtès
2023-03-05 18:09 ` Janneke Nieuwenhuizen
0 siblings, 1 reply; 38+ messages in thread
From: Ludovic Courtès @ 2023-03-04 17:14 UTC (permalink / raw)
To: Jan (janneke) Nieuwenhuizen; +Cc: 61483
"Jan (janneke) Nieuwenhuizen" <janneke@gnu.org> skribis:
> * doc/guix.texi (Shepherd Home Services): New subsubsection.
Oooh, I totally overlooked this.
Overall I’d suggest documenting in the patch that adds the service.
That way, each change is self-contained, which facilitates review, etc.
I would suggest creating one section per type, roughly corresponding to
the (gnu home services …) module: “Media”, “Version Control”, etc. For
SSH there’s already “Secure Shell”.
Also please start each service’s documentation with a couple of
sentences giving context and possibly an example, similar to what’s done
for the existing Home services.
Could you send an updated patch series, maybe leaving out git-daemon
until we figure out whether/how to factorize it?
Thank you!
Ludo’.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
2023-03-04 17:14 ` [bug#61483] [PATCH 0/5] Some basic " Ludovic Courtès
@ 2023-03-05 18:09 ` Janneke Nieuwenhuizen
0 siblings, 0 replies; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-03-05 18:09 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 61483
Ludovic Courtès writes:
> "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org> skribis:
>
>> * doc/guix.texi (Shepherd Home Services): New subsubsection.
>
> Oooh, I totally overlooked this.
>
> Overall I’d suggest documenting in the patch that adds the service.
> That way, each change is self-contained, which facilitates review, etc.
Sure.
> I would suggest creating one section per type, roughly corresponding to
> the (gnu home services …) module: “Media”, “Version Control”, etc. For
> SSH there’s already “Secure Shell”.
Done.
> Also please start each service’s documentation with a couple of
> sentences giving context and possibly an example, similar to what’s done
> for the existing Home services.
Okay.
> Could you send an updated patch series, maybe leaving out git-daemon
> until we figure out whether/how to factorize it?
Sounds good, coming right up!
Thanks,
Janneke
--
Janneke Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
2023-02-16 15:53 ` [bug#61483] [PATCH v2 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type Jan (janneke) Nieuwenhuizen
` (3 preceding siblings ...)
2023-02-16 15:53 ` [bug#61483] [PATCH v2 5/5] DRAFT doc: Document " Jan (janneke) Nieuwenhuizen
@ 2023-03-04 17:05 ` Ludovic Courtès
2023-03-05 17:41 ` Janneke Nieuwenhuizen
4 siblings, 1 reply; 38+ messages in thread
From: Ludovic Courtès @ 2023-03-04 17:05 UTC (permalink / raw)
To: Jan (janneke) Nieuwenhuizen; +Cc: 61483
"Jan (janneke) Nieuwenhuizen" <janneke@gnu.org> skribis:
> * gnu/home/services/shepherd-xyz.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
I’d make it version-control.scm instead.
> +(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))))))))
I have a prototype here to “transform” a System service into a Home
service. Would it be of any use here, to share code with
‘git-daemon-service-type’?
Looks like the only issue would be #:user "git-daemon", which is not
going to work, and I don’t have a good solution to that. :-/
Ludo’.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
2023-03-04 17:05 ` Ludovic Courtès
@ 2023-03-05 17:41 ` Janneke Nieuwenhuizen
0 siblings, 0 replies; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-03-05 17:41 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 61483
Ludovic Courtès writes:
> "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org> skribis:
>
>> * gnu/home/services/shepherd-xyz.scm: New file.
>> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
>
> I’d make it version-control.scm instead.
Let's do that...
>
>> +(define-record-type* <home-git-daemon-configuration>
[..]
> I have a prototype here to “transform” a System service into a Home
> service. Would it be of any use here, to share code with
> ‘git-daemon-service-type’?
Yes, that would be nice...
> Looks like the only issue would be #:user "git-daemon", which is not
> going to work, and I don’t have a good solution to that. :-/
...but indeed. I tried something along those lines. Oh well, I guess I
can run my shepherd home git-daemon to system scope and we can ponder on
this some more.
Come to think of it, are there any plans/ideas to specify home service
configurations in the system configuration?
Greetings,
Janneke
--
Janneke Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
2023-02-13 16:46 [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Jan (janneke) Nieuwenhuizen
` (2 preceding siblings ...)
2023-02-16 15:53 ` [bug#61483] [PATCH v2 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type Jan (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
4 siblings, 1 reply; 38+ messages in thread
From: Ludovic Courtès @ 2023-03-04 17:01 UTC (permalink / raw)
To: Jan (janneke) Nieuwenhuizen; +Cc: 61483
Howdy!
"Jan (janneke) Nieuwenhuizen" <janneke@gnu.org> skribis:
> I've been waiting for Guix Home to offer some basic shepherd services for most
> used daemons, replacing the neat shepherd hack described in
>
> https://guix.gnu.org/en/blog/2020/gnu-shepherd-user-services/
>
> that I've been using, and am a bit puzzled as to why this didn't happen. Are
> people using Guix Home?
I am! :-)
Possible reasons not all the services described there made it into Guix
Home: (1) needs vary :-), (2) it’s possible to migrate incrementally,
with some things handled with Home while others are still managed “the
old way” (that’s what I do), and (3) rde is kinda “competing” with Home
by providing a whole bunch of services, giving less of an incentive to
migrate them (it’s an unfortunate issue we identified at the time Home
got merged).
But with contributions like these, the situation will improve!
> Anyway, here's my attempt to address this, adding ssh-agent, git-daemon, and
> also the probably less-used kodi and znc that I use on my home server.
Nice.
Ludo’.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
2023-03-04 17:01 ` Ludovic Courtès
@ 2023-03-05 18:18 ` Janneke Nieuwenhuizen
0 siblings, 0 replies; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-03-05 18:18 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 61483
Ludovic Courtès writes:
Hey!
> "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org> skribis:
>
>> I've been waiting for Guix Home to offer some basic shepherd services for most
>> used daemons, replacing the neat shepherd hack described in
>>
>> https://guix.gnu.org/en/blog/2020/gnu-shepherd-user-services/
>>
>> that I've been using, and am a bit puzzled as to why this didn't happen. Are
>> people using Guix Home?
>
> I am! :-)
Oh, good. I'v been tempted for quite a while and will try to switch
when this patch series goes in. I'll be moving bits the
executable/configuration bits (that are without secrets) from my
home.git to guix-home.
> Possible reasons not all the services described there made it into Guix
> Home: (1) needs vary :-),
yeah...could be I'm the only one using kodi and znc, but I expected
ssh-agent to be kinda popular...
> (2) it’s possible to migrate incrementally,
> with some things handled with Home while others are still managed “the
> old way” (that’s what I do),
That sounds like a stategy I'll be following too
> and (3) rde is kinda “competing” with Home by providing a whole bunch
> of services, giving less of an incentive to migrate them (it’s an
> unfortunate issue we identified at the time Home got merged).
Ouch, why that's...terrible? Is there any reason stuff is not
contributed "up stream"? ;)
> But with contributions like these, the situation will improve!
Yay! Let's go for that, then.
Greetings,
Janneke
--
Janneke Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH v3 1/3] gnu: home: services: Add home-ssh-agent-service-type.
2023-02-13 16:46 [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Jan (janneke) Nieuwenhuizen
` (3 preceding siblings ...)
2023-03-04 17:01 ` Ludovic Courtès
@ 2023-03-05 18:13 ` Janneke Nieuwenhuizen
2023-03-05 18:13 ` [bug#61483] [PATCH v3 2/3] gnu: home: services: Add home-znc-service-type Janneke Nieuwenhuizen
` (2 more replies)
4 siblings, 3 replies; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-03-05 18:13 UTC (permalink / raw)
To: 61483; +Cc: Janneke Nieuwenhuizen
From: "Janneke Nieuwenhuizen" <janneke@gnu.org>
* gnu/home/services/ssh.scm: (<home-ssh-agent-configuration>): New type.
(home-ssh-agent-services): New procedure.
(home-ssh-agent-service-type): New variable.
* doc/guix.texi (Secure Shell): Document it.
---
doc/guix.texi | 56 ++++++++++++++++++++++++++++++++++++++-
gnu/home/services/ssh.scm | 54 ++++++++++++++++++++++++++++++++++++-
2 files changed, 108 insertions(+), 2 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 74658dbc86..9cf1451814 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -36,7 +36,7 @@ Copyright @copyright{} 2016, 2017, 2018, 2021 Chris Marusich@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021, 2022 Efraim Flashner@*
Copyright @copyright{} 2016 John Darrington@*
Copyright @copyright{} 2016, 2017 Nikita Gillmann@*
-Copyright @copyright{} 2016, 2017, 2018, 2019, 2020 Jan Nieuwenhuizen@*
+Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2023 Jan Nieuwenhuizen@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021 Julien Lepiller@*
Copyright @copyright{} 2016 Alex ter Weele@*
Copyright @copyright{} 2016, 2017, 2018, 2019, 2020, 2021 Christopher Baines@*
@@ -42447,6 +42447,60 @@ Extra content appended as-is to this @code{Host} block in
@c %end of fragment
+@cindex ssh-agent
+The @uref{https://www.openssh.com, OpenSSH package} includes a daemon,
+the @command{ssh-agent} command, that manages keys to connect to remote
+machines using the @acronym{SSH, secure shell} protocol. With the
+@code{(gnu home services ssh-agent)} service, you can configure the
+OpenSSH ssh-agent to run upon login.
+
+When using the @code{home-ssh-agent-service-type}, you need to add your
+@file{~/.bash_profile}:
+
+@example
+SSH_AUTH_SOCK=$@{XDG_RUNTIME_DIR-$HOME/.cache@}/ssh-agent/socket
+export SSH_AUTH_SOCK
+@end example
+
+Of course, you can do that using the @code{home-bash-service-type}, by
+adding something like:
+
+@lisp
+(environment-variables
+ '(("SSH_AUTH_SOCK"
+ . "$@{SSH_AUTH_SOCK-$@{XDG_RUNTIME_DIR-$HOME/.cache@}/ssh-agent/socket@}")))
+@end lisp
+
+Here is an example of a service and its configuration that you could add
+to the @code{services} field of your @code{home-environment}:
+
+@lisp
+(service home-ssh-agent-service-type
+ (home-ssh-agent-configuration
+ (extra-options '("-t" "1h30m"))))
+@end lisp
+
+@defvr {Scheme Variable} home-ssh-agent-service-type
+This is the type of the @code{git daemon} home service, whose value is an
+@code{home-ssh-agent-configuration} object.
+@end defvr
+
+@deftp {Data Type} home-ssh-agent-configuration
+Available @code{home-ssh-agent-configuration} fields are:
+
+@table @asis
+@item @code{git} (default: @code{git}) (type: file-like)
+The git package to use.
+
+@item @code{socket-directory} (default: @code{@env{XDG_RUNTIME_DIR}/ssh-agent"}) (type: string)
+The directory to write the ssh-agent's @file{socket} file.
+
+@item @code{extra-options} (default: @code{'()})
+Extra options will be passed to @command{ssh-agent}, please run
+@command{man ssh-agent} for more information.
+
+@end table
+@end deftp
@node Desktop Home Services
@subsection Desktop Home Services
diff --git a/gnu/home/services/ssh.scm b/gnu/home/services/ssh.scm
index d15f5ee912..205650d489 100644
--- a/gnu/home/services/ssh.scm
+++ b/gnu/home/services/ssh.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -25,9 +26,12 @@ (define-module (gnu home services ssh)
#:use-module (gnu services configuration)
#:use-module (guix modules)
#:use-module (gnu home services)
+ #:use-module (gnu home services shepherd)
#:use-module ((gnu home services utils)
#:select (object->camel-case-string))
#:autoload (gnu packages base) (glibc-utf8-locales)
+ #:use-module (gnu packages ssh)
+ #:use-module (shepherd support)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
@@ -36,6 +40,7 @@ (define-module (gnu home services ssh)
home-openssh-configuration-authorized-keys
home-openssh-configuration-known-hosts
home-openssh-configuration-hosts
+ home-ssh-agent-configuration
openssh-host
openssh-host-host-name
@@ -52,7 +57,8 @@ (define-module (gnu home services ssh)
openssh-host-accepted-key-types
openssh-host-extra-content
- home-openssh-service-type))
+ home-openssh-service-type
+ home-ssh-agent-service-type))
(define (serialize-field-name name)
(match name
@@ -254,3 +260,49 @@ (define home-openssh-service-type
by providing a @file{~/.ssh/config} file, which is honored by the OpenSSH
client,@command{ssh}, and by other tools such as @command{guix deploy}.")
(default-value (home-openssh-configuration))))
+
+\f
+;;;
+;;; Ssh-agent.
+;;;
+(define-record-type* <home-ssh-agent-configuration>
+ home-ssh-agent-configuration make-home-ssh-agent-configuration
+ home-ssh-agent-configuration?
+ (openssh home-ssh-agent-openssh ;file-like
+ (default openssh))
+ (socket-directory home-ssh-agent-socket-directory ;string
+ (default (string-append %user-runtime-dir "/ssh-agent")))
+ (extra-options home-ssh-agent-extra-options ;list of string
+ (default '())))
+
+(define (home-ssh-agent-services config)
+ "Return a <shepherd-service> for an ssh-agent with CONFIG."
+ (match config
+ (($ <home-ssh-agent-configuration>
+ openssh socket-directory extra-options)
+ (let* ((ssh-agent (file-append openssh "/bin/ssh-agent"))
+ (socket-file (string-append socket-directory "/socket"))
+ (command `(,ssh-agent
+ "-D"
+ "-a" ,socket-file
+ ,@extra-options))
+ (log-file (string-append %user-log-dir "/ssh-agent.log")))
+ (list (shepherd-service
+ (documentation "Run the ssh-agent.")
+ (provision '(ssh-agent))
+ (start #~(lambda _
+ (unless (file-exists? #$socket-directory)
+ (mkdir-p #$socket-directory)
+ (chmod #$socket-directory #o700))
+ (fork+exec-command '#$command #:log-file #$log-file)))
+ (stop #~(make-kill-destructor))))))))
+
+(define home-ssh-agent-service-type
+ (service-type
+ (name 'home-ssh-agent)
+ (default-value (home-ssh-agent-configuration))
+ (extensions
+ (list (service-extension home-shepherd-service-type
+ home-ssh-agent-services)))
+ (description
+ "Install and configure @command{ssh-agent} as a Shepherd service.")))
--
2.39.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH v3 2/3] gnu: home: services: Add home-znc-service-type.
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 ` Janneke Nieuwenhuizen
2023-03-16 11:01 ` [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Ludovic Courtès
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:01 ` Ludovic Courtès
2 siblings, 1 reply; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-03-05 18:13 UTC (permalink / raw)
To: 61483; +Cc: Janneke Nieuwenhuizen
From: "Janneke Nieuwenhuizen" <janneke@gnu.org>
* gnu/home/services/messaging.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
* doc/guix.texi (Messaging Home Services): Document it in new subsection.
---
doc/guix.texi | 37 +++++++++++++++++
gnu/home/services/messaging.scm | 72 +++++++++++++++++++++++++++++++++
gnu/local.mk | 3 +-
3 files changed, 111 insertions(+), 1 deletion(-)
create mode 100644 gnu/home/services/messaging.scm
diff --git a/doc/guix.texi b/doc/guix.texi
index 9cf1451814..3ea7f4e470 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41688,6 +41688,7 @@ services)}.
* Desktop: Desktop Home Services. Services for graphical environments.
* Guix: Guix Home Services. Services for Guix.
* Fonts: Fonts Home Services. Services for managing User's fonts.
+* Messaging: Messaging Home Services. Services for managing messaging.
@end menu
@c In addition to that Home Services can provide
@@ -42655,6 +42656,42 @@ like this:
@end lisp
@end defvar
+@node Messaging Home Services
+@subsection Messaging Home Services
+
+@cindex znc
+The @uref{https://znc.in, ZNC bouncer} can be run as a daemon to manage
+your IRC presence. With the @code{(gnu home services znc)} service, you
+can configure ZNC to run upon login.
+
+You will have to provide a @file{~/.znc/configs/znc.conf} seperately.
+
+Here is an example of a service and its configuration that you could add
+to the @code{services} field of your @code{home-environment}:
+
+@lisp
+(service home-znc-service-type)
+@end lisp
+
+@defvr {Scheme Variable} home-znc-service-type
+This is the type of the @code{git daemon} home service, whose value is an
+@code{home-znc-configuration} object.
+@end defvr
+
+@deftp {Data Type} home-znc-configuration
+Available @code{home-znc-configuration} fields are:
+
+@table @asis
+@item @code{git} (default: @code{git}) (type: file-like)
+The git package to use.
+
+@item @code{extra-options} (default: @code{'()})
+Extra options will be passed to @command{znc}, please run @command{man
+znc} for more information.
+
+@end table
+@end deftp
+
@node Invoking guix home
@section Invoking @command{guix home}
diff --git a/gnu/home/services/messaging.scm b/gnu/home/services/messaging.scm
new file mode 100644
index 0000000000..2988b52ad2
--- /dev/null
+++ b/gnu/home/services/messaging.scm
@@ -0,0 +1,72 @@
+;;; 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 messaging)
+ #: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 messaging)
+ #:use-module (gnu services configuration)
+ #:use-module (gnu services shepherd)
+ #:use-module (guix records)
+ #:use-module (guix gexp)
+
+ #:export (home-znc-configuration
+ home-znc-service-type))
+
+;;;
+;;; Znc.
+;;;
+(define-record-type* <home-znc-configuration>
+ home-znc-configuration make-home-znc-configuration
+ home-znc-configuration?
+ (znc home-znc-znc ;string
+ (default znc))
+ (extra-options home-znc-extra-options ;list of string
+ (default '())))
+
+(define (home-znc-services config)
+ "Return a <shepherd-service> for znc with CONFIG."
+ (match config
+ (($ <home-znc-configuration> znc extra-options)
+ (let* ((znc (file-append znc "/bin/znc"))
+ (command `(,znc
+ "--foreground"
+ ,@extra-options))
+ (log-file (string-append %user-log-dir "/znc.log")))
+ (list (shepherd-service
+ (documentation "Run the znc IRC bouncer.")
+ (provision '(znc))
+ (start #~(make-forkexec-constructor '#$command
+ #:log-file #$log-file))
+ (stop #~(make-kill-destructor))))))))
+
+(define home-znc-service-type
+ (service-type
+ (name 'home-znc)
+ (default-value (home-znc-configuration))
+ (extensions
+ (list (service-extension home-shepherd-service-type
+ home-znc-services)))
+ (description
+ "Install and configure @command{znc} as a Shepherd service.")))
diff --git a/gnu/local.mk b/gnu/local.mk
index e286e0b076..62461fa26d 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>
@@ -91,6 +91,7 @@ GNU_SYSTEM_MODULES = \
%D%/home/services/symlink-manager.scm \
%D%/home/services/fontutils.scm \
%D%/home/services/guix.scm \
+ %D%/home/services/messaging.scm \
%D%/home/services/pm.scm \
%D%/home/services/shells.scm \
%D%/home/services/shepherd.scm \
--
2.39.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
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 ` Ludovic Courtès
2023-03-16 14:06 ` Janneke Nieuwenhuizen
0 siblings, 1 reply; 38+ messages in thread
From: Ludovic Courtès @ 2023-03-16 11:01 UTC (permalink / raw)
To: Janneke Nieuwenhuizen; +Cc: 61483
[-- Attachment #1: Type: text/plain, Size: 334 bytes --]
Janneke Nieuwenhuizen <janneke@gnu.org> skribis:
> From: "Janneke Nieuwenhuizen" <janneke@gnu.org>
>
> * gnu/home/services/messaging.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
> * doc/guix.texi (Messaging Home Services): Document it in new subsection.
Applied with the minor changes below.
Ludo’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 947 bytes --]
diff --git a/gnu/home/services/messaging.scm b/gnu/home/services/messaging.scm
index 2988b52ad2..d403b84ac9 100644
--- a/gnu/home/services/messaging.scm
+++ b/gnu/home/services/messaging.scm
@@ -69,4 +69,5 @@ (define home-znc-service-type
(list (service-extension home-shepherd-service-type
home-znc-services)))
(description
- "Install and configure @command{znc} as a Shepherd service.")))
+ "Install and configure @command{znc}, an @acronym{IRC, Internet Relay
+Chat} bouncer, as a Shepherd service.")))
diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in
index 7009fc756c..c71a6ca857 100644
--- a/po/guix/POTFILES.in
+++ b/po/guix/POTFILES.in
@@ -13,6 +13,7 @@ gnu/services/shepherd.scm
gnu/services/samba.scm
gnu/services/version-control.scm
gnu/home/services.scm
+gnu/home/services/messaging.scm
gnu/home/services/ssh.scm
gnu/home/services/symlink-manager.scm
gnu/system/file-systems.scm
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH v3 3/3] gnu: home: services: Add home-kodi-service-type.
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-05 18:13 ` Janneke Nieuwenhuizen
2023-03-16 11:04 ` [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services Ludovic Courtès
2023-03-16 11:01 ` Ludovic Courtès
2 siblings, 1 reply; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-03-05 18:13 UTC (permalink / raw)
To: 61483; +Cc: Janneke Nieuwenhuizen
From: "Janneke Nieuwenhuizen" <janneke@gnu.org>
* gnu/home/services/media.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
* doc/guix.texi (Media Home Services): Document it in new subsection.
---
doc/guix.texi | 37 +++++++++++++++++++
gnu/home/services/media.scm | 73 +++++++++++++++++++++++++++++++++++++
gnu/local.mk | 1 +
3 files changed, 111 insertions(+)
create mode 100644 gnu/home/services/media.scm
diff --git a/doc/guix.texi b/doc/guix.texi
index 3ea7f4e470..0578e01f5a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41689,6 +41689,7 @@ services)}.
* Guix: Guix Home Services. Services for Guix.
* Fonts: Fonts Home Services. Services for managing User's fonts.
* Messaging: Messaging Home Services. Services for managing messaging.
+* Media: Media Home Services. Services for managing media.
@end menu
@c In addition to that Home Services can provide
@@ -42692,6 +42693,42 @@ znc} for more information.
@end table
@end deftp
+@node Media Home Services
+@subsection Media Home Services
+
+@cindex kodi
+The @uref{https://kodi.tv, KODI media center} can be run as a daemon on
+a media server. With the @code{(gnu home services kodi)} service, you
+can configure KODI to run upon login.
+
+Here is an example of a service and its configuration that you could add
+to the @code{services} field of your @code{home-environment}:
+
+@lisp
+(service home-kodi-service-type
+ (home-kodi-configuration
+ (extra-options '("--settings="<settings-file>"))))
+@end lisp
+
+@defvr {Scheme Variable} home-kodi-service-type
+This is the type of the @code{git daemon} home service, whose value is an
+@code{home-kodi-configuration} object.
+@end defvr
+
+@deftp {Data Type} home-kodi-configuration
+Available @code{home-kodi-configuration} fields are:
+
+@table @asis
+@item @code{git} (default: @code{git}) (type: file-like)
+The git package to use.
+
+@item @code{extra-options} (default: @code{'()})
+Extra options will be passed to @command{kodi}, please run @command{man
+kodi} for more information.
+
+@end table
+@end deftp
+
@node Invoking guix home
@section Invoking @command{guix home}
diff --git a/gnu/home/services/media.scm b/gnu/home/services/media.scm
new file mode 100644
index 0000000000..48d7ccf67a
--- /dev/null
+++ b/gnu/home/services/media.scm
@@ -0,0 +1,73 @@
+;;; 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 media)
+ #: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 kodi)
+ #:use-module (gnu services configuration)
+ #:use-module (gnu services shepherd)
+ #:use-module (guix records)
+ #:use-module (guix gexp)
+
+ #:export (home-kodi-configuration
+ home-kodi-service-type))
+
+;;;
+;;; Kodi.
+;;;
+(define-record-type* <home-kodi-configuration>
+ home-kodi-configuration make-home-kodi-configuration
+ home-kodi-configuration?
+ (kodi home-kodi-kodi ;file-like
+ (default kodi))
+ (extra-options home-kodi-extra-options ;list of string
+ (default '())))
+
+(define (home-kodi-services config)
+ "Return a <shepherd-service> for kodi with CONFIG."
+ (match config
+ (($ <home-kodi-configuration> kodi extra-options)
+ (let* ((kodi (file-append kodi "/bin/kodi"))
+ (command `(kodi
+ "-fs"
+ ,@extra-options))
+ (log-file (string-append %user-log-dir "/kodi.log")))
+ (list (shepherd-service
+ (documentation "Run the kodi media center.")
+ (provision '(kodi))
+ (start #~(make-forkexec-constructor '#$command
+ #:log-file #$log-file))
+ (stop #~(make-kill-destructor))))))))
+
+(define home-kodi-service-type
+ (service-type
+ (name 'home-kodi)
+ (default-value (home-kodi-configuration))
+ (extensions
+ (list (service-extension home-shepherd-service-type
+ home-kodi-services)))
+ (description
+ "Install and configure the Kodi media center so that it runs as a Shepherd
+service.")))
diff --git a/gnu/local.mk b/gnu/local.mk
index 62461fa26d..9b4cfe0a89 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -91,6 +91,7 @@ GNU_SYSTEM_MODULES = \
%D%/home/services/symlink-manager.scm \
%D%/home/services/fontutils.scm \
%D%/home/services/guix.scm \
+ %D%/home/services/media.scm \
%D%/home/services/messaging.scm \
%D%/home/services/pm.scm \
%D%/home/services/shells.scm \
--
2.39.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
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 ` Ludovic Courtès
2023-03-16 14:07 ` Jan Nieuwenhuizen
0 siblings, 1 reply; 38+ messages in thread
From: Ludovic Courtès @ 2023-03-16 11:04 UTC (permalink / raw)
To: Janneke Nieuwenhuizen; +Cc: 61483
Janneke Nieuwenhuizen <janneke@gnu.org> skribis:
> From: "Janneke Nieuwenhuizen" <janneke@gnu.org>
>
> * gnu/home/services/media.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
> * doc/guix.texi (Media Home Services): Document it in new subsection.
Please also add the new file to ‘po/guix/POTFILES.in’ so descriptions
can be translated. Otherwise LGTM!
In the meantime I realized I don’t have to push it on your behalf, so
I’ll let you take care of it—sorry for the confusion!
Thank you,
Ludo’.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
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
0 siblings, 1 reply; 38+ messages in thread
From: Jan Nieuwenhuizen @ 2023-03-16 14:07 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 61483
Ludovic Courtès writes:
> Janneke Nieuwenhuizen <janneke@gnu.org> skribis:
>
>> From: "Janneke Nieuwenhuizen" <janneke@gnu.org>
>>
>> * gnu/home/services/media.scm: New file.
>> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
>> * doc/guix.texi (Media Home Services): Document it in new subsection.
>
> Please also add the new file to ‘po/guix/POTFILES.in’ so descriptions
> can be translated. Otherwise LGTM!
Great, done.
> In the meantime I realized I don’t have to push it on your behalf, so
> I’ll let you take care of it—sorry for the confusion!
Thanks, pushed to master as
70056b1b2beebbc9f8ea2c34eacc57f379368ab3
Greetings,
Janneke
--
Janneke Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
2023-03-16 14:07 ` Jan Nieuwenhuizen
@ 2023-03-16 15:21 ` Jannneke Nieuwenhuizen
2023-03-16 16:16 ` Ludovic Courtès
0 siblings, 1 reply; 38+ messages in thread
From: Jannneke Nieuwenhuizen @ 2023-03-16 15:21 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 61483
[-- Attachment #1: Type: text/plain, Size: 1604 bytes --]
Jan Nieuwenhuizen writes:
> Ludovic Courtès writes:
>
>> Janneke Nieuwenhuizen <janneke@gnu.org> skribis:
>>
>>> From: "Janneke Nieuwenhuizen" <janneke@gnu.org>
>>>
>>> * gnu/home/services/media.scm: New file.
>>> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
>>> * doc/guix.texi (Media Home Services): Document it in new subsection.
>>
>> Please also add the new file to ‘po/guix/POTFILES.in’ so descriptions
>> can be translated. Otherwise LGTM!
>
> Great, done.
>
>> In the meantime I realized I don’t have to push it on your behalf, so
>> I’ll let you take care of it—sorry for the confusion!
>
> Thanks, pushed to master as
>
> 70056b1b2beebbc9f8ea2c34eacc57f379368ab3
Well, it seems I added a dependency to the shepherd, module (shepherd
support), for things like
%user-runtime-dir
I locally applied the attached patch to add Shepherd as an input (not
sure if that would be OK), but now `make update-guix-package' fails:
--8<---------------cut here---------------start------------->8---
$ make update-guix-package
git rev-parse HEAD
bd086f1718123a4d180aa6f2178828a83025ab35
./pre-inst-env "/gnu/store/f4w31qrim35yfnppacfmig491x1nwi3x-profile/bin/guile" \
./build-aux/update-guix-package.scm \
"`git rev-parse HEAD`"
error: Failed to find the origin git remote.
make: *** [Makefile:7178: update-guix-package] Error 1
--8<---------------cut here---------------end--------------->8---
Not sure what to do, possibly best to revert the home services patches
again until we have (consensus on a) fix.
Greetings,
Janneke
[-- Attachment #2: 0001-gnu-guix-Add-shepherd-as-input-dependency.patch --]
[-- Type: text/x-patch, Size: 2046 bytes --]
From bd086f1718123a4d180aa6f2178828a83025ab35 Mon Sep 17 00:00:00 2001
From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
Date: Thu, 16 Mar 2023 16:08:01 +0100
Subject: [PATCH] gnu: guix: Add shepherd as input dependency.
The home services depend on (shepherd support).
* gnu/packages/package-management.scm (guix)[inputs]: Add shepherd-0.9.
---
gnu/packages/package-management.scm | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index d27c8a91ef..8a05955d1a 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -12,7 +12,7 @@
;;; Copyright © 2019-2023 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2019 Jonathan Brielmaier <jonathan.brielmaier@web.de>
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
-;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2020, 2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
;;; Copyright © 2020 Jesse Gibbons <jgibbons2357+guix@gmail.com>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
@@ -41,6 +41,7 @@ (define-module (gnu packages package-management)
#:use-module (gnu artwork)
#:use-module (gnu packages)
#:use-module (gnu packages acl)
+ #:use-module (gnu packages admin)
#:use-module (gnu packages attr)
#:use-module (gnu packages avahi)
#:use-module (gnu packages autotools)
@@ -462,7 +463,8 @@ (define code
("disarchive" ,disarchive) ;for 'guix perform-download'
("guile-lzma" ,guile-lzma) ;for Disarchive
- ("glibc-utf8-locales" ,glibc-utf8-locales)))
+ ("glibc-utf8-locales" ,glibc-utf8-locales)
+ ("shepherd" ,shepherd-0.9)))
(propagated-inputs
`(("guile-gnutls" ,guile-gnutls)
;; Avahi requires "glib" which doesn't cross-compile yet.
--
2.39.1
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
--
Janneke Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
2023-03-16 15:21 ` Jannneke Nieuwenhuizen
@ 2023-03-16 16:16 ` Ludovic Courtès
2023-03-17 11:57 ` Janneke Nieuwenhuizen
0 siblings, 1 reply; 38+ messages in thread
From: Ludovic Courtès @ 2023-03-16 16:16 UTC (permalink / raw)
To: Jannneke Nieuwenhuizen; +Cc: 61483
Hi again,
Jannneke Nieuwenhuizen <janneke@gnu.org> skribis:
>>> In the meantime I realized I don’t have to push it on your behalf, so
>>> I’ll let you take care of it—sorry for the confusion!
>>
>> Thanks, pushed to master as
>>
>> 70056b1b2beebbc9f8ea2c34eacc57f379368ab3
>
> Well, it seems I added a dependency to the shepherd, module (shepherd
> support), for things like
>
> %user-runtime-dir
I pushed a fix as be7e2bf7ebc10bb4e5808ddeabc4b914f575865f, tested with
‘guix home container’.
> I locally applied the attached patch to add Shepherd as an input (not
> sure if that would be OK), but now `make update-guix-package' fails:
Guix in general on the “host side” should not depend on the Shepherd,
there’s no reason to do so.
The solution for Home or System services is to depend on the Shepherd
but only in the run-time code stage. This is what I did in
be7e2bf7ebc10bb4e5808ddeabc4b914f575865f: code that needs to refer to
‘%user-runtime-dir’ is staged such that it will look up that variable at
run time, when the user ‘shepherd’ process is started.
That’s really what we want here, because it also ensures that the code
sees the right value for ‘%user-runtime-dir’ (otherwise it would see the
configuration-time value, which could be different).
Apologies for overlooking that!
Ludo’.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
2023-03-16 16:16 ` Ludovic Courtès
@ 2023-03-17 11:57 ` Janneke Nieuwenhuizen
0 siblings, 0 replies; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-03-17 11:57 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 61483
Ludovic Courtès writes:
Hello,
> Jannneke Nieuwenhuizen <janneke@gnu.org> skribis:
>
[..]
>> Well, it seems I added a dependency to the shepherd, module (shepherd
>> support), for things like
>>
>> %user-runtime-dir
>
> I pushed a fix as be7e2bf7ebc10bb4e5808ddeabc4b914f575865f, tested with
> ‘guix home container’.
Thank you!
>> I locally applied the attached patch to add Shepherd as an input (not
>> sure if that would be OK), but now `make update-guix-package' fails:
>
> Guix in general on the “host side” should not depend on the Shepherd,
> there’s no reason to do so.
>
> The solution for Home or System services is to depend on the Shepherd
> but only in the run-time code stage. This is what I did in
> be7e2bf7ebc10bb4e5808ddeabc4b914f575865f: code that needs to refer to
> ‘%user-runtime-dir’ is staged such that it will look up that variable at
> run time, when the user ‘shepherd’ process is started.
Oh, that's so nice!
> That’s really what we want here, because it also ensures that the code
> sees the right value for ‘%user-runtime-dir’ (otherwise it would see the
> configuration-time value, which could be different).
>
> Apologies for overlooking that!
Well, I also failed to see that I pulled in the Shepherd as a dependency
until sarg "complained" about a missing file on IRC. Simply copied this
from my direct Shepherd solution, ugh. Sorry!
Greetings,
Janneke
--
Janneke Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
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-05 18:13 ` [bug#61483] [PATCH v3 3/3] gnu: home: services: Add home-kodi-service-type Janneke Nieuwenhuizen
@ 2023-03-16 11:01 ` Ludovic Courtès
2023-03-16 14:08 ` Janneke Nieuwenhuizen
2 siblings, 1 reply; 38+ messages in thread
From: Ludovic Courtès @ 2023-03-16 11:01 UTC (permalink / raw)
To: Janneke Nieuwenhuizen; +Cc: 61483
Hi,
Janneke Nieuwenhuizen <janneke@gnu.org> skribis:
> From: "Janneke Nieuwenhuizen" <janneke@gnu.org>
>
> * gnu/home/services/ssh.scm: (<home-ssh-agent-configuration>): New type.
> (home-ssh-agent-services): New procedure.
> (home-ssh-agent-service-type): New variable.
> * doc/guix.texi (Secure Shell): Document it.
Applied!
> +When using the @code{home-ssh-agent-service-type}, you need to add your
> +@file{~/.bash_profile}:
> +
> +@example
> +SSH_AUTH_SOCK=$@{XDG_RUNTIME_DIR-$HOME/.cache@}/ssh-agent/socket
> +export SSH_AUTH_SOCK
> +@end example
> +
> +Of course, you can do that using the @code{home-bash-service-type}, by
> +adding something like:
> +
> +@lisp
> +(environment-variables
> + '(("SSH_AUTH_SOCK"
> + . "$@{SSH_AUTH_SOCK-$@{XDG_RUNTIME_DIR-$HOME/.cache@}/ssh-agent/socket@}")))
> +@end lisp
Maybe we should automate that by having ‘home-ssh-agent-service-type’
extend ‘home-environment-variables-service-type’? That way it’d work
out-of-the-box regardless of the shell being used.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
2023-03-16 11:01 ` Ludovic Courtès
@ 2023-03-16 14:08 ` Janneke Nieuwenhuizen
2023-03-17 11:53 ` bug#61483: " Janneke Nieuwenhuizen
0 siblings, 1 reply; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-03-16 14:08 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 61483
Ludovic Courtès writes:
Hi,
> Janneke Nieuwenhuizen <janneke@gnu.org> skribis:
>
>> +@lisp
>> +(environment-variables
>> + '(("SSH_AUTH_SOCK"
>> + . "$@{SSH_AUTH_SOCK-$@{XDG_RUNTIME_DIR-$HOME/.cache@}/ssh-agent/socket@}")))
>> +@end lisp
>
> Maybe we should automate that by having ‘home-ssh-agent-service-type’
> extend ‘home-environment-variables-service-type’? That way it’d work
> out-of-the-box regardless of the shell being used.
Oh that's a neat idea! Someone will have to figure out how to do that,
later.
Greetings,
Janneke
--
Janneke Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
^ permalink raw reply [flat|nested] 38+ messages in thread
* bug#61483: [PATCH 0/5] Some basic Home Shepherd Services
2023-03-16 14:08 ` Janneke Nieuwenhuizen
@ 2023-03-17 11:53 ` Janneke Nieuwenhuizen
2023-03-17 21:07 ` [bug#61483] " Ludovic Courtès
0 siblings, 1 reply; 38+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-03-17 11:53 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 61483-done
[-- Attachment #1: Type: text/plain, Size: 843 bytes --]
Janneke Nieuwenhuizen writes:
Hi!
> Ludovic Courtès writes:
>
> Hi,
>
>> Janneke Nieuwenhuizen <janneke@gnu.org> skribis:
>>
>>> +@lisp
>>> +(environment-variables
>>> + '(("SSH_AUTH_SOCK"
>>> + . "$@{SSH_AUTH_SOCK-$@{XDG_RUNTIME_DIR-$HOME/.cache@}/ssh-agent/socket@}")))
>>> +@end lisp
>>
>> Maybe we should automate that by having ‘home-ssh-agent-service-type’
>> extend ‘home-environment-variables-service-type’? That way it’d work
>> out-of-the-box regardless of the shell being used.
>
> Oh that's a neat idea! Someone will have to figure out how to do that,
> later.
I've pushed the attached patch to take care of this. Pretty neat!
Closing this bug now, if we want to address the git-daemon "transform"
and #:user "git-daemon" issue better to open a new bug report.
Greetings,
Janneke
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-home-services-ssh-agent-Handle-setting-of-SSH_AUTH_S.patch --]
[-- Type: text/x-patch, Size: 2642 bytes --]
From 2714c9ef2d6cb42f15c2f284449f602467f0d1c0 Mon Sep 17 00:00:00 2001
From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
Date: Fri, 17 Mar 2023 12:40:16 +0100
Subject: [PATCH] home: services: ssh-agent: Handle setting of SSH_AUTH_SOCK.
* gnu/home/services/ssh.scm (home-ssh-agent-environment-variables): New
procedure.
(home-ssh-agent-service-type): Use it as ahome-environment-service type
extension.
* doc/guix.texi (Secure Shell): Remove advice about, and examples of setting
SSH_AUTH_SOCK.
---
doc/guix.texi | 17 -----------------
gnu/home/services/ssh.scm | 8 +++++++-
2 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 4807f16c0a..2d42ca8de2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -42473,23 +42473,6 @@ machines using the @acronym{SSH, secure shell} protocol. With the
@code{(gnu home services ssh-agent)} service, you can configure the
OpenSSH ssh-agent to run upon login.
-When using the @code{home-ssh-agent-service-type}, you need to add your
-@file{~/.bash_profile}:
-
-@example
-SSH_AUTH_SOCK=$@{XDG_RUNTIME_DIR-$HOME/.cache@}/ssh-agent/socket
-export SSH_AUTH_SOCK
-@end example
-
-Of course, you can do that using the @code{home-bash-service-type}, by
-adding something like:
-
-@lisp
-(environment-variables
- '(("SSH_AUTH_SOCK"
- . "$@{SSH_AUTH_SOCK-$@{XDG_RUNTIME_DIR-$HOME/.cache@}/ssh-agent/socket@}")))
-@end lisp
-
Here is an example of a service and its configuration that you could add
to the @code{services} field of your @code{home-environment}:
diff --git a/gnu/home/services/ssh.scm b/gnu/home/services/ssh.scm
index dc37ecf329..01917a29cd 100644
--- a/gnu/home/services/ssh.scm
+++ b/gnu/home/services/ssh.scm
@@ -295,12 +295,18 @@ (define (home-ssh-agent-services config)
(fork+exec-command #$command #:log-file #$log-file)))
(stop #~(make-kill-destructor)))))))
+(define (home-ssh-agent-environment-variables config)
+ '(("SSH_AUTH_SOCK"
+ . "${SSH_AUTH_SOCK-${XDG_RUNTIME_DIR-$HOME/.cache}/ssh-agent/socket}")))
+
(define home-ssh-agent-service-type
(service-type
(name 'home-ssh-agent)
(default-value (home-ssh-agent-configuration))
(extensions
(list (service-extension home-shepherd-service-type
- home-ssh-agent-services)))
+ home-ssh-agent-services)
+ (service-extension home-environment-variables-service-type
+ home-ssh-agent-environment-variables)))
(description
"Install and configure @command{ssh-agent} as a Shepherd service.")))
--
2.39.1
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
--
Janneke Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [bug#61483] [PATCH 0/5] Some basic Home Shepherd Services
2023-03-17 11:53 ` bug#61483: " Janneke Nieuwenhuizen
@ 2023-03-17 21:07 ` Ludovic Courtès
0 siblings, 0 replies; 38+ messages in thread
From: Ludovic Courtès @ 2023-03-17 21:07 UTC (permalink / raw)
To: Janneke Nieuwenhuizen; +Cc: 61483-done
Howdy,
Janneke Nieuwenhuizen <janneke@gnu.org> skribis:
> From 2714c9ef2d6cb42f15c2f284449f602467f0d1c0 Mon Sep 17 00:00:00 2001
> From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
> Date: Fri, 17 Mar 2023 12:40:16 +0100
> Subject: [PATCH] home: services: ssh-agent: Handle setting of SSH_AUTH_SOCK.
>
> * gnu/home/services/ssh.scm (home-ssh-agent-environment-variables): New
> procedure.
> (home-ssh-agent-service-type): Use it as ahome-environment-service type
> extension.
> * doc/guix.texi (Secure Shell): Remove advice about, and examples of setting
> SSH_AUTH_SOCK.
Excellent, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 38+ messages in thread