Does anyone have a good modern setup for NixOS + Julia? recently switched my linux distro over from pop_os! and overall I like the declarative philosophy, and for 90% of things i can get it to “just work,” but Julia is another story. I found this thread from awhile ago, but I was curious if there were any updates in this space.
Edit:
Sorry my original post was far too vague. I’m installing Julia on a per-directory basis using flakes. My bigger issue has been VSCode integration and Pkg being able to build libraries that are part of my Project.toml file. I was able to fix it using this flake configuration:
{
description = "Julia dev env with libquadmath";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }: let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
# Hardcoded known-good libquadmath path
gccLibPath = "/nix/store/gv7z0km39q3fgzavpic8vrl7smh5n2w6-gcc-14.2.1.20250322-lib/lib";
in {
devShells.${system}.default = pkgs.mkShell {
buildInputs = [
pkgs.julia_111
pkgs.gcc13 # still good for headers and general usage
pkgs.libffi
pkgs.zlib
];
shellHook = ''
export JULIA_DEPOT_PATH=$(pwd)/.julia_depot
export LD_LIBRARY_PATH=${gccLibPath}:$LD_LIBRARY_PATH
export LD_PRELOAD=${gccLibPath}/libquadmath.so.0
echo "Notebook and REPL now forced to preload libquadmath"
'';
};
};
}
I then put this in my main flake.nix
# auto run nix develop
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
My biggest issue from here was just getting it to work with notebooks in VSCode. My only oslution has been to open code from my direnv shell. Not my favorite fix but it works for now.