From a476a83bc7a81e6c8765837162475761cfd92875 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Fri, 14 May 2021 16:02:26 +0300 Subject: [PATCH] Add all files from tviti's repo --- common.nix | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ default.nix | 9 ++++++++ matlab.nix | 17 ++++++++++++++ mlint.nix | 9 ++++++++ 4 files changed, 100 insertions(+) create mode 100644 common.nix create mode 100644 default.nix create mode 100644 matlab.nix create mode 100644 mlint.nix diff --git a/common.nix b/common.nix new file mode 100644 index 0000000..98e79a3 --- /dev/null +++ b/common.nix @@ -0,0 +1,65 @@ +/* This list of dependencies is based on the official Mathworks dockerfile for + R2020a, available at + https://github.com/mathworks-ref-arch/container-images +*/ + +{ }: + +rec { + runPath = "$HOME/downloads/software/matlab/installation"; + targetPkgs = pkgs: + with pkgs; + [ + cacert + alsaLib # libasound2 + atk + glib + glibc + cairo + cups + dbus + fontconfig + gdk-pixbuf + #gst-plugins-base + # gstreamer + gtk3 + nspr + nss + pam + pango + python27 + python36 + python37 + libselinux + libsndfile + glibcLocales + procps + unzip + zlib + + gcc + gfortran + + # nixos specific + udev + jre + ncurses # Needed for CLI + ] ++ (with xorg; [ + libSM + libX11 + libxcb + libXcomposite + libXcursor + libXdamage + libXext + libXfixes + libXft + libXi + libXinerama + libXrandr + libXrender + libXt + libXtst + libXxf86vm + ]); +} diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..067e3ac --- /dev/null +++ b/default.nix @@ -0,0 +1,9 @@ +{ callPackage }: + +# TODO: Be explicit about versions in file and object names! +let + common = import ./common.nix { }; +in { + matlab = callPackage ./matlab.nix { inherit common; }; + mlint = callPackage ./mlint.nix { inherit common; }; +} diff --git a/matlab.nix b/matlab.nix new file mode 100644 index 0000000..1a270de --- /dev/null +++ b/matlab.nix @@ -0,0 +1,17 @@ +{ common, writeScriptBin, buildFHSUserEnv }: + +let + matlab-wrapped = with common; + writeScriptBin "matlab" '' + #!/bin/sh + export MATLAB_JAVA=/usr/lib/openjdk + export QT_QPA_PLATFORM=xcb + exec ${runPath}/bin/matlab "$@" + ''; +in buildFHSUserEnv { + name = "matlab"; + + targetPkgs = pkgs: with pkgs; (common.targetPkgs pkgs) ++ [ matlab-wrapped ]; + + runScript = "${matlab-wrapped}/bin/matlab"; +} diff --git a/mlint.nix b/mlint.nix new file mode 100644 index 0000000..ea96854 --- /dev/null +++ b/mlint.nix @@ -0,0 +1,9 @@ +{ common, buildFHSUserEnv }: + +buildFHSUserEnv { + name = "mlint"; + + inherit (common) targetPkgs; + + runScript = with common; "${runPath}/bin/glnxa64/mlint"; +}