3 ms·
Can guix be used somewhat like virtualenv? I'm not sure I want to install guix on my main Archlinux box, as I don't want conflicts with the existing libraries
by 1_player 11y ago
Can guix be used somewhat like virtualenv?
I'm not sure I want to install guix on my main Archlinux box, as I don't want conflicts with the existing libraries and applications, but I would very much play with it if it were possible to do something like this:
guix virtualenv myapp
cd myapp
guix activate
guix install postgres # installs a local postgres installation available only on this "environment"
guix environment -l myapp.scm # install app dependencies
<do work>
guix deactivate
This would be a killer feature for me and I would ditch virtualenv, pip, npm, perhaps Docker in a heartbeat.
- rekado 11y ago> I'm not sure I want to install guix on my main Archlinux box, as I don't want conflicts with the existing libraries and applications That's the beauty of functional package management: no global state is modified. Whatever Guix does is restricted to its own namespace, e.g. the /gnu directory. Every package that is built or installed ends up there and is completely isolated from the rest of the system. To actually use the software you use a link to a profile (which is located in the "local state" directory of Guix). You can install packages into separate profiles with Guix: guix package -p /path/to/dev/profile -i postgresql Or you can just run a shell in a volatile environment as specified in `myapp.scm` guix environment -l myapp.scm To exit this environment, just exit the shell. In summary: it can already be used just like you want, but it's much less verbose :)
- davexunit 11y agoYes, the 'guix environment' tool is like a language-agnostic virtualenv. Guix does not use or interfere with any components from the host distro, so you can install Guix on top of Arch Linux without fear. We have a binary installation method[0] that isn't too difficult that you can try out. I use Guix on top of an Ubuntu host at work. For your PostgreSQL example, you'd still need to do things like initialize the DB cluster and start the daemon on your own (the GuixSD distro has a system service for this[1]), but to spawn a shell with the postgres daemon and client programs available you would run: guix environment --ad-hoc postgresql Exiting the sub-shell would do essentially what you had in mind with 'guix deactivate': Make postgresql available for garbage collection (via 'guix gc') if/when nothing else is using it. [0] https://gnu.org/software/guix/manual/html_node/Binary-Installation.html#Binary-Installation https://gnu.org/software/guix/manual/html_node/Binary-Instal... [1] https://gnu.org/software/guix/manual/html_node/Database-Services.html#Database-Services https://gnu.org/software/guix/manual/html_node/Database-Serv...
- 1_player 11y agoThe point was to install the deps into my project tree, instead of putting everything into /gnu, but to think of it that's not actually much of a problem, it's just personal preference/bikeshedding. I'm installing it and see how it goes, thanks.
- rekado 11y ago"Installing" a package with Guix really just means that it is referenced through a link. /gnu is just a cache for "evaluated" package recipes. You could create a profile that contains your symlinks to the items in the store wherever you want, including the currenty directory. guix package -p $(pwd)/.guix-profile -i what ever you want Programmes in this profile can then be executed like so: ./.guix-profile/bin/what But that's not necessary when you could just use `guix environment` and enter a shell where everything is already hooked up.
- rokgarbas 11y agonix has tools to convert gemfile into nix expressions http://lists.science.uu.nl/pipermail/nix-dev/2015-January/015780.html http://lists.science.uu.nl/pipermail/nix-dev/2015-January/01...