packages: Add 'package->bag' test for propagated inputs.
[guix.git] / pre-inst-env.in
blob92e48c07a14a8d489069b32d1dc1ec1599a11a82
1 #!/bin/sh
3 # GNU Guix --- Functional package management for GNU
4 # Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
6 # This file is part of GNU Guix.
8 # GNU Guix is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or (at
11 # your option) any later version.
13 # GNU Guix is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 # Usage: ./pre-inst-env COMMAND ARG...
23 # Run COMMAND in a pre-installation environment. Typical use is
24 # "./pre-inst-env guix build hello".
26 # By default we may end up with absolute directory names that contain '..',
27 # which get into $GUILE_LOAD_PATH, leading to '..' in the module file names
28 # recorded by Guile. To avoid that, make sure we get a real absolute
29 # directory name. Additionally, use '-P' to get the canonical directory name
30 # so that Guile's 'relative' %file-port-name-canonicalization can actually
31 # work (see <http://bugs.gnu.org/17935>.)
32 abs_top_srcdir="`cd "@abs_top_srcdir@" > /dev/null; pwd -P`"
33 abs_top_builddir="`cd "@abs_top_builddir@" > /dev/null; pwd -P`"
35 GUILE_LOAD_COMPILED_PATH="$abs_top_builddir${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
36 GUILE_LOAD_PATH="$abs_top_builddir:$abs_top_srcdir${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
37 export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
39 # Define $PATH so that `guix' and friends are easily found.
41 PATH="$abs_top_builddir/scripts:$abs_top_builddir:$PATH"
42 export PATH
44 # Daemon helpers.
46 NIX_ROOT_FINDER="$abs_top_builddir/nix/scripts/list-runtime-roots"
47 NIX_SUBSTITUTERS="$abs_top_builddir/nix/scripts/substitute-binary"
48 NIX_SETUID_HELPER="$abs_top_builddir/nix-setuid-helper"
49 NIX_BUILD_HOOK="$abs_top_builddir/nix/scripts/offload"
50 NIX_LIBEXEC_DIR="@abs_top_builddir@/nix/scripts" # for 'guix-authenticate'
52 export NIX_ROOT_FINDER NIX_SETUID_HELPER NIX_SUBSTITUTERS \
53 NIX_BUILD_HOOK NIX_LIBEXEC_DIR
55 # The 'guix-register' program.
56 GUIX_REGISTER="$abs_top_builddir/guix-register"
57 export GUIX_REGISTER
59 # The following variables need only be defined when compiling Guix
60 # modules, but we define them to be on the safe side in case of
61 # auto-compilation.
63 NIX_HASH="@NIX_HASH@"
64 export NIX_HASH
66 # Define $GUIX_UNINSTALLED to prevent `guix' from
67 # prepending @guilemoduledir@ to the Guile load paths.
69 GUIX_UNINSTALLED=1
70 export GUIX_UNINSTALLED
72 exec "$@"