Environments are part of Guix, and installed by default.


  • The purpose of guix environment is to assist hackers in creating reproducible development environments without polluting their package profile.
  • The guix environment tool takes one or more packages, builds all of their inputs, and creates a shell environment to use them.
  • Unlike virtualenv from python, Guix doesn’t limit the usage of languages.
  • You told Guix what do you need, and Guix gives it to you. If the packages are previously downloaded or built in your device, Guix can reuse it, no need for duplication.


1. downloading or building packages in environment

$ guix environment --ad-hoc python python-numpy

--ad-hoc argument means that you want python and python-numpy as immediate packages. Without this argument, Guix will give you the dependencies of python and numpy themselves, which are those packages needed for compiling python and numpy. You don’t want to compile them, rather, you want to use them for your project, hence the --ad-hoc argument.

2. In the following example guix will remove all existing environment variables predefined in your shell. Which means the new environment is pure. You won’t be able to access any existing commands in your system except for python3.

 $ guix environment --ad-hoc python python-numpy --pure

3. You can write down your needed package in a file possibly named “foo-manifest.scm” like this one:

		'("emacs" "python-numpy" "python" "python-flake8"))
$ guix environment --manifest=foo-manifest.scm

4. Create an environment for the package or list of packages that the code within file evaluates to.

(When we want to develop a special package ex: gdb it would be better to using this definition for environment)

(use-modules (guix)
             (gnu packages gdb)
             (gnu packages autotools)
             (gnu packages texinfo))

;; Augment the package definition of GDB with the build tools
;; needed when developing GDB (and which are not needed when
;; simply installing it.)
(package (inherit gdb)
  (native-inputs `(("autoconf" ,autoconf-2.64)
                   ("automake" ,automake)
                   ("texinfo" ,texinfo)
                   ,@(package-native-inputs gdb))))
$ guix environment -l package.scm

5. Run command within an isolated container:
guix will create a environment with changed root. Which means you won’t be able to see any files other than those within your working directory and its sub-directories.

$ guix environment --ad-hoc python python-numpy --container

guix environment defines the GUIX_ENVIRONMENT variable in the shell it spawns; its value is the file name of the profile of this environment. This allows users to, say, define a specific prompt for development environments in their .bashrc

An active environment is indicated with [env] in your command line.

You can browse the current, environment-specific profile using:


See also

PantherX & (unofficial) GNU Guix Wiki.

Last update: 2021-10-12 20:09:22 +0000

Inspired by the excellent Arch Linux Wiki