Package: guix-patches;
Reported by: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org>
Date: Mon, 13 Feb 2023 16:47:01 UTC
Severity: normal
Tags: patch
Done: Janneke Nieuwenhuizen <janneke <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61483 in the body.
You can then email your comments to 61483 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Mon, 13 Feb 2023 16:47:02 GMT) Full text and rfc822 format available."Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org>
:guix-patches <at> gnu.org
.
(Mon, 13 Feb 2023 16:47:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org> To: guix-patches <at> gnu.org Cc: Janneke Nieuwenhuizen <janneke <at> gnu.org> Subject: [PATCH 0/5] Some basic Home Shepherd Services Date: Mon, 13 Feb 2023 17:46:42 +0100
From: "Janneke Nieuwenhuizen" <janneke <at> gnu.org> Hi! 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? 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. To add a git-daemon and ssh-agent to your guix home profile, you need a home-configuration.scm that has something like this: --8<---------------cut here---------------start------------->8--- (use-modules (gnu home) (gnu home services shells) (gnu home services shepherd) (gnu home services shepherd-xyz) (gnu packages) (gnu packages base) (gnu services) (guix gexp)) (services (list (service home-shepherd-service-type) (service home-git-daemon-service-type) (service home-ssh-agent-service-type))) --8<---------------cut here---------------end--------------->8--- 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? Greetings, Janneke Also pushed to https://gitlab.com/janneke/guix/-/commits/wip-home/ Janneke Nieuwenhuizen (5): DRAFT gnu: home: services: Add home-git-daemon-service-type. DRAFT gnu: home: services: Add home-ssh-agent-service-type. DRAFT gnu: home: services: Add home-znc-service-type. DRAFT gnu: home: services: Add home-kodi-service-type. DRAFT doc: Document Home Shepherd Services. doc/guix.texi | 90 ++++++++++- gnu/home/services/shepherd-xyz.scm | 239 +++++++++++++++++++++++++++++ gnu/local.mk | 3 +- 3 files changed, 330 insertions(+), 2 deletions(-) create mode 100644 gnu/home/services/shepherd-xyz.scm -- 2.38.1
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Mon, 13 Feb 2023 16:52:01 GMT) Full text and rfc822 format available.Message #8 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Cc: Janneke Nieuwenhuizen <janneke <at> gnu.org> Subject: [PATCH 3/5] DRAFT gnu: home: services: Add home-znc-service-type. Date: Mon, 13 Feb 2023 17:50:55 +0100
From: "Janneke Nieuwenhuizen" <janneke <at> 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."))) + + +;;; +;;; 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
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Mon, 13 Feb 2023 16:52:02 GMT) Full text and rfc822 format available.Message #11 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Cc: Janneke Nieuwenhuizen <janneke <at> gnu.org> Subject: [PATCH 2/5] DRAFT gnu: home: services: Add home-ssh-agent-service-type. Date: Mon, 13 Feb 2023 17:50:54 +0100
From: "Janneke Nieuwenhuizen" <janneke <at> 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."))) + + +;;; +;;; 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
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Mon, 13 Feb 2023 16:52:02 GMT) Full text and rfc822 format available.Message #14 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Cc: Janneke Nieuwenhuizen <janneke <at> gnu.org> Subject: [PATCH 4/5] DRAFT gnu: home: services: Add home-kodi-service-type. Date: Mon, 13 Feb 2023 17:50:56 +0100
From: "Janneke Nieuwenhuizen" <janneke <at> 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."))) + +;;; +;;; 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."))) + ;;; ;;; Ssh-agent. -- 2.38.1
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Mon, 13 Feb 2023 16:52:02 GMT) Full text and rfc822 format available.Message #17 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Cc: Janneke Nieuwenhuizen <janneke <at> gnu.org> Subject: [PATCH 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type. Date: Mon, 13 Feb 2023 17:50:53 +0100
From: "Janneke Nieuwenhuizen" <janneke <at> 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 <at> 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")) + + +;;; +;;; 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 <at> gmail.com> # Copyright © 2016, 2017, 2018, 2019 Alex Vong <alexvong1995 <at> gmail.com> # Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Efraim Flashner <efraim <at> flashner.co.il> -# Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> +# Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> # Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me <at> tobias.gr> # Copyright © 2017, 2018 Clément Lassieur <clement <at> lassieur.org> # Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe <at> 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
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Mon, 13 Feb 2023 16:52:03 GMT) Full text and rfc822 format available.Message #20 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Cc: Janneke Nieuwenhuizen <janneke <at> gnu.org> Subject: [PATCH 5/5] DRAFT doc: Document Home Shepherd Services. Date: Mon, 13 Feb 2023 17:50:57 +0100
From: "Janneke Nieuwenhuizen" <janneke <at> 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
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Tue, 14 Feb 2023 13:46:02 GMT) Full text and rfc822 format available.Message #23 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Bruno Victal <mirai <at> makinata.eu> To: Janneke Nieuwenhuizen <janneke <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: [bug#61483] [PATCH 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type. Date: Tue, 14 Feb 2023 13:45:16 +0000
Hi, Have you tried using (non-home) git-daemon-service-type as a home service? I think it should work. Cheers, Bruno
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Tue, 14 Feb 2023 15:15:02 GMT) Full text and rfc822 format available.Message #26 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Tue, 14 Feb 2023 16:14:39 +0100
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 <at> gnu.org> | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Tue, 14 Feb 2023 15:19:02 GMT) Full text and rfc822 format available.Message #29 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Jan Nieuwenhuizen <janneke <at> gnu.org> To: Bruno Victal <mirai <at> makinata.eu> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Tue, 14 Feb 2023 16:17:55 +0100
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 <at> gnu.org> | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Thu, 16 Feb 2023 15:55:01 GMT) Full text and rfc822 format available.Message #32 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Subject: [PATCH v2 1/5] DRAFT gnu: home: services: Add home-git-daemon-service-type. Date: Thu, 16 Feb 2023 16:53:51 +0100
* 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 <at> 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")))) + + +;;; +;;; 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 <at> gmail.com> # Copyright © 2016, 2017, 2018, 2019 Alex Vong <alexvong1995 <at> gmail.com> # Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Efraim Flashner <efraim <at> flashner.co.il> -# Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> +# Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> # Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me <at> tobias.gr> # Copyright © 2017, 2018 Clément Lassieur <clement <at> lassieur.org> # Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe <at> 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
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Thu, 16 Feb 2023 15:55:02 GMT) Full text and rfc822 format available.Message #35 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Subject: [PATCH v2 3/5] DRAFT gnu: home: services: Add home-znc-service-type. Date: Thu, 16 Feb 2023 16:53:53 +0100
* 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."))) + + +;;; +;;; 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
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Thu, 16 Feb 2023 15:55:02 GMT) Full text and rfc822 format available.Message #38 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Subject: [PATCH v2 2/5] DRAFT gnu: home: services: Add home-ssh-agent-service-type. Date: Thu, 16 Feb 2023 16:53:52 +0100
* 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."))) + + +;;; +;;; 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
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Thu, 16 Feb 2023 15:55:03 GMT) Full text and rfc822 format available.Message #41 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Subject: [PATCH v2 4/5] DRAFT gnu: home: services: Add home-kodi-service-type. Date: Thu, 16 Feb 2023 16:53:54 +0100
* 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."))) + +;;; +;;; 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."))) + ;;; ;;; Ssh-agent. -- 2.38.1
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Thu, 16 Feb 2023 15:55:03 GMT) Full text and rfc822 format available.Message #44 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Subject: [PATCH v2 5/5] DRAFT doc: Document Home Shepherd Services. Date: Thu, 16 Feb 2023 16:53:55 +0100
* 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
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Sat, 04 Mar 2023 17:02:01 GMT) Full text and rfc822 format available.Message #47 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Sat, 04 Mar 2023 18:01:04 +0100
Howdy! "Jan (janneke) Nieuwenhuizen" <janneke <at> 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’.
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Sat, 04 Mar 2023 17:06:01 GMT) Full text and rfc822 format available.Message #50 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Sat, 04 Mar 2023 18:05:02 +0100
"Jan (janneke) Nieuwenhuizen" <janneke <at> 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’.
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Sat, 04 Mar 2023 17:07:02 GMT) Full text and rfc822 format available.Message #53 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Sat, 04 Mar 2023 18:06:27 +0100
"Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org> skribis: > * gnu/home/services/shepherd-xyz.scm > (<home-znc-configuration>): New type. > (home-znc-services): New procedure. > (home-znc-service-type): New variable. I’d make it ‘messaging.scm’. With that an entry in the manual, it will be ready to go! Ludo’.
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Sat, 04 Mar 2023 17:09:02 GMT) Full text and rfc822 format available.Message #56 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Sat, 04 Mar 2023 18:08:09 +0100
"Jan (janneke) Nieuwenhuizen" <janneke <at> 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!
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Sat, 04 Mar 2023 17:11:01 GMT) Full text and rfc822 format available.Message #59 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Sat, 04 Mar 2023 18:10:19 +0100
"Jan (janneke) Nieuwenhuizen" <janneke <at> 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!
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Sat, 04 Mar 2023 17:15:01 GMT) Full text and rfc822 format available.Message #62 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: "Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Sat, 04 Mar 2023 18:14:28 +0100
"Jan (janneke) Nieuwenhuizen" <janneke <at> 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’.
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Sun, 05 Mar 2023 17:42:02 GMT) Full text and rfc822 format available.Message #65 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Sun, 05 Mar 2023 18:41:07 +0100
Ludovic Courtès writes: > "Jan (janneke) Nieuwenhuizen" <janneke <at> 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 <at> gnu.org> | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Sun, 05 Mar 2023 18:10:02 GMT) Full text and rfc822 format available.Message #68 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Sun, 05 Mar 2023 19:09:31 +0100
Ludovic Courtès writes: > "Jan (janneke) Nieuwenhuizen" <janneke <at> 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 <at> gnu.org> | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Sun, 05 Mar 2023 18:12:02 GMT) Full text and rfc822 format available.Message #71 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Sun, 05 Mar 2023 19:11:24 +0100
Ludovic Courtès writes: > "Jan (janneke) Nieuwenhuizen" <janneke <at> 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’? Check. >> + (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.” Done. -- Janneke Nieuwenhuizen <janneke <at> gnu.org> | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Sun, 05 Mar 2023 18:14:01 GMT) Full text and rfc822 format available.Message #74 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Cc: Janneke Nieuwenhuizen <janneke <at> gnu.org> Subject: [PATCH v3 1/3] gnu: home: services: Add home-ssh-agent-service-type. Date: Sun, 5 Mar 2023 19:13:03 +0100
From: "Janneke Nieuwenhuizen" <janneke <at> 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 <at> gnu.org> +;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke <at> 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)))) + + +;;; +;;; 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
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Sun, 05 Mar 2023 18:14:02 GMT) Full text and rfc822 format available.Message #77 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Cc: Janneke Nieuwenhuizen <janneke <at> gnu.org> Subject: [PATCH v3 2/3] gnu: home: services: Add home-znc-service-type. Date: Sun, 5 Mar 2023 19:13:04 +0100
From: "Janneke Nieuwenhuizen" <janneke <at> 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 <at> 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 <at> gmail.com> # Copyright © 2016, 2017, 2018, 2019 Alex Vong <alexvong1995 <at> gmail.com> # Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Efraim Flashner <efraim <at> flashner.co.il> -# Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> +# Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> # Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me <at> tobias.gr> # Copyright © 2017, 2018 Clément Lassieur <clement <at> lassieur.org> # Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe <at> 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
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Sun, 05 Mar 2023 18:14:02 GMT) Full text and rfc822 format available.Message #80 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: 61483 <at> debbugs.gnu.org Cc: Janneke Nieuwenhuizen <janneke <at> gnu.org> Subject: [PATCH v3 3/3] gnu: home: services: Add home-kodi-service-type. Date: Sun, 5 Mar 2023 19:13:05 +0100
From: "Janneke Nieuwenhuizen" <janneke <at> 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 <at> 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
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Sun, 05 Mar 2023 18:19:02 GMT) Full text and rfc822 format available.Message #83 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Sun, 05 Mar 2023 19:18:49 +0100
Ludovic Courtès writes: Hey! > "Jan (janneke) Nieuwenhuizen" <janneke <at> 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 <at> gnu.org> | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Thu, 16 Mar 2023 11:02:02 GMT) Full text and rfc822 format available.Message #86 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Janneke Nieuwenhuizen <janneke <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Thu, 16 Mar 2023 12:01:08 +0100
Hi, Janneke Nieuwenhuizen <janneke <at> gnu.org> skribis: > From: "Janneke Nieuwenhuizen" <janneke <at> 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’.
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Thu, 16 Mar 2023 11:03:02 GMT) Full text and rfc822 format available.Message #89 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Janneke Nieuwenhuizen <janneke <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Thu, 16 Mar 2023 12:01:56 +0100
[Message part 1 (text/plain, inline)]
Janneke Nieuwenhuizen <janneke <at> gnu.org> skribis: > From: "Janneke Nieuwenhuizen" <janneke <at> 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’.
[Message part 2 (text/x-patch, inline)]
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
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Thu, 16 Mar 2023 11:05:01 GMT) Full text and rfc822 format available.Message #92 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Janneke Nieuwenhuizen <janneke <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Thu, 16 Mar 2023 12:04:07 +0100
Janneke Nieuwenhuizen <janneke <at> gnu.org> skribis: > From: "Janneke Nieuwenhuizen" <janneke <at> 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’.
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Thu, 16 Mar 2023 14:07:02 GMT) Full text and rfc822 format available.Message #95 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Thu, 16 Mar 2023 15:06:43 +0100
Ludovic Courtès writes: > Janneke Nieuwenhuizen <janneke <at> gnu.org> skribis: > >> From: "Janneke Nieuwenhuizen" <janneke <at> 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. Thanks for the changes, applied them too :-) -- Janneke Nieuwenhuizen <janneke <at> gnu.org> | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Thu, 16 Mar 2023 14:08:01 GMT) Full text and rfc822 format available.Message #98 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Jan Nieuwenhuizen <janneke <at> gnu.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Thu, 16 Mar 2023 15:07:08 +0100
Ludovic Courtès writes: > Janneke Nieuwenhuizen <janneke <at> gnu.org> skribis: > >> From: "Janneke Nieuwenhuizen" <janneke <at> 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 <at> gnu.org> | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Thu, 16 Mar 2023 14:09:01 GMT) Full text and rfc822 format available.Message #101 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Thu, 16 Mar 2023 15:08:49 +0100
Ludovic Courtès writes: Hi, > Janneke Nieuwenhuizen <janneke <at> 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 <at> gnu.org> | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Thu, 16 Mar 2023 15:22:01 GMT) Full text and rfc822 format available.Message #104 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Jannneke Nieuwenhuizen <janneke <at> gnu.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Thu, 16 Mar 2023 16:21:27 +0100
[Message part 1 (text/plain, inline)]
Jan Nieuwenhuizen writes: > Ludovic Courtès writes: > >> Janneke Nieuwenhuizen <janneke <at> gnu.org> skribis: >> >>> From: "Janneke Nieuwenhuizen" <janneke <at> 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
[0001-gnu-guix-Add-shepherd-as-input-dependency.patch (text/x-patch, inline)]
From bd086f1718123a4d180aa6f2178828a83025ab35 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" <janneke <at> 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 <at> flashner.co.il> ;;; Copyright © 2019 Jonathan Brielmaier <jonathan.brielmaier <at> web.de> ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe <at> gmail.com> -;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> +;;; Copyright © 2020, 2023 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul <at> autistici.org> ;;; Copyright © 2020 Jesse Gibbons <jgibbons2357+guix <at> gmail.com> ;;; Copyright © 2020 Martin Becze <mjbecze <at> 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
[Message part 3 (text/plain, inline)]
-- Janneke Nieuwenhuizen <janneke <at> gnu.org> | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Thu, 16 Mar 2023 16:17:02 GMT) Full text and rfc822 format available.Message #107 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Jannneke Nieuwenhuizen <janneke <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Thu, 16 Mar 2023 17:16:05 +0100
Hi again, Jannneke Nieuwenhuizen <janneke <at> 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’.
Janneke Nieuwenhuizen <janneke <at> gnu.org>
:"Jan (janneke) Nieuwenhuizen" <janneke <at> gnu.org>
:Message #112 received at 61483-done <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 61483-done <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Fri, 17 Mar 2023 12:53:35 +0100
[Message part 1 (text/plain, inline)]
Janneke Nieuwenhuizen writes: Hi! > Ludovic Courtès writes: > > Hi, > >> Janneke Nieuwenhuizen <janneke <at> 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
[0001-home-services-ssh-agent-Handle-setting-of-SSH_AUTH_S.patch (text/x-patch, inline)]
From 2714c9ef2d6cb42f15c2f284449f602467f0d1c0 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" <janneke <at> 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
[Message part 3 (text/plain, inline)]
-- Janneke Nieuwenhuizen <janneke <at> gnu.org> | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Fri, 17 Mar 2023 11:58:02 GMT) Full text and rfc822 format available.Message #115 received at 61483 <at> debbugs.gnu.org (full text, mbox):
From: Janneke Nieuwenhuizen <janneke <at> gnu.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 61483 <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Fri, 17 Mar 2023 12:57:20 +0100
Ludovic Courtès writes: Hello, > Jannneke Nieuwenhuizen <janneke <at> 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 <at> gnu.org> | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
guix-patches <at> gnu.org
:bug#61483
; Package guix-patches
.
(Fri, 17 Mar 2023 21:08:02 GMT) Full text and rfc822 format available.Message #118 received at 61483-done <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Janneke Nieuwenhuizen <janneke <at> gnu.org> Cc: 61483-done <at> debbugs.gnu.org Subject: Re: bug#61483: [PATCH 0/5] Some basic Home Shepherd Services Date: Fri, 17 Mar 2023 22:07:07 +0100
Howdy, Janneke Nieuwenhuizen <janneke <at> gnu.org> skribis: > From 2714c9ef2d6cb42f15c2f284449f602467f0d1c0 Mon Sep 17 00:00:00 2001 > From: "Jan (janneke) Nieuwenhuizen" <janneke <at> 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’.
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Sat, 15 Apr 2023 11:24:08 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.