Rutherther <[email protected]> writes:
I like the general idea, I have a proposal for an improvement,
though.
I really like your proposal, thanks! What if we split
<environment> into two records:
;; <environment> record for ‘guix shell’.
;;
;; Captures runtime semantics, deliberately excluding build/daemon
options
;; (-c, -M, --system, --no-substitutes, etc.).
(define-record-type* <environment>
environment make-environment environment?
;; Optional resolved <manifest>. Multiple -m inputs should be
combined
;; into one manifest before constructing <environment>.
(manifest environment-manifest
(default #f))
;; Equivalent to --pure.
(pure? environment-pure?
(default #f))
;; Canonical preserve representation: regexps from
-E/--preserve.
;; Convenience: variable names expanded to "^NAME$".
(preserved-regexps environment-preserved-regexps
(default '()))
(preserved-variables environment-preserved-variables
(default '()))
;; Extra vars defined/overridden inside the shell/container.
;; Applied last, overriding inherited/preserved/profile-defined
values.
(variables environment-variables
(default '()))
;; Container runtime configuration.
;; #f means “not a container”; a <container-environment> means
“--container”.
(container environment-container
(default #f)))
;; Container-only configuration for ‘guix shell --container’.
;; All fields map to existing CLI flags today; more can be added
later.
(define-record-type* <container-environment>
container-environment make-container-environment
container-environment?
;; -F / --emulate-fhs
(emulate-fhs? container-environment-emulate-fhs?
(default #f))
;; -N / --network
(network? container-environment-network?
(default #f))
;; --writable-root
(writable-root? container-environment-writable-root?
(default #f))
;; Share current working directory (inverse of --no-cwd)
(share-cwd? container-environment-share-cwd?
(default #t))
;; -P / --link-profile
(link-profile? container-environment-link-profile?
(default #f))
;; -W / --nesting
(nesting? container-environment-nesting?
(default #f))
;; -u / --user=USER (optional)
(user container-environment-user
(default #f))
;; --share / --expose represented with existing Guix type(s)
;; (as Ludo suggested): list of <file-system-mapping>.
(file-system-mappings
container-environment-file-system-mappings
(default '()))
;; -S / --symlink SPEC (raw strings for now)
(symlinks container-environment-symlinks
(default '())))