From 0a9579764655dc30dadb2117ceed8bf74f08db3b Mon Sep 17 00:00:00 2001 From: qbg Date: Sat, 27 Nov 2021 18:15:41 -0600 Subject: [PATCH 1/2] mathematica: Install desktop items Install the desktop items so users can launch Mathematica from their desktop environment, notebooks are associated with Mathematica, etc. (cherry picked from commit 97da277f17313357cf38f1a2e744fdc1e42aa168) --- pkgs/applications/science/math/mathematica/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/applications/science/math/mathematica/default.nix b/pkgs/applications/science/math/mathematica/default.nix index 10301f062e57..34e3aaa14382 100644 --- a/pkgs/applications/science/math/mathematica/default.nix +++ b/pkgs/applications/science/math/mathematica/default.nix @@ -92,6 +92,10 @@ stdenv.mkDerivation rec { sed -i -e 's/^PATH=/# PATH=/' MathInstaller sed -i -e 's/\/bin\/bash/\/bin\/sh/' MathInstaller + # Install the desktop items + sed -i -e 's/Executables\/Mathematica/..\/..\/bin\/mathematica/' MathInstaller + export XDG_DATA_HOME="$out/share" + echo "=== Running MathInstaller ===" ./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/Mathematica -silent From a6d2090240802eeb0a9f9fd4e5f121102d558f52 Mon Sep 17 00:00:00 2001 From: qbg Date: Wed, 1 Dec 2021 23:12:32 -0600 Subject: [PATCH 2/2] mathematica: prefer substituteInPlace over sed Reduces the amount of escaping needed for these literal string replacements. (cherry picked from commit 2bdaa8d08300460f24bb3be13e99a6a658ae4207) --- pkgs/applications/science/math/mathematica/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/science/math/mathematica/default.nix b/pkgs/applications/science/math/mathematica/default.nix index 34e3aaa14382..af8826388977 100644 --- a/pkgs/applications/science/math/mathematica/default.nix +++ b/pkgs/applications/science/math/mathematica/default.nix @@ -90,10 +90,15 @@ stdenv.mkDerivation rec { cd Installer # don't restrict PATH, that has already been done sed -i -e 's/^PATH=/# PATH=/' MathInstaller - sed -i -e 's/\/bin\/bash/\/bin\/sh/' MathInstaller + + # Fix the installation script as follows: + # 1. Adjust the shebang + # 2. Use the wrapper in the desktop items + substituteInPlace MathInstaller \ + --replace "/bin/bash" "/bin/sh" \ + --replace "Executables/Mathematica" "../../bin/mathematica" # Install the desktop items - sed -i -e 's/Executables\/Mathematica/..\/..\/bin\/mathematica/' MathInstaller export XDG_DATA_HOME="$out/share" echo "=== Running MathInstaller ==="