summaryrefslogtreecommitdiff
path: root/gnu/system/linux-container.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-03-13 22:09:26 +0100
committerLudovic Courtès <ludo@gnu.org>2022-03-19 18:26:00 +0100
commitcff9fee82a06f58b10a5b3a7743295c53f7988b8 (patch)
treecd2728607015997185efd82f55785ee1dd3633e3 /gnu/system/linux-container.scm
parentc77544b387882450599b5f7e2712abdadaa074e9 (diff)
linux-container: Add #:guest-uid and #:guest-gid to 'eval/container'.
* gnu/system/linux-container.scm (eval/container): Add #:guest-uid and #:guest-gid and honor them.
Diffstat (limited to 'gnu/system/linux-container.scm')
-rw-r--r--gnu/system/linux-container.scm14
1 files changed, 9 insertions, 5 deletions
diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm
index 415d6b97756..eeb0f68c026 100644
--- a/gnu/system/linux-container.scm
+++ b/gnu/system/linux-container.scm
@@ -1,6 +1,6 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 David Thompson <davet@gnu.org> 2;;; Copyright © 2015 David Thompson <davet@gnu.org>
3;;; Copyright © 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org> 3;;; Copyright © 2016-2017, 2019-2022 Ludovic Courtès <ludo@gnu.org>
4;;; Copyright © 2019 Arun Isaac <arunisaac@systemreboot.net> 4;;; Copyright © 2019 Arun Isaac <arunisaac@systemreboot.net>
5;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> 5;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
6;;; Copyright © 2020 Google LLC 6;;; Copyright © 2020 Google LLC
@@ -248,11 +248,13 @@ that will be shared with the host system."
248(define* (eval/container exp 248(define* (eval/container exp
249 #:key 249 #:key
250 (mappings '()) 250 (mappings '())
251 (namespaces %namespaces)) 251 (namespaces %namespaces)
252 (guest-uid 0) (guest-gid 0))
252 "Evaluate EXP, a gexp, in a new process executing in separate namespaces as 253 "Evaluate EXP, a gexp, in a new process executing in separate namespaces as
253listed in NAMESPACES. Add MAPPINGS, a list of <file-system-mapping>, to the 254listed in NAMESPACES. Add MAPPINGS, a list of <file-system-mapping>, to the
254set of directories visible in the process's mount namespace. Return the 255set of directories visible in the process's mount namespace. Inside the
255process' exit status as a monadic value. 256namespaces, run code as GUEST-UID and GUEST-GID. Return the process' exit
257status as a monadic value.
256 258
257This is useful to implement processes that, unlike derivations, are not 259This is useful to implement processes that, unlike derivations, are not
258entirely pure and need to access the outside world or to perform side 260entirely pure and need to access the outside world or to perform side
@@ -292,4 +294,6 @@ effects."
292 (list "-c" 294 (list "-c"
293 (object->string 295 (object->string
294 (lowered-gexp-sexp lowered)))))) 296 (lowered-gexp-sexp lowered))))))
295 #:namespaces namespaces)))))) 297 #:namespaces namespaces
298 #:guest-uid guest-uid
299 #:guest-gid guest-gid))))))