Unverified Commit 258f6ee4 authored by lassulus's avatar lassulus Committed by GitHub
Browse files

gren: 0.4.5 -> 0.6.1 (#401729)

parents 723ce939 9b68f9a9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -21728,6 +21728,12 @@
    githubId = 521306;
    name = "Rob Glossop";
  };
  robinheghan = {
    email = "git@heghan.org";
    github = "robinheghan";
    githubId = 854889;
    name = "Robin Heggelund Hansen";
  };
  robinkrahl = {
    email = "nix@ireas.org";
    github = "robinkrahl";
+15 −31
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
# Update via ./update.sh
{
  mkDerivation,
  ansi-terminal,
  ansi-wl-pprint,
  base,
  base64-bytestring,
@@ -12,7 +11,6 @@
  directory,
  edit-distance,
  fetchgit,
  filelock,
  filepath,
  ghc-prim,
  haskeline,
@@ -21,28 +19,26 @@
  indexed-traversable,
  lib,
  mtl,
  prettyprint-avh4,
  prettyprinter,
  process,
  raw-strings-qq,
  scientific,
  text,
  time,
  utf8-string,
  vector,
}:
mkDerivation {
  pname = "gren";
  version = "0.5.2";
  version = "0.6.1";
  src = fetchgit {
    url = "https://github.com/gren-lang/compiler.git";
    sha256 = "1mksfma6c1dn091ab4x794hs71v44bx294wbn80qfc5kgrrl5lf4";
    rev = "ee19481f5715b78cad8be09e29e56dcb82d65f4f";
    sha256 = "0h7mm3y62l3j190sd25db4bifp65xmyc4rc16jhyphp6yzyjcpcl";
    rev = "b54f0343c8015c777e4fbb74e843181e6f3cb214";
    fetchSubmodules = true;
  };
  isLibrary = false;
  isExecutable = true;
  executableHaskellDepends = [
    ansi-terminal
  libraryHaskellDepends = [
    ansi-wl-pprint
    base
    base64-bytestring
@@ -51,51 +47,39 @@ mkDerivation {
    containers
    directory
    edit-distance
    filelock
    filepath
    ghc-prim
    haskeline
    indexed-traversable
    mtl
    prettyprint-avh4
    process
    prettyprinter
    raw-strings-qq
    scientific
    text
    time
    utf8-string
    vector
  ];
  testHaskellDepends = [
    ansi-terminal
    ansi-wl-pprint
  executableHaskellDepends = [
    base
    base64-bytestring
    binary
    bytestring
    containers
    directory
    edit-distance
    filelock
    filepath
    ghc-prim
    haskeline
    hspec
    indexed-traversable
    mtl
    prettyprint-avh4
    process
    raw-strings-qq
    scientific
    text
    time
    utf8-string
    vector
  ];
  testHaskellDepends = [
    base
    bytestring
    hspec
    utf8-string
  ];
  testToolDepends = [ hspec-discover ];
  doHaddock = false;
  jailbreak = true;
  homepage = "https://gren-lang.org";
  description = "`gren` command line interface";
  description = "The `gren` command line interface";
  license = lib.licenses.bsd3;
  mainProgram = "gren";
}
+55 −13
Original line number Diff line number Diff line
{
  lib,
  haskell,
  stdenv,
  fetchFromGitHub,
  makeBinaryWrapper,
  nodejs,
  git,
  haskellPackages,
  versionCheckHook,
}:

let
  inherit (haskell.lib.compose) overrideCabal;
stdenv.mkDerivation (finalAttrs: {
  pname = "gren";
  version = "0.6.1";

  raw-pkg = (haskellPackages.callPackage ./generated-package.nix { }).overrideScope (
    final: prev: {
      ansi-wl-pprint = final.ansi-wl-pprint_0_6_9;
    }
  );
  src = fetchFromGitHub {
    owner = "gren-lang";
    repo = "compiler";
    tag = finalAttrs.version;
    hash = "sha256-lF0m/ffmwuuhNIFlwnztxVwXF1mtiKZBCnJQYfyo9UA=";
  };

  buildInputs = [
    nodejs
  ];

  nativeBuildInputs = [
    makeBinaryWrapper
  ];

  installPhase = ''
    runHook preInstall

    # install the precompiled frontend into the proper location
    install -Dm755 bin/compiler $out/bin/gren

    wrapProgram $out/bin/gren \
      --set-default GREN_BIN ${lib.getExe finalAttrs.passthru.backend} \
      --suffix PATH : ${lib.makeBinPath [ git ]}

    runHook postInstall
  '';

  nativeInstallCheckInputs = [ versionCheckHook ];
  versionCheckProgram = "${placeholder "out"}/bin/gren";
  versionCheckProgramArg = "--version";

  passthru = {
    backend = haskellPackages.callPackage ./generated-backend-package.nix { };
    updateScript = ./update.sh;
  };

  overrides = {
    maintainers = with lib.maintainers; [ tomasajt ];
    passthru.updateScript = ./update.sh;
  meta = {
    description = "Compiler for the Gren programming language";
    homepage = "https://gren-lang.org";
    license = lib.licenses.bsd3;
    mainProgram = "gren";
    maintainers = with lib.maintainers; [
      robinheghan
      tomasajt
    ];
  };
in
overrideCabal overrides raw-pkg
})
+10 −8
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p cabal2nix curl jq
#!nix-shell -i bash -p cabal2nix curl jq nixfmt-rfc-style

set -euo pipefail

# This is the directory of this update.sh script.
script_dir="$(dirname "${BASH_SOURCE[0]}")"
derivation_file="${script_dir}/generated-package.nix"

backend_derivation_file="${script_dir}/generated-backend-package.nix"

latest_version="$(curl --silent 'https://api.github.com/repos/gren-lang/compiler/releases/latest' | jq --raw-output '.tag_name')"

echo "Updating gren to version ${latest_version}."
echo "Running cabal2nix and outputting to ${derivation_file}..."
echo "Updating gren backend to version ${latest_version}."
echo "Running cabal2nix and outputting to ${backend_derivation_file}..."

cat > "${derivation_file}" << EOF
cat > "${backend_derivation_file}" << EOF
# This file has been autogenerated with cabal2nix.
# Update via ./update.sh
EOF

cabal2nix 'https://github.com/gren-lang/compiler.git' --revision "${latest_version}" --jailbreak >> "${derivation_file}"
nixfmt "${derivation_file}"
cabal2nix 'https://github.com/gren-lang/compiler.git' --revision "${latest_version}" --jailbreak >> "${backend_derivation_file}"
nixfmt "${backend_derivation_file}"

echo 'Finished.'
echo 'Finished backend generation.'