Files
nixpkgs/pkgs/by-name/ma/mathematica/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

84 lines
2.4 KiB
Nix

{
callPackage,
config,
lib,
cudaPackages,
cudaSupport ? config.cudaSupport,
lang ? "en",
webdoc ? false,
version ? null,
/*
If you wish to completely override the src, use:
my_mathematica = mathematica.override {
source = pkgs.requireFile {
name = "Mathematica_XX.X.X_BNDL_LINUX.sh";
# Get this hash via a command similar to this:
# nix-store --query --hash \
# $(nix store add-path Mathematica_XX.X.X_BNDL_LINUX.sh --name 'Mathematica_XX.X.X_BNDL_LINUX.sh')
sha256 = "0000000000000000000000000000000000000000000000000000";
message = ''
Your override for Mathematica includes a different src for the installer,
and it is missing.
'';
hashMode = "recursive";
};
}
*/
source ? null,
}:
let
versions = callPackage ./versions.nix { };
matching-versions = lib.sort (v1: v2: lib.versionOlder v2.version v1.version) (
lib.filter (
v: v.lang == lang && (version == null || isMatching v.version version) && matchesDoc v
) versions
);
found-version =
if matching-versions == [ ] then
throw (
"No registered Mathematica version found to match"
+ " version=${toString version} and language=${lang},"
+ " ${if webdoc then "using web documentation" else "and with local documentation"}"
)
else
lib.head matching-versions;
isMatching =
v1: v2:
let
as = lib.splitVersion v1;
bs = lib.splitVersion v2;
n = lib.min (lib.length as) (lib.length bs);
sublist = l: lib.sublist 0 n l;
in
lib.compareLists lib.compare (sublist as) (sublist bs) == 0;
matchesDoc = v: (builtins.match ".*[0-9]_LIN(UX)?.sh" v.src.name != null) == webdoc;
in
callPackage ./generic.nix {
inherit cudaSupport cudaPackages;
inherit (found-version) version lang;
src = if source == null then found-version.src else source;
name = (
"mathematica"
+ lib.optionalString cudaSupport "-cuda"
+ "-${found-version.version}"
+ lib.optionalString (lang != "en") "-${lang}"
);
meta = with lib; {
description = "Wolfram Mathematica computational software system";
homepage = "https://www.wolfram.com/mathematica/";
license = licenses.unfree;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
maintainers = with maintainers; [
rafaelrc
];
platforms = [ "x86_64-linux" ];
};
}