17 aarch64-darwin = fetchurl {
18 url = "https://www.utc.fr/~mottelet/scilab/download/${version}/scilab-${version}-accelerate-arm64.dmg";
19 sha256 = "sha256-L4dxD8R8bY5nd+4oDs5Yk0LlNsFykLnAM+oN/O87SRI=";
21 x86_64-darwin = fetchurl {
22 url = "https://www.utc.fr/~mottelet/scilab/download/${version}/scilab-${version}-x86_64.dmg";
23 sha256 = "sha256-tBeqzllMuogrGcJxGqEl2DdNXaiwok3yhzWSdlWY5Fc=";
25 x86_64-linux = fetchurl {
26 url = "https://www.scilab.org/download/${version}/scilab-${version}.bin.linux-x86_64.tar.gz";
27 sha256 = "sha256-PuGnz2YdAhriavwnuf5Qyy0cnCeRHlWC6dQzfr7bLHk=";
30 src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
33 homepage = "http://www.scilab.org/";
34 description = "Scientific software package for numerical computations (Matlab lookalike)";
35 platforms = [ "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ];
36 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
37 license = lib.licenses.gpl2Only;
38 mainProgram = "scilab";
41 darwin = stdenv.mkDerivation rec {
42 inherit pname version src meta;
49 sourceRoot = "scilab-${version}.app";
54 mkdir -p $out/{Applications/scilab.app,bin}
55 cp -R . $out/Applications/scilab.app
56 makeWrapper $out/{Applications/scilab.app/Contents/MacOS,bin}/scilab
62 linux = stdenv.mkDerivation rec {
63 inherit pname version src meta;
89 mv -t $out bin include lib share thirdparty
91 -e 's|\$(/bin/|$(|g' \
93 $out/bin/{scilab,xcos}
95 -e "s|Exec=|Exec=$out/bin/|g" \
96 -e "s|Terminal=.*$|Terminal=true|g" \
97 $out/share/applications/*.desktop
103 if stdenv.isDarwin then darwin else linux