Using Juliaup on NixOS (2025 edition)

Hey Julia friends. I’ve been trying to figure this out this morning in response to a student who is using NixOS and has convinced me to give it a try. In general on NixOS nothing is in the filesystem where things expect them to be (like in /lib or /usr/lib/ or /usr/bin/ or anything like that).

This means if you download precompiled binaries off the internet they generally won’t run. So if you want to use juliaup in your home directory on a NixOS machine, here’s how I got it working (apparently, tested to work for some very mild test cases).

  1. enable nix-ld on your NixOS config via programs.nix-ld.enable = true;
  2. Make sure you have a .bashrc file (might not if you have a brand new machine, if needed do echo "" > ~/.bashrc
  3. install juliaup according to the instructions on julialang.org
  4. run julia via the following command (or create a shell script)
NIX_LD_LIBRARY_PATH=~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/lib/julia julia

nix-ld uses this environment variable to add to the “real” LD_LIBRARY_PATH when it loads julia, thereby avoiding having you link to some system version of stuff… In particular without it you’ll get an error about libcurl when doing package operations. Vscode julia language server cannot load on recent nixos

Now, you’re going to have to be responsible for changing this path when you update julia. So maybe make yourself a ~/bin/julianix script and update the script when you update julia.

Have a good time using Julia on NixOS!

EDIT: added this little shell script which auto-determines the directory from the default julia:

#!/usr/bin/env bash

VERS=$(juliaup status | sed -n -e "s/ *\*.* 1/1/p")

NIX_LD_LIBRARY_PATH=~/.julia/juliaup/${VERS}/lib/julia ~/.juliaup/bin/julia "$@"
3 Likes

It may be OT, but would me nice to have a summary of these arguments.. :slight_smile:

The main reason to use NixOS is that you can declare what you want installed in a file, and it will build that installation for you. Also, if you declare stuff that didn’t work, it is transactional so you can roll back to the previous build. I have a lot of machines I need to administer (like 20 total) so being able to centralize how each one is configured and adjust it in a text file and push it out is super useful.

For the student I think it was more about making his PhD project reproducible via the nix shell stuff, which is kind of user-level environment similar to julia’s environments except for the whole project not just the julia part.

1 Like