summaryrefslogtreecommitdiff
path: root/guix/scripts/environment.scm
AgeCommit message (Collapse)Author
2017-04-05environment: Deal with single-entry search paths.Ludovic Courtès
This is a followup to fcd75bdbfa99d14363b905afbf914eec20e69df8. * guix/scripts/environment.scm (create-environment): Check whether SEPARATOR is #f.
2017-02-07file-systems: Add '%network-configuration-files' and '%network-file-mappings'.Ludovic Courtès
* gnu/system/file-systems.scm (%network-configuration-files) (%network-file-mappings): New variables. * guix/scripts/environment.scm (%network-configuration-files): Remove. (launch-environment/container): Refer to '%network-file-mappings' instead of calling 'filter-map'.
2017-02-03file-systems: Add 'file-system-mapping->bind-mount'.Ludovic Courtès
* gnu/system/file-systems.scm (file-system-mapping->bind-mount): New procedure. * gnu/system/linux-container.scm (mapping->file-system): Remove. (containerized-operating-system)[mapping->fs]: Use 'file-system-mapping->bind-mount' instead of 'mapping->file-system'. * guix/scripts/environment.scm (launch-environment/container): Likewise.
2017-01-30environment: Fix setting writable? on networking related filesChristopher Baines
* guix/scripts/environment.scm (launch-environment/container): Include the file name in the call to string=? when deciding if the file should be writable. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2017-01-19guix environment, build: Allow absolute file names with '--root'.Ludovic Courtès
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.
2016-12-20environment: Add '--root' option.Ludovic Courtès
* guix/scripts/environment.scm (show-help, %options): Add --root. (register-gc-root): New procedure. (guix-environment): Call 'register-gc-root' when OPTS has a 'gc-root' option. * doc/guix.texi (Invoking guix environment): Document it. * tests/guix-environment.sh: Add tests.
2016-12-17profiles: Remove dependency on 'glibc-utf8-locales' for tests.Ludovic Courtès
Commit 1af0860e8be81c01ad405c1226d6bc4516e62863 added a mandatory dependency on 'glibc-utf8-locales', which entails long rebuilds for tests. * guix/profiles.scm (profile-derivation): Add #:locales? parameter. Add 'set-utf8-locale' variable. Use it when LOCALES? is true. (link-to-empty-profile): Pass #:locales? #f. * guix/scripts/environment.scm (inputs->profile-derivation): Pass #:locales?. * guix/scripts/package.scm (build-and-use-profile): Likewise. * tests/packages.scm ("--search-paths with pattern"): Pass #:locales? #f. * tests/profiles.scm ("profile-derivation") ("profile-derivation, inputs", "profile-manifest, search-paths") ("etc/profile", "etc/profile when etc/ already exists"): ("etc/profile when etc/ is a symlink"): Likewise.
2016-11-10container: Pass a list of <file-system> objects as things to mount.Ludovic Courtès
* gnu/build/linux-container.scm (mount-file-systems): 'mounts' is now a list of <file-system> objects instead of a list of lists ("specs"). Add call to 'file-system->spec' as the argument to 'mount-file-system'. (run-container, call-with-container): Adjust docstring accordingly. * gnu/system/file-systems.scm (spec->file-system): New procedure. * gnu/system/linux-container.scm (container-script)[script]: Call 'spec->file-system' inside gexp. * guix/scripts/environment.scm (launch-environment/container): Remove call to 'file-system->spec'. * tests/containers.scm ("call-with-container, mnt namespace") ("call-with-container, mnt namespace, wrong bind mount"): Pass a list of <file-system> objects.
2016-08-28guix scripts: Disable grafting on dry runs.Roel Janssen
* guix/scripts/archive.scm, guix/scripts/build.scm, guix/scripts/environment.scm, guix/scripts/system.scm, guix/scripts/package.scm: Disable grafting when a dry-run parameter is given.
2016-07-26environment: Set 'GUIX_ENVIRONMENT' to the profile.Ludovic Courtès
* 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.
2016-05-24store: 'requisites' now takes a list of store items.Ludovic Courtès
* guix/store.scm (fold-path): Change 'path' to 'paths' and adjust body accordingly. (requisites): Likewise. * guix/scripts/environment.scm (inputs->requisites): Adjust user accordingly. * guix/scripts/size.scm (requisites*): Likewise. * guix/scripts/gc.scm (guix-gc): Likewise. * tests/store.scm ("requisites"): Likewise.
2016-05-04environment: Use 'break' instead of 'split'.Ludovic Courtès
* guix/scripts/environment.scm (parse-args): Use 'break' instead of 'split'.
2016-04-07environment: container: Work around read-only /etc/resolv.conf issue.David Thompson
* guix/scripts/environment.scm (launch-environment/container): Mount /etc/resolv.conf as a writable file.
2016-03-30environment: Set a default value for PS1.David Thompson
* guix/scripts/environment.scm (launch-environment/container): Set PS1 during container initialization.
2016-03-27environment: Properly handle SIGINT.David Thompson
Switching to execlp means that the process spawned in a container is PID 1, which obsoleted one of the 'guix environment --container' tests because the init process can't be killed in the usual manner. * guix/scripts/environment.scm (launch-environment/fork): New procedure. (launch-environment): Switch from system* to execlp. Add handler for SIGINT. (guix-environment): Use launch-environment/fork. * tests/guix-environment-container.sh: Replace abnormal exit test with one that works now that the spawned process is PID 1.
2016-03-26environment: container: Create dummy home directory and /etc/passwd.David Thompson
* guix/scripts/environment.scm (launch-environment/container): Change $HOME to the current user's home directory instead of /homeless-shelter. Create a dummy /etc/passwd with a single entry for the current user. * doc/guix.texi ("invoking guix environment"): Add a note about the dummy home directory and /etc/passwd.
2016-03-02guix build: Move '--no-grafts' to the common build options.Ludovic Courtès
* guix/scripts/build.scm (%options): Move --no-grafts to... (%standard-build-options): ... here. (show-help, show-build-options-help): Adjust accordingly. * guix/scripts/archive.scm (%default-options): Add 'graft?'. (guix-archive): Parametrize '%graft?'. * guix/scripts/environment.scm (%default-options): Add 'graft?'. (guix-environment): Parametrize '%graft?'. * guix/scripts/package.scm (%default-options): Add 'graft?'. (guix-package): Parametrize '%graft?'. * guix/scripts/system.scm (%default-options): Add 'graft?'. (guix-system): Parametrize 'graft?'. * doc/guix.texi (Additional Build Options): Move --no-grafts to... (Common Build Options): ... here.
2016-02-12scripts: environment: Build environments as profiles.David Thompson
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>
2015-11-28environment: Set build options early on.Ludovic Courtès
This fixes a bug whereby some options, such as #:substitute-urls, would be passed to the daemon too late to have an effect. * guix/scripts/environment.scm (build-inputs): Remove call to 'set-build-options-from-command-line*'. (guix-environment): Add call to 'set-build-options-from-command-line' as early as possible.
2015-11-21environment: Correctly handle abnormal exits.Ludovic Courtès
Fixes <http://bugs.gnu.org/21958>. * guix/scripts/environment.scm (status->exit-code): New procedure. (exit/status, primitive-exit/status): Use it. * tests/guix-environment-container.sh: Add test.
2015-11-03scripts: environment: Display friendly container error messages.David Thompson
* guix/scripts/environment.scm (assert-container-features): New procedure. (guix-environment): Use it.
2015-11-02scripts: environment: Ignore user shell when spawning container.David Thompson
* guix/scripts/environment.scm (%default-options): Remove 'exec' association. (guix-environment): If the user didn't specify a command, use the default shell, or use /bin/sh when a container is requested.
2015-10-30scripts: environment: Allow lists of packages in expressions.David Thompson
* guix/scripts/environment.scm (options/resolve-packages): Match against lists of packages when evaluating expressions. * tests/guix-environment.sh: Add test. * doc/guix.texi ("invoking guix environment"): Add docs.
2015-10-29scripts: environment: Allow mixing regular and ad-hoc packages.David Thompson
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.
2015-10-25scripts: environment: Add --container option.David Thompson
* guix/scripts/system.scm (specification->file-system-mapping): Move from here... * guix/ui.scm (specification->file-system-mapping): ... to here. * guix/scripts/enviroment.scm (show-help): Show help for new options. (%options): Add --container --network, --expose, and --share options. (%network-configuration-files): New variable. (launch-environment, launch-environment/container, requisites*, inputs->requisites): New procedures. (guix-environment): Spawn new process in a container when requested. * doc/guix.texi (Invoking guix environment): Document it. * tests/guix-environment-container.sh: New file. * Makefile.am (SH_TESTS): Add it.
2015-10-09scripts: environment: Use system* instead of system.David Thompson
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.
2015-09-18Add (guix scripts).Alex Kost
* guix/ui.scm: Add missing copyright lines. (args-fold*, environment-build-options, %default-argument-handler, parse-command-line): Move to ... * guix/scripts.scm: ...here. New file. * guix/scripts/archive.scm: Use it. * guix/scripts/build.scm: Likewise. * guix/scripts/download.scm: Likewise. * guix/scripts/edit.scm: Likewise. * guix/scripts/environment.scm: Likewise. * guix/scripts/gc.scm: Likewise. * guix/scripts/graph.scm: Likewise. * guix/scripts/hash.scm: Likewise. * guix/scripts/import/cpan.scm: Likewise. * guix/scripts/import/cran.scm: Likewise. * guix/scripts/import/elpa.scm: Likewise. * guix/scripts/import/gem.scm: Likewise. * guix/scripts/import/gnu.scm: Likewise. * guix/scripts/import/hackage.scm: Likewise. * guix/scripts/import/nix.scm: Likewise. * guix/scripts/import/pypi.scm: Likewise. * guix/scripts/lint.scm: Likewise. * guix/scripts/package.scm: Likewise. * guix/scripts/publish.scm: Likewise. * guix/scripts/pull.scm: Likewise. * guix/scripts/refresh.scm: Likewise. * guix/scripts/size.scm: Likewise. * guix/scripts/system.scm: Likewise. * tests/ui.scm (with-environment-variable, "parse-command-line", "parse-command-line and --no options"): Move to ... * tests/scripts.scm: ...here. New file. * Makefile.am (MODULES): Add guix/scripts.scm. (SCM_TESTS): Add tests/scripts.scm. * po/guix/POTFILES.in: Add guix/scripts.scm.
2015-07-02scripts: environment: Return the exit status of the command.Cyril Roelandt
* guix/scripts/environment.scm (guix-environment): Return the exit status of the command.
2015-07-01environment: Define 'GUIX_ENVIRONMENT'.Ludovic Courtès
* guix/scripts/environment.scm (create-environment): Define 'GUIX_ENVIRONMENT'. * doc/guix.texi (Invoking guix environment): Document it. * gnu/system/shadow.scm (default-skeletons): Adjust 'PS1' depending on whether 'GUIX_ENVIRONMENT' is defined.
2015-07-01environment: Improve error reporting for '-l'.Ludovic Courtès
This fixes two problems: 1. Load errors would print an ugly backtrace. 2. When FILE was an absolute name, 'load' was passed an incorrect file name. * guix/scripts/environment.scm (options/resolve-packages): Use 'load*' instead of 'load'.
2015-07-01environment: For --ad-hoc, allow users to specify an output.Ludovic Courtès
* 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.
2015-07-01environment: Add --system.Ludovic Courtès
* guix/scripts/environment.scm (show-help, %options): Add -s/--system. (%default-options): Add 'system' pair. (guix-environment): Pass 'system' value from OPTS to 'lower-inputs'. * doc/guix.texi (Invoking guix environment): Document it.
2015-07-01environment: Add only the specified outputs of the dependencies.Ludovic Courtès
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.
2015-06-11environment: Connect to the store after the command line has been parsed.Ludovic Courtès
* guix/scripts/environment.scm (guix-environment): Call 'parse-command-line' outside of 'with-store'. This allows things like --help to run even if the daemon is not running.
2015-05-28guix environment: Add --ad-hoc option.David Thompson
* guix/scripts/environment.scm (%options): Add "ad-hoc" option. (show-help): Display help for "--ad-hoc". (packages+propagated-inputs): New procedure. (guix-environment): Create ad hoc environment when asked. * doc/guix.texi ("invoking guix environment"): Document it.
2015-05-21scripts: Move 'set-build-options-from-command-line*' to (guix scripts build) ↵David Thompson
module. * guix/scripts/build.scm (set-build-options-from-command-line*): New procedure. * guix/scripts/environment.scm (set-build-options-from-command-line*): Delete.
2015-05-21ui: Deduplicate 'show-what-to-build*'.David Thompson
* guix/ui.scm (show-what-to-build*): New procedure. * guix/scripts/environment.scm (show-what-to-build*): Delete. * guix/scripts/system.scm (show-what-to-build*): Likewise. * build-aux/make-binary-tarball.scm (show-what-to-build*): Likewise.
2015-05-05environment: Move iteration outside of 'for-each-search-path'.Ludovic Courtès
* guix/search-paths.scm (search-path-definition): New procedure. * guix/scripts/environment.scm (for-each-search-path): Rename to... (evaluate-input-search-paths): ... this. Remove 'proc' and 'pure?' parameters, and return directly the list of search-path/value pairs. (create-environment): Use 'for-each' and 'evaluate-input-search-paths' instead of 'for-each-search-path'. (show-search-paths): Use 'for-each', 'search-path-definition', and 'evaluate-search-paths' instead of 'for-each-search-path'.
2015-05-05environment: Use 'evaluate-search-paths'.Ludovic Courtès
This allows 'guix environment' to correctly handle non-directory and/or pattern search-path specifications, such as that for 'XML_CATALOG_FILES'. * guix/scripts/environment.scm (for-each-search-path): Use 'evaluate-search-paths' instead of 'search-path-as-list' & co.
2015-05-05search-paths: Define the 'PATH' environment variable.Ludovic Courtès
* guix/search-paths.scm ($PATH): New variable. * guix/scripts/environment.scm (for-each-search-path): Use it.
2015-05-05environment: Use (guix search-paths).Ludovic Courtès
* guix/scripts/environment.scm: Use (guix search-paths). Fixes a regression introduced in e89431b.
2015-03-16scripts: environment: Improve error messages.David Thompson
* guix/scripts/environment.scm (guix-environment): Wrap procedure body with error handling form.
2015-02-26ui: Factorize command-line + env. var. option parsing.Ludovic Courtès
* guix/ui.scm (%default-argument-handler, parse-command-line): New procedures. (environment-build-options): Make private. * guix/scripts/archive.scm (guix-archive)[parse-options, parse-options-from]: Remove. Use 'parse-command-line' instead. * guix/scripts/build.scm (guix-build): Likewise. * guix/scripts/environment.scm (guix-environment): Likewise. * guix/scripts/package.scm (guix-package): Likewise. * guix/scripts/system.scm (guix-system): Likewise. * tests/ui.scm (with-environment-variable): New macro. ("parse-command-line"): New test.
2015-02-03guix: environment: Consider all package outputs.David Thompson
* guix/scripts/environment.scm (for-each-search-path): Iterate over all derivation output paths. (packages->transitive-inputs): Process inputs that specify an output, too.
2015-01-16Merge branch 'core-updates'Ludovic Courtès
Conflicts: gnu/packages/bootstrap.scm
2015-01-14monads: Move '%store-monad' and related procedures where they belong.Ludovic Courtès
This turns (guix monads) into a generic module for monads, and moves the store monad and related monadic procedures in their corresponding module. * guix/monads.scm (store-return, store-bind, %store-monad, store-lift, text-file, interned-file, package-file, package->derivation, package->cross-derivation, origin->derivation, imported-modules, compiled, modules, built-derivations, run-with-store): Move to... * guix/store.scm (store-return, store-bind, %store-monad, store-lift, text-file, interned-file): ... here. (%guile-for-build): New variable. (run-with-store): Moved from monads.scm. Remove default value for #:guile-for-build. * guix/packages.scm (default-guile): Export. (set-guile-for-build): New procedure. (package-file, package->derivation, package->cross-derivation, origin->derivation): Moved from monads.scm. * guix/derivations.scm (%guile-for-build): Remove. (imported-modules): Rename to... (%imported-modules): ... this. (compiled-modules): Rename to... (%compiled-modules): ... this. (built-derivations, imported-modules, compiled-modules): New procedures. * gnu/services/avahi.scm, gnu/services/base.scm, gnu/services/dbus.scm, gnu/services/dmd.scm, gnu/services/networking.scm, gnu/services/ssh.scm, gnu/services/xorg.scm, gnu/system/install.scm, gnu/system/linux-initrd.scm, gnu/system/shadow.scm, guix/download.scm, guix/gexp.scm, guix/git-download.scm, guix/profiles.scm, guix/svn-download.scm, tests/monads.scm: Adjust imports accordingly. * guix/monad-repl.scm (default-guile-derivation): New procedure. (store-monad-language, run-in-store): Use it. * build-aux/hydra/gnu-system.scm (qemu-jobs): Add explicit 'set-guile-for-build' call. * guix/scripts/archive.scm (derivation-from-expression): Likewise. * guix/scripts/build.scm (options/resolve-packages): Likewise. * guix/scripts/environment.scm (guix-environment): Likewise. * guix/scripts/system.scm (guix-system): Likewise. * doc/guix.texi (The Store Monad): Adjust module names accordingly.
2014-12-27utils: Export 'search-path-as-list'.Ludovic Courtès
* guix/build/utils.scm (search-path-as-list): Make public. * guix/scripts/environment.scm (for-each-search-path): Use it.
2014-12-27packages: Add 'file-type' field to 'search-path-specification'.Ludovic Courtès
Fixes <http://bugs.gnu.org/18033>. * guix/packages.scm (<search-path-specification>): Rename 'directories' field to 'files'. Add 'file-type'. (search-path-specification->sexp): Honor 'file-type'. * gnu/packages/autotools.scm, gnu/packages/bootstrap.scm, gnu/packages/cross-base.scm, gnu/packages/games.scm, gnu/packages/gcc.scm, gnu/packages/glib.scm, gnu/packages/guile.scm, gnu/packages/man.scm, gnu/packages/perl.scm, gnu/packages/pkg-config.scm, gnu/packages/python.scm, gnu/packages/ruby.scm, gnu/packages/xfce.scm: Change 'directories' to 'files'. * tests/packages.scm ("search paths"): Change 'directories' field to 'files'. * guix/scripts/environment.scm (for-each-search-path): Likewise.
2014-12-06guix: scripts: Parse $GUIX_BUILD_OPTIONS separately.nebuli
Appending to "raw" args broke optional parameters in 'guix package -I' and 'guix package -A', and possibly other places. Therefore, switch to parsing each set of options on its own and append resulting alists together afterwards. * guix/scripts/archive.scm (parse-options-from): Rename from (parse-options) and add explicit argument. New form of (parse-options) using its old algorithm via -from function. * guix/scripts/build.scm: Ditto. * guix/scripts/environment.scm: Ditto. * guix/scripts/package.scm: Ditto. * guix/scripts/system.scm: Ditto. * tests/guix-package.sh: Add test. * doc/guix.texi (Invoking guix build): Make it clear that the options are parsed independently. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2014-11-30guix: scripts: Add GUIX_BUILD_OPTIONS environment handling.nebuli
* doc/guix.texi (Invoking guix build): Mention 'GUIX_BUILD_OPTIONS'. * guix/scripts/archive.scm: (append args (environment-build-options)). * guix/scripts/build.scm: Ditto. * guix/scripts/environment.scm: Ditto. * guix/scripts/package.scm: Ditto. * guix/scripts/system.scm: Ditto. * guix/ui.scm (environment-build-options): New function. * guix/utils.scm (arguments-from-environment-variable): New function. * tests/guix-build.sh: Add tests. * test-env.in: Unset GUIX_BUILD_OPTIONS. Co-authored-by: Ludovic Courtès <ludo@gnu.org>