{ description = "Nix files made to ease imperative installation of matlab"; # https://nixos.wiki/wiki/Flakes#Using_flakes_project_from_a_legacy_Nix inputs.flake-compat = { url = "github:edolstra/flake-compat"; flake = false; }; outputs = { self, nixpkgs, flake-compat }: let # We don't use flake-utils.lib.eachDefaultSystem since only x86_64-linux is # supported pkgs = nixpkgs.legacyPackages.x86_64-linux; targetPkgs = import ./common.nix; 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 { packages.x86_64-linux.matlab = pkgs.buildFHSUserEnv { name = "matlab"; inherit targetPkgs; runScript = runScriptPrefix + '' 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 <