Should I move this discussion to Codeberg or is now a bad time? If
so, which branch should I make a pull request against?
Ludovic Courtès <[email protected]> writes:
I would reuse <file-system> or <file-system-mapping> here.
Something more like this?
;; <environment> record for (guix scripts shell).
;;
;; The goal is to capture the “runtime” aspects of ‘guix shell’
that
;; manifests don’t represent: purity, containers, filesystem view,
and
;; environment variables. Build/daemon options (-c, -M, --system,
;; --no-substitutes, etc.) are deliberately left out.
(define-record-type* <environment>
environment make-environment environment?
;; Optional manifest for this environment. When non-#f, this is
the
;; manifest that ‘guix shell’ should use instead of, or in
addition to,
;; the usual -m/-f/-e/PKGS parsing.
(manifest environment-manifest
(default #f))
;; Equivalent to --pure.
(pure? environment-pure?
(default #f))
;; Equivalent to --container.
(container? environment-container?
(default #f))
;; Equivalent to -F / --emulate-fhs.
(emulate-fhs? environment-emulate-fhs?
(default #f))
;; Network policy for containers; for example:
;; 'inherit – current behaviour
;; 'allow – like -N / --network
;; 'none – no network access
(network environment-network
(default 'inherit))
;; Whether the container’s root file system is writable
;; (--writable-root).
(writable-root? environment-writable-root?
(default #f))
;; Whether to share the current working directory with the
container.
;; This is the opposite of --no-cwd; the default matches current
;; behaviour.
(share-cwd? environment-share-cwd?
(default #t))
;; Whether to link the environment profile to ~/.guix-profile
inside
;; the container (-P / --link-profile).
(link-profile? environment-link-profile?
(default #f))
;; Whether Guix itself should be available within the container
;; (-W / --nesting).
(nesting? environment-nesting?
(default #f))
;; Optional user name to use inside the container (-u / --user).
(user environment-user
(default #f))
;; Additional file system mappings in a separate mount
namespace,
;; expressed as a list of <file-system-mapping> objects from
;; (gnu system file-systems). These correspond to the MAPPINGS
;; argument of ‘make-forkexec-constructor/container’.
(file-system-mappings environment-file-system-mappings
(default '()))
;; Container symlinks as produced by -S / --symlink. For now
these are
;; kept as raw SPEC strings, e.g. "/usr/bin/env=bin/env".
(symlinks environment-symlinks
(default '()))
;; Environment variables that should be preserved from the
incoming
;; process environment. Each string is interpreted as a
variable name;
;; internally this can correspond to --preserve='^NAME$'.
(preserved-variables environment-preserved-variables
(default '()))
;; Optional list of regular expressions corresponding to -E /
--preserve=REGEXP
;; on the command line. This allows representing the full
expressive power
;; of the CLI when constructing an <environment> from argv.
(preserved-regexps environment-preserved-regexps
(default '()))
;; Extra environment variables to define or override inside the
shell
;; or container. Each element is a (NAME . VALUE) pair; these
are
;; applied last, so they override both inherited and
profile-defined
;; values.
(variables environment-variables
(default '())))