unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Kjartan Oli Agustsson <kjartanoli@outlook.com>
To: 69422@debbugs.gnu.org
Cc: "Kjartan Oli Agustsson" <kjartanoli@outlook.com>
Subject: [bug#69422] [PATCH] home: services: Add home-shell-authorized-directories-service-type
Date: Tue, 27 Feb 2024 10:34:14 +0000	[thread overview]
Message-ID: <AS8PR02MB7173CCAADC0A83791089A337DF592@AS8PR02MB7173.eurprd02.prod.outlook.com> (raw)

home: services: Add home-shell-authorized-directories-service-type.

* gnu/home/services/guix.scm (home-shell-authorized-directories-service-type):
  New variable.
* doc/guix.texi (Guix Home Services): Document it.

Change-Id: I3501233c79e25ceaedf981acc5805e660b52a419
---
 doc/guix.texi              | 18 ++++++++++++++++++
 gnu/home/services/guix.scm | 23 ++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 671cdab6f8..c19f30354b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -45726,6 +45726,24 @@ Guix Home Services
 @end lisp
 @end defvar
 
+@defvar home-shell-authorized-directories-service-type
+This is the service type for managing
+@file{$XDG_CONFIG_HOME/guix/shell-authorized-directories}, the file that
+controls the loading of @file{manifest.scm} and @file{guix.scm} files by
+@command{guix shell} (@pxref{Invoking guix shell}).  Its associated
+value is a list of strings, each of which corresponds to the path of a
+directory @command{guix shell} is authorized to load @file{manifest.scm}
+and @file{guix.scm} files in.
+
+A typical extension for authorizing a directory might look like this:
+
+@lisp
+(simple-service 'authorised-direcotries
+       home-shell-authorized-directories-service-type
+     (list "~/guix" "some/other/project/"))
+@end lisp
+@end defvar
+
 @node Fonts Home Services
 @subsection Fonts Home Services
 
diff --git a/gnu/home/services/guix.scm b/gnu/home/services/guix.scm
index 819b20b6c9..49265a1c45 100644
--- a/gnu/home/services/guix.scm
+++ b/gnu/home/services/guix.scm
@@ -22,7 +22,9 @@ (define-module (gnu home services guix)
   #:use-module (guix gexp)
   #:use-module (ice-9 pretty-print)
   #:use-module (srfi srfi-1)
-  #:export (home-channels-service-type))
+  #:use-module (srfi srfi-26)
+  #:export (home-channels-service-type
+            home-shell-authorized-directories-service-type))
 
 (define (channels-xdg-files channels)
   `(("guix/channels.scm"
@@ -42,3 +44,22 @@ (define home-channels-service-type
     (list (service-extension home-xdg-configuration-files-service-type
                              channels-xdg-files)))
    (description "Manages the per-user Guix channels specification.")))
+
+(define (shell-authorized-directories-files directories)
+  `(("guix/shell-authorized-directories"
+     ,(plain-file
+       "shell-authorized-directories"
+       (call-with-output-string
+         (lambda (port)
+           (map (cut format port "~a~%" <>) directories)))))))
+
+(define home-shell-authorized-directories-service-type
+  (service-type
+   (name 'shell-authorized-directories)
+   (default-value '())
+   (compose concatenate)
+   (extend append)
+   (extensions
+    (list (service-extension home-xdg-configuration-files-service-type
+                             shell-authorized-directories-files)))
+   (description "Manages guix shell authorized directories.")))

base-commit: de24aaf13b17d6c019f3f240fd0eb0e1b8654970
-- 
2.41.0





                 reply	other threads:[~2024-02-27 10:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8PR02MB7173CCAADC0A83791089A337DF592@AS8PR02MB7173.eurprd02.prod.outlook.com \
    --to=kjartanoli@outlook.com \
    --cc=69422@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).