Next: , Previous: , Up: 贡献   [Contents][Index]

22.4 在安装之前运行Guix

为了保持一个合适的工作环境,你会发现在你的本地代码树里测试修改而不用安装它们会很有用。TODO: 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 从Git构建), and then simply prefix each command with ./pre-inst-env (the pre-inst-env script lives in the top build tree of Guix; see 从Git构建 to generate it). As an example, here is how you would build the hello package as defined in your working tree (this assumes guix-daemon is already running on your system; it’s OK if it’s a different version):

$ ./pre-inst-env guix build hello

同样,一个使用 Guix 模块的 Guile 会话的例子:

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

;;; ("x86_64-linux")

… and for a REPL (see Using Guix Interactively):

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

If you are hacking on the daemon and its supporting code or if guix-daemon is not already running on your system, you can launch it straight from the build tree43:

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


./pre-inst-env guix pull 会更新本地源代码树,它只更新符号链接~/.config/guix/current (see Invoking guix pull)。如果你想更新本地源代码树,请运行git pull

有时,特别是刚刚更新过你的仓库时,运行 ./pre-inst-env 将会打印一个消息,类似于下面的例子:

;;; note: source file /home/user/projects/guix/guix/progress.scm
;;;       newer than compiled /home/user/projects/guix/guix/progress.go

这仅仅是一个提示,你可以安全地忽略它,可以通过运行 make -j4 来避免这条消息。若你不这么做,Guile 就会运行的稍微慢一些,因为它会解释代码而不是使用预备的 Guile 对象 (.go) 文件。

你可以使用 watchexec 包中的 watchexec 在你干活时自动运行 make。例如,若要在每次更新一个包文件后都再次构建,运行‘watchexec -w gnu/packages -- make -j4’。



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.

Next: 完美的配置, Previous: 运行测试套件, Up: 贡献   [Contents][Index]