Language Manufacturer <[email protected]> writes: > I have a working guix home configuration set up with a few packages. I want > to manage my software declaratively, so I am keeping the list of user > packages in a home config file. The problem is, when I test out some edits > to my home config in a container, the environment it sets up is missing > programs, like cat, which, and importantly, guix! The packages listed in my > config are installed and usable, however.
Inside a Guix Home container, you only have access to the packages that you've included in your home.scm. > Even worse: when I test out guix home container with my current, working > config, I still encounter this issue. Shouldn't the same inputs result in > the same home configuration output? I'm afraid I don't understand this question. If you've tested your home.scm in a Guix Home container and found that the packages you specified were present, what issue are you experiencing with your "current, working config"? Given the same Guix channels.scm and home.scm files, you should get the same environment. Perhaps you can share a code example demonstrating the problem you are having? > I'd be very grateful if someone could point me in the right direction here. In my opinion, the most important concepts to understand when using Guix for package management are channels, packages, profiles, and containers. # Channels ====================================== These are Git repositories containing Scheme code that you have included in your ~/.config/guix/channels.scm. The Scheme code is downloaded to your machine from these repositories whenever your run `guix pull`. # Packages ====================================== Guix builds packages (or downloads their pre-built outputs from authorized substitute servers) based on their Scheme package definitions. Packages are built in dependency order (i.e., inputs first) by the guix-daemon system service inside isolated build containers, and their outputs are written into directories under /gnu/store on your machine. This happens anytime you run `guix build $PACKAGE`. If the package's output is already in /gnu/store, then this command simply returns the path to its output directory. Importantly, building a package does not "install" it anywhere. Its output is in a directory under /gnu/store, but it is not yet usable to you unless you want to call its executables given their absolute paths. # Profiles ====================================== In order to make packages built by Guix usable to you, it must creates profiles. A profile is a directory under /gnu/store that contains a directory tree of symlinks to a collection of one or more packages (whose outputs are already in /gnu/store). This symlink tree reorganizes the package output files into a subset of the top-level Linux FHS directories (e.g., /bin, /sbin, /etc, /var). A profile is created whenever you run `guix install $PACKAGE`. This command first builds the package as described above into /gnu/store and then creates a new profile in /gnu/store with the reorganized symlink tree. Very importantly (and this is something that may confuse new users of Guix), a user may have created MANY profiles. Which ones are "activated" (meaning that you can access their programs from your shell without absolute paths) is determined by the environment variables set in your shell. Each profile contains a file called `etc/profile`, which you must load into your shell (usually with `source $PATH_TO_PROFILE/etc/profile`). This will set the necessary environment variables so that you can use those packages. You may, of course, activate many profiles at once, making all of their packages available in your shell. Of course, when you exit that shell, those profiles will be "deactivated" in a parent or sibling shell. If you want some profiles to be activated in all your shells automatically, add `source $PATH_TO_PROFILE/etc/profile` to your shell's initialization file. For Bash, that is ~/.bash_profile. By default, on a foreign distro each user of Guix has two profiles automatically provided to them: - User profile (~/.guix-profile) - Home profile (~/.guix-home/profile) <-- only if you use Guix Home Any packages that you install with `guix install $PACKAGE` are placed in your user profile. Any packages that you install with `guix home reconfigure home.scm` are placed in your home profile. If you are running Guix System, then you also have one more profile: - system profile (/run/current-system/profile) Packages in this profile are updated with `sudo guix system reconfigure system.scm`. In addition to these profiles, you can use `guix package --manifest="$MANIFEST" --profile="$PROFILE"` to install packages into custom profiles. Just remember that you will need to activate these manually. You can also create ephemeral (temporary) profiles by running `guix shell -m manifest.scm`. # Containers ====================================== Guix can create three types of containers: - System containers: sudo guix system container system.scm - Home containers: guix home container home.scm - Shell containers: guix shell --container -m manifest.scm These use the Linux kernel's "unprivileged user namespaces" feature to drop you into an environment with an isolated process table and view of the filesystem. You can still use all of the host's CPU and RAM resources from your container though unless you limit your container with Linux cgroups or by running them under systemd, which can manage the cgroups settings for you. Inside a container, only the profile created from your system.scm, home.scm, or manifest.scm is activated. Thus, you must provide all of the packages that you want available to you in your container in those files. # In Conclusion ====================================== I hope this overview of Guix's channels, packages, profiles, and containers will give you a better understanding of how Guix builds packages from channels and then makes them available to you via its profiles and containers. Good luck and happy hacking! Gary -- GPG Key ID: C4FBEDBD Use `gpg --search-keys [email protected]' to find me Protect yourself from surveillance: https://emailselfdefense.fsf.org ======================================================================= () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments Why is HTML email a security nightmare? See https://useplaintext.email/ Please avoid sending me MS-Office attachments. See http://www.gnu.org/philosophy/no-word-attachments.html
