Skip to content

Instantly share code, notes, and snippets.

@sguzman
Forked from kinnala/README.md
Last active September 25, 2023 18:39
Show Gist options
  • Save sguzman/80fe0cccec4add5fa595ecf17ebe0fb9 to your computer and use it in GitHub Desktop.
Save sguzman/80fe0cccec4add5fa595ecf17ebe0fb9 to your computer and use it in GitHub Desktop.
Install Mathematica in NixOS

First you find a copy of Mathematica_13.2.1_LINUX.sh or similar and find its sha256sum. Then you go to nixpkgs and copy all Mathematica files to a local directory. You need to modify default.nix and wrap its contents into

let pkgs = import <nixpkgs> {};
in pkgs.callPackage (
  # whatever is in default.nix
) {}

Next modify sha256 checksum and filename in version.nix to match what you have above. Run nix hash file Mathematica_13.2.1_BNDL_LINUX.sh. Finally, running nix-build will install Mathematica to Nix store.

@Bodleum
Copy link

Bodleum commented Sep 18, 2023

I'm getting an error running this. I'm a pretty new Nix user and I'm totally stumped! Any help is much appreciated!
Output of nix-build

NOTE: Unable to determine the package manager used by the
system--skipping the optional install of WolframScript system
integration. Installer packages in the RPM and DEB formats have been left in
"/nix/store/vp27jh8g9krp8pfqmbf09qjv88q384ig-mathematica-13.3.1/libexec/Mathematica/SystemFiles/Installation".
Consult your system documentation on how such packages might be installed.

WARNING: No Avahi Daemon was detected so some Kernel Discovery features will
not be available. You can install Avahi Daemon using your distribution's
package management system.

Go to http://avahi.org for more information.

error: builder for '/nix/store/d095ldrs9k6hj38ml9d57xx8lw601hl2-mathematica-13.3.1.drv' failed with exit code 127;

@sguzman
Copy link
Author

sguzman commented Sep 20, 2023

Hello! I am no longer running Nix (I'm back on Arch) so it will take me some time to test this. Unfortunately, it seems like every build of Mathematica is it's own beast so I will have to test with the latest one, 13.3.1.

Do you know if the error code you're getting, 127, has some message or description? I forgot what that code means :)

@Bodleum
Copy link

Bodleum commented Sep 20, 2023

From the Nix reference 127 doesn't seem to be in use!
Run again with max verbosity gives this, which doesn't shed much light for me.

WARNING: No Avahi Daemon was detected so some Kernel Discovery features will
not be available. You can install Avahi Daemon using your distribution's
package management system.
waiting for children
building of '/nix/store/d095ldrs9k6hj38ml9d57xx8lw601hl2-mathematica-13.3.1.drv!out' from .drv file: read 1 bytes

waiting for children
building of '/nix/store/d095ldrs9k6hj38ml9d57xx8lw601hl2-mathematica-13.3.1.drv!out' from .drv file: read 45 bytes
Go to http://avahi.org for more information.
waiting for children
building of '/nix/store/d095ldrs9k6hj38ml9d57xx8lw601hl2-mathematica-13.3.1.drv!out' from .drv file: read 1 bytes

waiting for children
building of '/nix/store/d095ldrs9k6hj38ml9d57xx8lw601hl2-mathematica-13.3.1.drv!out' from .drv file: got EOF
building of '/nix/store/d095ldrs9k6hj38ml9d57xx8lw601hl2-mathematica-13.3.1.drv!out' from .drv file: woken up
building of '/nix/store/d095ldrs9k6hj38ml9d57xx8lw601hl2-mathematica-13.3.1.drv!out' from .drv file: build done
killing process 6195
builder process for '/nix/store/d095ldrs9k6hj38ml9d57xx8lw601hl2-mathematica-13.3.1.drv' finished
killing all processes running under uid '30001'
lock released on '/nix/store/vp27jh8g9krp8pfqmbf09qjv88q384ig-mathematica-13.3.1.lock'
building of '/nix/store/d095ldrs9k6hj38ml9d57xx8lw601hl2-mathematica-13.3.1.drv!out' from .drv file: done
building of '/nix/store/d095ldrs9k6hj38ml9d57xx8lw601hl2-mathematica-13.3.1.drv!out' from .drv file: goal destroyed
error: builder for '/nix/store/d095ldrs9k6hj38ml9d57xx8lw601hl2-mathematica-13.3.1.drv' failed with exit code 127

@sguzman
Copy link
Author

sguzman commented Sep 25, 2023

Wow you're right haha. I'm going to spin up a qemu instance of NixOS. I need to see for myself. I'll try installing 13.3.1. I'll let you know about my results :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment