nixpkgs/pkgs/by-name/nu/numbat/package.nix
Alyssa Ross 63bff8c132
treewide: migrate to fetchCargoVendor, batch 1
Cargo 1.84.0 seems to have changed the output format of cargo vendor
again, once again invalidating fetchCargoTarball FOD hashes.  It's
time to fix this once and for all, switching across the board to
fetchCargoVendor, which is not dependent on cargo vendor's output
format.

It should be possible to reproduce this diff.  To do so, get the list
of files changed by this commit, e.g. with git diff --name-only, then
run the following two commands, each with that list of files as their
standard input:

	xargs sed -i 's/^\(. *\)\(cargoHash\)\b/\1useFetchCargoVendor = true;\n\1cargoHash/'
	cut -d / -f 4 | xargs -n 1 nix-update --version=skip

This will take a long time.  It might be possible to parallelize it
using xargs' -P option.  I haven't tested it.
2025-01-23 11:46:43 +01:00

63 lines
1.6 KiB
Nix

{
lib,
fetchFromGitHub,
rustPlatform,
tzdata,
versionCheckHook,
nix-update-script,
}:
rustPlatform.buildRustPackage rec {
pname = "numbat";
version = "1.15.0";
src = fetchFromGitHub {
owner = "sharkdp";
repo = "numbat";
tag = "v${version}";
hash = "sha256-5XsrOAvBrmCG6k7YRwGZZtBP/o1jVVtBBTrwIT5CDX8=";
};
useFetchCargoVendor = true;
cargoHash = "sha256-GYdg4LkGyKfu22C++ZkwkTGR11++hrX2Wnvb7Skn8NY=";
env.NUMBAT_SYSTEM_MODULE_PATH = "${placeholder "out"}/share/numbat/modules";
postInstall = ''
mkdir -p $out/share/numbat
cp -r $src/numbat/modules $out/share/numbat/
'';
preCheck = ''
# The datetime library used by Numbat, "jiff", always attempts to use the
# system TZDIR on Unix and doesn't fall back to the embedded tzdb when not
# present.
export TZDIR=${tzdata}/share/zoneinfo
'';
nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true;
versionCheckProgramArg = [ "--version" ];
passthru.updateScript = nix-update-script { };
meta = {
description = "High precision scientific calculator with full support for physical units";
longDescription = ''
A statically typed programming language for scientific computations
with first class support for physical dimensions and units
'';
homepage = "https://numbat.dev";
changelog = "https://github.com/sharkdp/numbat/releases/tag/v${version}";
license = with lib.licenses; [
asl20
mit
];
maintainers = with lib.maintainers; [
giomf
atemu
];
mainProgram = "numbat";
};
}