all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 54377@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#54377] [PATCH 2/3] linux-container: Add #:guest-uid and #:guest-gid to 'eval/container'.
Date: Sun, 13 Mar 2022 22:54:53 +0100	[thread overview]
Message-ID: <20220313215454.9576-2-ludo@gnu.org> (raw)
In-Reply-To: <20220313215454.9576-1-ludo@gnu.org>

* gnu/system/linux-container.scm (eval/container): Add #:guest-uid
and #:guest-gid and honor them.
---
 gnu/system/linux-container.scm | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm
index 415d6b9775..eeb0f68c02 100644
--- a/gnu/system/linux-container.scm
+++ b/gnu/system/linux-container.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
-;;; Copyright © 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016-2017, 2019-2022 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2019 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2020 Google LLC
@@ -248,11 +248,13 @@ (define (explain pid)
 (define* (eval/container exp
                          #:key
                          (mappings '())
-                         (namespaces %namespaces))
+                         (namespaces %namespaces)
+                         (guest-uid 0) (guest-gid 0))
   "Evaluate EXP, a gexp, in a new process executing in separate namespaces as
 listed in NAMESPACES.  Add MAPPINGS, a list of <file-system-mapping>, to the
-set of directories visible in the process's mount namespace.  Return the
-process' exit status as a monadic value.
+set of directories visible in the process's mount namespace.  Inside the
+namespaces, run code as GUEST-UID and GUEST-GID.  Return the process' exit
+status as a monadic value.
 
 This is useful to implement processes that, unlike derivations, are not
 entirely pure and need to access the outside world or to perform side
@@ -292,4 +294,6 @@ (define items
                                    (list "-c"
                                          (object->string
                                           (lowered-gexp-sexp lowered))))))
-                  #:namespaces namespaces))))))
+                  #:namespaces namespaces
+                  #:guest-uid guest-uid
+                  #:guest-gid guest-gid))))))
-- 
2.34.0





  reply	other threads:[~2022-03-13 21:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-13 21:52 [bug#54377] [PATCH 0/3] Add 'guix home container' Ludovic Courtès
2022-03-13 21:54 ` [bug#54377] [PATCH 1/3] linux-container: 'eval/container' honors #:namespaces Ludovic Courtès
2022-03-13 21:54   ` Ludovic Courtès [this message]
2022-03-13 21:54   ` [bug#54377] [PATCH 3/3] guix home: Add 'container' command Ludovic Courtès
2022-03-17  6:24     ` Andrew Tropin
2022-03-18 13:25       ` Ludovic Courtès
2022-03-19  5:09         ` Andrew Tropin
2022-03-19 10:39           ` [bug#54377] [PATCH 0/3] Add 'guix home container' Ludovic Courtès
2022-03-19 15:03             ` Andrew Tropin
2022-03-19 18:24           ` bug#54377: " Ludovic Courtès
2022-03-17 15:01 ` [bug#54377] " Frank Pursel
2022-03-19 10:32   ` Ludovic Courtès
2022-03-23  3:06     ` Frank Pursel

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

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

  git send-email \
    --in-reply-to=20220313215454.9576-2-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=54377@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.