Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21729,6 +21729,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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Update via ./update.sh
{
mkDerivation,
ansi-terminal,
ansi-wl-pprint,
base,
base64-bytestring,
Expand All @@ -12,7 +11,6 @@
directory,
edit-distance,
fetchgit,
filelock,
filepath,
ghc-prim,
haskeline,
Expand All @@ -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
Expand All @@ -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";
}
68 changes: 55 additions & 13 deletions pkgs/by-name/gr/gren/package.nix
Original file line number Diff line number Diff line change
@@ -1,21 +1,63 @@
{
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
})
18 changes: 10 additions & 8 deletions pkgs/by-name/gr/gren/update.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
#!/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.'
Loading