Julia via juliaup in GUIX

Hey all, recently posted about using juliaup in NixOS. Now I’m investigating it in GUIX which is a similar OS but using guile scheme as the configuration language.

In GUIX you can run foreign compiled binaries in a container that has a “normal” FHS filesystem hierarchy using guix shell --container --emulate-fhs

here’s what’s working for me:

  1. log into your machine, and at a minimum guix install curl and add ~/bin to PATH
  2. install juliaup using the commands on julialang.org
  3. create bin/juliacontainer in your home directory containing something similar to:
#!/usr/bin/env bash

guix shell --container --emulate-fhs --preserve="(TERM)|(LANG)" --network --expose=/etc/bashrc=/etc/bashrc\
 --expose=/run/current-system/locale=/run/current-system/locale\
 --share=/home/dlakelan/.bash_profile=/home/dlakelan/.bash_profile\
 --share=/home/dlakelan/.bashrc=/home/dlakelan/.bashrc\
 --share=/home/dlakelan/.julia=/home/dlakelan/.julia\
 --share=/home/dlakelan/juliaprojects=/home/dlakelan/juliaprojects -m .config/guix/juliamanifest.scm 
  1. write a manifest in .config/guix/juliamanifest.scm like this. This was the minimum to get comfortably into julia and debug stuff, feel free to add packages you want.
(specifications->manifest
 (list "emacs-no-x" "curl" "wget" "git" "coreutils" "less" "bash"))
  1. at your command line type juliacontainer
  2. in the new shell type bash because I’m not sure why but it doesn’t read .bashrc etc
  3. profit!

works for me!

Method 2

Ok, so there’s an easier way… we just need to patch the ELF file to point to the proper library:

patchelf --set-interpreter "$(patchelf --print-interpreter $(which sh))" .julia/juliaup/julia-1.11.5+0.x64.linux.gnu/bin/julia

and then you can run julia not in a special container… seems to work. but you’ll need to patch it every time you install a new version. Also, you might want to create a separate patched version and a bin/julia script that calls that patched version

4 Likes