Matlab server + Octave

David Crompton 2023-09-26 11:44:11 -04:00
parent f5169b2fa2
commit f708baaf85
1 changed files with 52 additions and 3 deletions

View File

@ -1,8 +1,57 @@
{ config, lib, pkgs, nix-matlab, ... }: {
environment.systemPackages = with nix-matlab.packages.x86_64-linux; [
{ 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
]);
}