Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matlab: init at R2024b #356831

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Conversation

james-atkins
Copy link
Contributor

Fixes #56887.

https://www.mathworks.com/products/matlab.html

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@arunoruto
Copy link
Contributor

This looks awesome!
I tried to test build it via nixpkgs-review, but it fails telling me, that the attribute gtk is missing in gnome2.gtk.

@ShamrockLee
Copy link
Contributor

Unless multi-version support is intended, it should be moved to pkgs/by-name/matlab/package.nix.

@arunoruto
Copy link
Contributor

Result of nixpkgs-review pr 356831 run on x86_64-linux 1

1 package built:
  • matlab

@james-atkins
Copy link
Contributor Author

Yes, I have mixed feelings about the multi-versions. I think I might change to a single version and then add an option so the user can override the version downloaded via mpm (this is what mathematica does). Will move to by-name if I go down this route.

@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 labels Nov 18, 2024
Copy link
Contributor

@ShamrockLee ShamrockLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fetchers and the main package are built assuming that packages from MPM must be fetched together, and Matlab must always be fetched together with other packages. This means the user will always need to re-fetch and rebuild matlab whenever they want additional software provided by mpm, such as Simulink.

Could Matlab and related packages like Simulink be packaged separately and made to depend on one another? That could save the user quite some bandwidth.

pkgs/applications/science/math/matlab/fetcher.nix Outdated Show resolved Hide resolved
pkgs/applications/science/math/matlab/fetcher.nix Outdated Show resolved Hide resolved
pkgs/applications/science/math/matlab/fetcher.nix Outdated Show resolved Hide resolved
pkgs/applications/science/math/matlab/fetcher.nix Outdated Show resolved Hide resolved
pkgs/applications/science/math/matlab/mpm.nix Outdated Show resolved Hide resolved
@james-atkins
Copy link
Contributor Author

james-atkins commented Nov 21, 2024

Good question - having to redownload Matlab all over again was something I experienced when I was trying to install extra products. But mpm automatically installs necessary dependencies and doesn't seem to support incremental downloads so I'm not sure whether it would be possible to avoid redownloading Matlab.

The docs for mpm download say "The destination folder must not contain any product files previously downloaded using mpm download. If you specify a folder with existing product files, mpm issues an error."

Update: I've checked and it isn't possible to download other software without mpm pulling down Matlab too.

Copy link
Contributor

@2xsaiko 2xsaiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you use this for situations where what you have is

  • the install ISO + install key
  • *.lic files defining license servers that you want to add to the package for system-wide use

Does it expose any programs in bin (matlab, mex, mlint for example, or a script to enter the FHS env)? I don't see where but I'm also not too familiar with buildFHSEnv.

For comparison, I also recently wrote a package which does all of the above. master...2xsaiko:nixpkgs:push-nuzoruwspqxl

pkgs/applications/science/math/matlab/matlab.nix Outdated Show resolved Hide resolved
@james-atkins
Copy link
Contributor Author

james-atkins commented Nov 26, 2024

Thanks! I'll have a look at your version.

  1. mpm can also install from an mounted iso rather than the downloaded sources. This would be useful to add.
  2. I have an WIP version that I haven't pushed yet that handles other licensing situations more generally. *.lic files can be added using the MLM_LICENSE_FILE environment variable or put into the licenses directory.
  3. Agree exposing other MATLAB binaries would be good.

@james-atkins
Copy link
Contributor Author

I've pushed a new version that should allow installation from an ISO. But I can't test it as I don't have access to an ISO... Something like this should work:

matlab.overrideAttrs (attrs: {
  version = "R2024aU2";
  src = requireFile {
      name = "R2024a_Update_2_Linux.iso";
      url = "https://mathworks.com/products/matlab.html";
      hash = "sha256-Is6cdF49ec6tHjvmUQrCcpmCVMDjaeDq9IJXPh9A5Q0=";
    };
})

The fetcher works nicely too:

matlab.overrideAttrs (attrs: {
  src = fetchFromMPM {
    release = "R2024b";
    update = 1;
    extra-products = [
      "Econometrics_Toolbox"
      "Global_Optimization_Toolbox"
      "Mapping_Toolbox"
      "Optimization_Toolbox"
      "Parallel_Computing_Toolbox"
      "Statistics_and_Machine_Learning_Toolbox"
    ];
    hash = "sha256-pihdXo7+sa4id2z5Ou5QXbdx682eviOqQON04LKhrsk=";
  };
})

@james-atkins
Copy link
Contributor Author

Should system-wide license servers be configured using a NixOS module (probably more idiomatic) or by overriding the package?

@arunoruto
Copy link
Contributor

arunoruto commented Dec 10, 2024

Should system-wide license servers be configured using a NixOS module (probably more idiomatic) or by overriding the package?

Having an entry like programs.matlab.license would be ideal. Matlab supports the MLM_LICENSE_FILE and LM_LICENSE_FILE variables and can be set to a path in the nix store.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

package request: Matlab
4 participants