Julia with binary extension

Does anybody has experience with using Julia on NixOS?

Julia’s package manager often installs precompiled libraries, which do not link unpatched on NixOS. I’ve tried to use autoPatchelf, like I use it on Python. However, that does not seem to work. It cannot resolve all dependencies and precompilation in Julia fails.

Using an FHS env seems to work, but I find it a bit unsatisfying.

Do you have better workarounds?

1 Like

FWIW, the wiki.nixos.org page on Julia also suggests using a tool like Distrobox as another workaround option.


Did you try with this?

Well, I had nix-ld-rs set-up the whole time, but it didn’t seem to help.

programs.nix-ld = {
    enable = true;
    package = pkgs.nix-ld-rs;

For reference, FHS helps:

  description = "A julia dev flake";

  inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; };

  outputs = { self, nixpkgs }:
      supportedSystems = [ "x86_64-linux" ];
      forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
      pkgs = forAllSystems (system: import nixpkgs { inherit system; });
      fhs_julia = (system:
        pkgs.${system}.buildFHSUserEnv {
          name = "julia-env";
          targetPkgs = pkgs:
            (with pkgs; [ julia gcc zlib ]);
          runScript = "bash";
    in {
      devShells = forAllSystems (system: {
        default = {};
        fhs = (fhs_julia system).env;