From 207180add1e094ba70fce4cf83569a466364c9c9 Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 7 Jun 2023 23:01:49 -0400 Subject: [PATCH] erg: init at 0.6.13 https://github.com/erg-lang/erg --- pkgs/development/compilers/erg/default.nix | 63 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 65 insertions(+) create mode 100644 pkgs/development/compilers/erg/default.nix diff --git a/pkgs/development/compilers/erg/default.nix b/pkgs/development/compilers/erg/default.nix new file mode 100644 index 000000000000..7b0292153b1c --- /dev/null +++ b/pkgs/development/compilers/erg/default.nix @@ -0,0 +1,63 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, makeWrapper +, python3 +, which +}: + +rustPlatform.buildRustPackage rec { + pname = "erg"; + version = "0.6.13"; + + src = fetchFromGitHub { + owner = "erg-lang"; + repo = "erg"; + rev = "v${version}"; + hash = "sha256-XwQKtorE1HGRRCCtxQBVbl6O6aTs5Z2/W9n2Am40e8Q="; + }; + + cargoHash = "sha256-I4hQ78RTkCDKpq7HBNJsKqCiFL9004XvWdwtRdTQQkE="; + + nativeBuildInputs = [ + makeWrapper + python3 + which + ]; + + buildFeatures = [ "full" ]; + + env = { + BUILD_DATE = "1970/01/01 00:00:00"; + 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"; + 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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 177d3eeea3e9..38e849a698d3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14907,6 +14907,8 @@ with pkgs; eql = callPackage ../development/compilers/eql { }; + erg = callPackage ../development/compilers/erg { }; + elm2nix = haskell.lib.compose.justStaticExecutables haskellPackages.elm2nix; elmPackages = recurseIntoAttrs (callPackage ../development/compilers/elm { });