Re: guix environment shebang interpreter
Great! however, note that at two different time points, you can get different versions of python with this command as the executing machine might have different versions of guix. Only if you pull a specific version of guix (e.g. with guix pull --commit) and have it in your PATH you will get the same packages. Best regards, Moritz --- OpenPGP: 0xB4CCD0677340821E Am 07.02.2020 00:22 schrieb John D. Boy: > Is there a Guix equivalent of the nix-shell shebang? You could imagine something like: #! /usr/bin/env guix environment --ad-hoc PKG1 PKG2 ... -- INTERPRETER But alas, on linux you cannot put more than one argument in the shebang line. I have successfully gotten this to work by passing -S to env: #!/usr/bin/env -S guix environment --ad-hoc python python-pandas python-numpy -- python3 See a short test script here: https://gist.github.com/jboynyc/1faa5dc4e278d5b6284795f780d22764
Re: guix environment shebang interpreter
Hi! Is there a Guix equivalent of the nix-shell shebang? You could imagine something like: #! /usr/bin/env guix environment --ad-hoc PKG1 PKG2 ... -- INTERPRETER But alas, on linux you cannot put more than one argument in the shebang line. See this discussion: https://unix.stackexchange.com/questions/399690/multiple-arguments-in-shebang But, one answer there has a possible solution for you: https://unix.stackexchange.com/a/399698 --8<--- #!/bin/sh - if [ "$1" != "--really" ]; then exec bash --posix -- "$0" --really "$@"; fi shift # Processing continues --->8--- It lets the script `exec` itself with the right arguments! So maybe put exec guix environment --ad-hoc PKG1 PKG2 ... -- INTERPRETER "$0" "$@" there? Cheers, Moritz
Re: guix pull: error: getting status of /var/guix/gcroots
Hi Jimmy! I guess they are reducing the capabilities allowed to their build platform but I can really tell what operation is guix pull attempting in this particular case. Do you have any possibility to run guix pull with strace? strace is a program that logs all the system calls [1] of another program, so you might see what operation is failing. But for this, you must modify the startup file of guix-daemon! Because `guix pull` only forwards requests to `guix-daemon`, which does all the work! I don't know how to do it in docker, but, for my Arch Linux system, there is a `guix-daemon` service file at /etc/systemd/system/guix-daemon.service. There, you can find a line starting with "ExecStart=". This is the command to run the daemon. Prepend `strace -o /tmp/guix-daemon.strace.log` to the command to log all the system calls to the file /tmp/guix-daemon.stace.log Hope that helps, Moritz [1]: https://en.wikipedia.org/wiki/System_call#Categories_of_system_calls
Re: How do I remove profiles?
Hi! guix gc is responsible for removing unneeded packages. From https://guix.gnu.org/manual/en/html_node/Invoking-guix-gc.html: The garbage collector has a set of known roots: any file under /gnu/store reachable from a root is considered live and cannot be deleted; any other file is considered dead and may be deleted. ... the symlinks under /var/guix/gcroots represent these GC roots. My own experience is that guix gc reports and removes dead symlinks in this directory. So I guess just remove the symlinks you listed: $ guix package --list-profiles /home/sirgazil/.devenvs/my-project/my-project /home/sirgazil/.devenvs/project-a/project-a /home/sirgazil/.config/guix/current /home/sirgazil/.guix-profile and then call guix gc. Cheers, Moritz
Re: How can I replace Python venv and pip with Guix?
Hi sirgazil, Well, the profile is created and persists, but, after deactivating the environment, how do I start an environment that uses that profile? If you want to use the isolation features of `guix environment`, like running inside a container, you can just use the same command that you used for creating the profile. Guix will not rebuild anything because all derivations are already in the store from the first time you executed this, so guix environment --pure --manifest=guix.scm --root=/path/to/my-guix-envs/my-project Otherwise, you can use the standard way that you can use to load any GUIX profile: You source the /etc/profile file into your shell: GUIX_PROFILE="/path/to/my-guix-envs/my-project"; . "$GUIX_PROFILE"/etc/profile The dot is the shell command `source`. It defines the nessecary environment variables like PATH. Defining the variable GUIX_PROFILE has the effect thatyou always access the newest generation of the profile. If you update your profile while your shell is running, you automatically access the files of the new generation. Read the source code of $GUIX_PROFILE/etc/profile for more info. As a general note, the use case of `guix environment` is to debug how a specific program is built by GUIX. For example, if you want to enter the environment that GUIX creates for the building of GNU hello, you call `guix environment hello`. You enter a profile with the *dependencies* of hello which you can then try to build yourself. If you just want to create a profile following a manifest file, just use guix package --manifest="your-manifest.scm" -p /path/to/profile-folder That said, the containerization features of `guix environment` can be handy in other cases, too. Cheers, Moritz