WS-KCNHUB/machines/kcnhub/packages/matlab.nix

91 lines
2.3 KiB
Nix

{ config, lib, pkgs, nix-matlab, ... }: let
license-manager = pkgs.stdenv.mkDerivation rec {
pname = "matlab-license-server";
version = "R2023b";
src = pkgs.fetchurl {
url = "https://ssd.mathworks.com/supportfiles/downloads/${version}/license_manager/${version}/daemons/glnxa64/mathworks_network_license_manager_glnxa64.zip";
hash = "sha256-Btl3ETzTtAV+cjqwXf4AE4QJCtssN1s6dmmcpR1EQxY=";
};
nativeBuildInputs = [
pkgs.autoPatchelfHook
];
unpackPhase = ''
${pkgs.unzip}/bin/unzip $src
'';
installPhase = ''
mkdir $out
cp -r * $out/
addAutoPatchelfSearchPath $out/*
'';
};
matlab-server = pkgs.buildFHSUserEnv {
name = "matlab-server";
targetPkgs = (ps: nix-matlab.targetPkgs ps ++ [
license-manager
]);
runScript = pkgs.writeScript "matlab-server" (nix-matlab.shellHooksCommon + ''
exec $MATLAB_INSTALL_DIR/bin/matlab "$@"
'');
};
matlab-server-shell = pkgs.buildFHSUserEnv {
name = "matlab-server-shell";
targetPkgs = (ps: nix-matlab.targetPkgs ps ++ [
license-manager
]);
runScript = pkgs.writeScript "matlab-server-shell" (nix-matlab.shellHooksCommon + ''
echo license-server is in:
echo ${license-manager}
echo Make sure it is installed (matlab-server user)
exec bash
'');
};
matlab-mpm = pkgs.stdenv.mkDerivation rec {
pname = "matlab";
version = "2023b-u6";
mpm-version = "2023.12.1";
src = pkgs.fetchurl {
url = "https://ssd.mathworks.com/supportfiles/downloads/mpm/${version}/glnxa64/mpm";
hash = "sha256-NlfPLDnpRIaKLLuIZAudnFHBKL04gzmypzp98QOa6+g=";
};
buildInputs = with pkgs; [
unzip
];
unpackPhase = ''
cp $src ./mpm
chmod +x ./mpm
cp ${./matlab/install_file.txt} ./install_file.txt
'';
patchPhase = ''
subtituteAllInPlace ./install_file.txt
'';
installPhase = ''
./mpm install --inputfile ./install_file.txt
'';
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = pkgs.lib.fakeSha256;
};
in {
environment.systemPackages = (with nix-matlab.packages.x86_64-linux; [
matlab-mpm
matlab
matlab-shell
matlab-server
matlab-server-shell
matlab-mlint
matlab-mex
]) ++ (with pkgs; [
octaveFull
]);
}