Installing Matlab on NixOS

I have to use Matlab for a college course. Unfortunately, I don’t have access to the web-based version of Matlab, and I’m not allowed to use open-source alternatives such as Octave. I wasn’t able to find Matlab in nixpkgs (understandably), and was wondering how to install it on my NixOS system by creating my own derivation.

This might be somewhat hard. I would start by trying steam-run.

There is an expression in GitHub - Nix-QChem/NixOS-QChem: Nix expressions for HPC/Quantum chemistry software packages by @markuskowa.

All that wrapping is of course slightly version dependent.

I asked a friend to give me the FHS environment expression we debugged together based on the code by others but tested to make a specific set of versions of Matlab and some other maths software work; here it is: https://github.com/7c6f434c/7c6f434c-configurations/blob/7fe35d36308fcd9089413727aa31af35c9728521/matlab-fhs-env.nix (similar to steam-run solution, only without Steam)

(I was just in a Nixpkgs support role, so I do not know what exact version of Matlab was used)

1 Like

I use the FHS environment also to run the Matlab installer. The FHS solution is not perfect but it gets the job done (I use it on a daily basis).

1 Like

After lots of debugging, the FHS solution worked. Thank you so much!

1 Like

After lots of debugging, the FHS solution worked. Thank you so much!

Maybe you could post your version of the environment definition, too?

1 Like

1.5 years ago I also created an fhs env with a nix-shell and some scripts. It’s a bit quirky (especially the shell part) but it worked back then. Maybe it helps someone. In the nix shell I could install it without problems, and later I just started it with the matlab script.

3 Likes

(Sorry for the late reply). I wrote an explanation of my process here, which has a link to the environment definition I used. The definition might have some extra packages here and there, but it works.

1 Like