depot/third_party/nixpkgs/pkgs/development/compilers/erg/default.nix
Default email fa5436e0a7 Project import generated by Copybara.
GitOrigin-RevId: e8057b67ebf307f01bdcc8fba94d94f75039d1f6
2024-06-05 17:53:02 +02:00

66 lines
1.4 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, makeWrapper
, python3
, which
, stdenv
}:
rustPlatform.buildRustPackage rec {
pname = "erg";
version = "0.6.37";
src = fetchFromGitHub {
owner = "erg-lang";
repo = "erg";
rev = "v${version}";
hash = "sha256-uwIMUdV2zAyKRwjH83VE+cYgvRGoO+XyD8rA6974mC8=";
};
cargoHash = "sha256-Ep+aO9qgZN9ToKuRRQFqCzagzSXZ1VYQQQk41ZqP7Wo=";
nativeBuildInputs = [
makeWrapper
python3
which
];
buildFeatures = [ "full" ];
env = {
BUILD_DATE = "1970/01/01 00:00:00";
CASE_SENSITIVE = lib.boolToString (!stdenv.isDarwin);
GIT_HASH_SHORT = src.rev;
};
# TODO(figsoda): fix tests
doCheck = false;
# the build script is impure and also assumes we are in a git repository
postPatch = ''
rm crates/erg_common/build.rs
'';
preBuild = ''
export HOME=$(mktemp -d)
export CARGO_ERG_PATH=$HOME/.erg
'';
postInstall = ''
mkdir -p $out/share
mv "$CARGO_ERG_PATH" $out/share/erg
wrapProgram $out/bin/erg \
--set-default ERG_PATH $out/share/erg
'';
meta = with lib; {
description = "A statically typed language that can deeply improve the Python ecosystem";
mainProgram = "erg";
homepage = "https://github.com/erg-lang/erg";
changelog = "https://github.com/erg-lang/erg/releases/tag/${src.rev}";
license = with licenses; [ asl20 mit ];
maintainers = with maintainers; [ figsoda ];
};
}