18 aarch64-darwin = fetchurl {
19 url = "https://www.utc.fr/~mottelet/scilab/download/${version}/scilab-${version}-accelerate-arm64.dmg";
20 sha256 = "sha256-L4dxD8R8bY5nd+4oDs5Yk0LlNsFykLnAM+oN/O87SRI=";
22 x86_64-darwin = fetchurl {
23 url = "https://www.utc.fr/~mottelet/scilab/download/${version}/scilab-${version}-x86_64.dmg";
24 sha256 = "sha256-tBeqzllMuogrGcJxGqEl2DdNXaiwok3yhzWSdlWY5Fc=";
26 x86_64-linux = fetchurl {
27 url = "https://www.scilab.org/download/${version}/scilab-${version}.bin.linux-x86_64.tar.gz";
28 sha256 = "sha256-PuGnz2YdAhriavwnuf5Qyy0cnCeRHlWC6dQzfr7bLHk=";
32 srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
35 homepage = "http://www.scilab.org/";
36 description = "Scientific software package for numerical computations (Matlab lookalike)";
42 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
43 license = lib.licenses.gpl2Only;
44 mainProgram = "scilab";
47 darwin = stdenv.mkDerivation rec {
60 sourceRoot = "scilab-${version}.app";
65 mkdir -p $out/{Applications/scilab.app,bin}
66 cp -R . $out/Applications/scilab.app
67 makeWrapper $out/{Applications/scilab.app/Contents/MacOS,bin}/scilab
73 linux = stdenv.mkDerivation rec {
107 mv -t $out bin include lib share thirdparty
109 -e 's|\$(/bin/|$(|g' \
110 -e 's|/usr/bin/||g' \
111 $out/bin/{scilab,xcos}
113 -e "s|Exec=|Exec=$out/bin/|g" \
114 -e "s|Terminal=.*$|Terminal=true|g" \
115 $out/share/applications/*.desktop
121 if stdenv.hostPlatform.isDarwin then darwin else linux