mirror of
https://git.adityakumar.xyz/nix-matlab.git
synced 2024-11-09 16:19:45 +00:00
Use an imperative installation directory
Add some basic installation steps to the README to be also printed in the devShell.
This commit is contained in:
parent
a99031a8e7
commit
945f1100e0
3 changed files with 65 additions and 9 deletions
30
README.adoc
30
README.adoc
|
@ -1,17 +1,37 @@
|
|||
= Matlab for Nix users
|
||||
|
||||
This repo is a collection of files that should help Nix and NixOS users install matlab imperatively.
|
||||
This repo is a collection of files that should help Nix and NixOS users install Matlab imperatively.
|
||||
|
||||
== How to use this
|
||||
== Install
|
||||
|
||||
=== Installation of matlab itself
|
||||
Like any other Matlab user, you should first go to your Matlab account on
|
||||
Mathworks' website, at: https://www.mathworks.com/mwaccount/ and download the
|
||||
installation zip file. Extract the zip file and note the `install` executable
|
||||
you just extracted. To run that file, you'll need to get into a FHS environment
|
||||
that a nix-shell will provide.
|
||||
|
||||
==== Run `matlab-shell` with +++<s>stable</s>+++ legacy Nix
|
||||
=== Run `matlab-shell` with an unstable Nix
|
||||
|
||||
==== Run `matlab-shell` with an unstable Nix
|
||||
....
|
||||
nix run github:doronbehar/nix-matlab#matlab-shell
|
||||
....
|
||||
|
||||
=== Run `matlab-shell` with +++<s>stable</s>+++ legacy Nix
|
||||
|
||||
....
|
||||
git clone https://github.com/doronbehar/nix-matlab
|
||||
cd nix-matlab
|
||||
nix-shell
|
||||
....
|
||||
|
||||
=== Installation of Matlab itself
|
||||
|
||||
include::./install.adoc[]
|
||||
|
||||
=== Adding `matlab` executables to your system
|
||||
|
||||
TODO:: Write this
|
||||
|
||||
==== For NixOS users with a flakes setup
|
||||
|
||||
==== For NixOS users without a flakes setup
|
||||
|
|
35
flake.nix
35
flake.nix
|
@ -13,12 +13,21 @@
|
|||
# supported
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
targetPkgs = import ./common.nix;
|
||||
# TODO: Make it possible to override this - imperatively or declaratively?
|
||||
defaultRunPath = "$HOME/downloads/software/matlab/installation";
|
||||
runScriptPrefix = ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
# Needed for simulink even on wayland systems
|
||||
export QT_QPA_PLATFORM=xcb
|
||||
# Search for an imperative declaration of the installation directory of matlab
|
||||
if [[ -f ~/.config/matlab/nix.sh ]]; then
|
||||
source ~/.config/matlab/nix.sh
|
||||
else
|
||||
echo "nix-matlab-error: Did not find ~/.config/matlab/nix.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "$INSTALL_DIR" ]]; then
|
||||
echo "nix-matlab-error: INSTALL_DIR $INSTALL_DIR isn't a directory" >&2
|
||||
exit 2
|
||||
fi
|
||||
'';
|
||||
in {
|
||||
|
||||
|
@ -26,18 +35,36 @@
|
|||
name = "matlab";
|
||||
inherit targetPkgs;
|
||||
runScript = runScriptPrefix + ''
|
||||
exec ${defaultRunPath}/bin/matlab "$@"
|
||||
exec $INSTALL_DIR/bin/matlab "$@"
|
||||
'';
|
||||
};
|
||||
packages.x86_64-linux.matlab-shell = pkgs.buildFHSUserEnv {
|
||||
name = "matlab-shell";
|
||||
inherit targetPkgs;
|
||||
runScript = ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
# needed for simulink in fact, but doesn't harm here as well.
|
||||
export QT_QPA_PLATFORM=xcb
|
||||
cat <<EOF
|
||||
============================
|
||||
welcome to nix-matlab shell!
|
||||
|
||||
To install matlab:
|
||||
${nixpkgs.lib.strings.escape ["`" "'" "\"" "$"] (builtins.readFile ./install.adoc)}
|
||||
|
||||
4. Finish the installation, and exit the shell (with `exit`).
|
||||
5. Continue on with the instructions for making the matlab executable available
|
||||
anywhere on your system.
|
||||
============================
|
||||
EOF
|
||||
exec bash
|
||||
'';
|
||||
};
|
||||
packages.x86_64-linux.mlint = pkgs.buildFHSUserEnv {
|
||||
name = "mlint";
|
||||
inherit targetPkgs;
|
||||
runScript = runScriptPrefix + ''
|
||||
exec ${defaultRunPath}/bin/glnxa64/mlint "$@"
|
||||
exec $INSTALL_DIR/bin/glnxa64/mlint "$@"
|
||||
'';
|
||||
};
|
||||
overlay = final: prev: {
|
||||
|
|
9
install.adoc
Normal file
9
install.adoc
Normal file
|
@ -0,0 +1,9 @@
|
|||
1. Run the `install` executable extracted from the installation zip file.
|
||||
2. Follow along with the installation wizard:
|
||||
- When prompted for an install location, select a user-writable directory.
|
||||
3. Create the file `~/.config/matlab/nix.sh` and write to it simply, (e.g):
|
||||
|
||||
....
|
||||
INSTALL_DIR=$HOME/downloads/software/matlab/installation
|
||||
....
|
||||
|
Loading…
Reference in a new issue