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

58 lines
1.5 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
'');
};
in {
environment.systemPackages = (with nix-matlab.packages.x86_64-linux; [
matlab
matlab-shell
matlab-server
matlab-server-shell
matlab-mlint
matlab-mex
]) ++ (with pkgs; [
octaveFull
]);
}