Next: , Previous: , Up: Contributing   [Contents][Index]


14.2 Running Guix Before It Is Installed

In order to keep a sane working environment, you will find it useful to test the changes made in your local source tree checkout without actually installing them. So that you can distinguish between your “end-user” hat and your “motley” costume.

To that end, all the command-line tools can be used even if you have not run make install. To do that, you first need to have an environment with all the dependencies available (see Building from Git), and then simply prefix each command with ./pre-inst-env (the pre-inst-env script lives in the top build tree of Guix; it is generated by ./configure), as in31:

$ sudo -E ./pre-inst-env guix-daemon --build-users-group=guixbuild
$ ./pre-inst-env guix build hello

Similarly, for a Guile session using the Guix modules:

$ ./pre-inst-env guile -c '(use-modules (guix utils)) (pk (%current-system))'

;;; ("x86_64-linux")

… and for a REPL (see Using Guile Interactively in Guile Reference Manual):

$ ./pre-inst-env guile
scheme@(guile-user)> ,use(guix)
scheme@(guile-user)> ,use(gnu)
scheme@(guile-user)> (define snakes
                       (fold-packages
                         (lambda (package lst)
                           (if (string-prefix? "python"
                                               (package-name package))
                               (cons package lst)
                               lst))
                         '()))
scheme@(guile-user)> (length snakes)
$1 = 361

The pre-inst-env script sets up all the environment variables necessary to support this, including PATH and GUILE_LOAD_PATH.

Note that ./pre-inst-env guix pull does not upgrade the local source tree; it simply updates the ~/.config/guix/current symlink (see Invoking guix pull). Run git pull instead if you want to upgrade your local source tree.


Footnotes

(31)

The -E flag to sudo guarantees that GUILE_LOAD_PATH is correctly set such that guix-daemon and the tools it uses can find the Guile modules they need.