Reported by Chris Webber.
* guix/scripts/build.scm (register-root): If ROOT is absolute, keep it
as is.
* guix/scripts/environment.scm (register-gc-root): Likewise.
* tests/guix-environment.sh (expected): Add test.
* guix/scripts/environment.scm (create-environment): Set
'GUIX_ENVIRONMENT' to PROFILE.
* tests/guix-environment.sh: Test it.
* doc/guix.texi (Invoking guix environment): Document it.
Fixes <http://bugs.gnu.org/19816>.
* guix/scripts/environment.scm (evaluate-input-search-paths)
(build-inputs): Delete.
(evaluate-profile-search-paths, strip-input-name)
(package-or-package+output?, package-environment-inputs)
(build-environment, inputs->profile-derivations): New procedures.
(create-environment, show-search-paths, launch-environment)
(launch-environment/container): Replace 'inputs' argument
with 'profile' argument.
(package+propagated-inputs): Strip off names off of input tuples.
(options/resolve-packages): Handle input tuples that specify an output
in expressions.
(guix-environment): Convert inputs into a profile to use in the
environment. Remove non-package inputs such as origins from
environment inputs.
* doc/guix.texi ("invoking guix environment"): Document package+output
tuples for --expression option.
* tests/guix-environment.sh: Update tests.
* tests/guix-environment-container.sh: Likewise.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This patch changes the --ad-hoc flag to be positional. That is, the
packages that appear before --ad-hoc are interpreted as packages whose
inputs should be in the environment; the packages that appear after are
interpreted as packages to be directly added to the environment.
* guix/scripts/environment.scm (tag-package-arg, compact): New
procedures.
(%options): Tweak the handlers for --load and --expression options.
(options/resolve-packages): Preserve package mode tag.
(parse-args): Tweak argument handler to use package tagging procedure.
(guix-environment): Apply ad-hoc behavior on a per package basis.
* tests/guix-environment.sh: Add test.
* doc/guix.texi ("invoking guix environment"): Document new behavior of
--ad-hoc.
This allows for direct program invokation without needing a shell to act
as a command interpreter.
* guix/scripts/environment.scm (%default-shell): New variable.
(show-help): Adjust description. Remove '--exec' reference.
(%default-options): Use '%default-shell'.
(%options): Adjust '--exec' to run command via the default shell.
(parse-args): New procedure.
(guix-environment): Use 'parse-args'. Use 'system*' instead of
'system'.
* tests/guix-environment.sh: Add test for '--' command invokation.
* doc/guix.texi ("Invoking guix environment"): Use new syntax. Remove
'--exec' documentation.
* guix/scripts/environment.scm (package+propagated-inputs): Add 'output'
parameter. Use it in return value.
(options/resolve-packages): Use 'append-map' instead of 'map'. For 'load'
and 'expression', return all the outputs of the resulting package. For
'package', use 'specification->package+output' instead of
'specification->package'.
(guix-environment): Adjust uses of PACKAGES accordingly.
* doc/guix.texi (Invoking guix environment): Document it.
* tests/guix-environment.sh: Add test for --ad-hoc guile-bootstrap:out.
Before that, 'guix environment guile' (for instance) would define environment
variables that would refer to the "include" output of Bash, the "debug" output
of libgc, etc., even though these are not listed as inputs in the recipe of
'guile'.
* guix/gexp.scm (lower-inputs): Export.
* guix/scripts/environment.scm (evaluate-input-search-paths): Remove
'derivations' parameter; add 'search-paths'. Expect 'inputs' to be
a list of tuples. Adjust callers.
(create-environment): Remove 'derivations' parameter; add 'search-paths'.
(show-search-paths): Likewise.
(package+propagated-inputs): New procedure.
(packages->transitive-inputs, packages+propagated-inputs): Remove.
(build-inputs): Expect INPUTS to be a list of derivation tuples.
(guix-environment): Compute INPUTS using 'package+propagated-inputs',
'package->bag', and 'bag-transitive-inputs'. Move 'run-with-store' higher.
* tests/guix-environment.sh: Add test with FINDUTILS-BOOT0.