Get going with Julia on NixOS in under an hour

TLDR

Do you have a recipe that would allow me to run a Julia Pluto notebook on NixOS, in under one hour?

Details

The Julia-NixOS story is nowhere near as advanced as support for working with Haskell/Rust/Python/etc. on NixOS. Additionally, it seems that the Julia-NixOS interaction might be especially … interesting, as the latest incarnation of the Julia package manager seems to re-implement some of Nix’ ideas.

Having made two separate attempts to understand the state of play, as is so often the case in Nix, after much reading, I don’t feel any closer to having a practical solution to my short-term problem: being able to contribute to someone’s Julia/Pluto project.

I get the impression that buildFHSUserEnv (which I have never used before) might be a good way to go in my current case: I need to contribute to

  • a Julia/Pluto project
  • authored by someone who does not use Nix
  • using plenty of Julia packages, including Python-based ones such as Pandas
  • without dedicating a week of my life to setting it up

As looming deadlines leave me with no time to spare, I’ll have to give up on the whole idea unless I can get something working in not much more than an hour.

I could justify a second hour for the purpose of improving my Julia development experience in Spacemacs.

Can you offer any practical advice?

1 Like

You provided the impetus to finally get my internal setup for Julia out on github. There may be some things that don’t work because they accidentally rely on other things in my config, if so feel free to open an issue. Anyways, here is the github: GitHub - olynch/scientific-fhs: A nixos FHS for julia and conda, and possibly other scientific tools. It should be relatively easy to set up.

4 Likes

In my not-so-extensive testing, this seems to work like a charm.

In addition to showing how to use it in home.packages and environment.systemPackages, you might point out that it also works in shell.nix/mkShell etc.

Thank you so much!

The julia ecosystem on NixOS is something that’s actively being worked on. Right now julia: cleanup/reorganisation · Pull Request #117881 · NixOS/nixpkgs · GitHub is the main thrust AFAIK. It should unbreak a bunch of the nixpkgs julia versions and get us julia 1.6.

Once that lands, it should be as simple as installing Pluto and running it :crossed_fingers:

Awesome! Glad to be of help! Yeah good point for shell.nix; I should also add a shell.nix file to the repo, and maybe also a flake.nix with a devShell. I also actually have a home-manager module that configures this, but I need to figure out how to extricate this from my config too.