diff --git a/pkgs/by-name/gr/gren/generated-package.nix b/pkgs/by-name/gr/gren/generated-package.nix new file mode 100644 index 000000000000..5fb245debbf9 --- /dev/null +++ b/pkgs/by-name/gr/gren/generated-package.nix @@ -0,0 +1,101 @@ +# This file has been autogenerated with cabal2nix. +# Update via ./update.sh +{ + mkDerivation, + ansi-terminal, + ansi-wl-pprint, + base, + base64-bytestring, + binary, + bytestring, + containers, + directory, + edit-distance, + fetchgit, + filelock, + filepath, + ghc-prim, + haskeline, + hspec, + hspec-discover, + indexed-traversable, + lib, + mtl, + prettyprint-avh4, + process, + raw-strings-qq, + scientific, + text, + time, + utf8-string, + vector, +}: +mkDerivation { + pname = "gren"; + version = "0.4.5"; + src = fetchgit { + url = "https://github.com/gren-lang/compiler.git"; + sha256 = "0hbxzn14m9y7sqwk347yj7hblwmj5fyzmy7kjqc8zjd63gmrkdh8"; + rev = "0efe25e3f48663a36eec525d2df0d957f53c9b4e"; + fetchSubmodules = true; + }; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ + ansi-terminal + ansi-wl-pprint + base + base64-bytestring + binary + bytestring + containers + directory + edit-distance + filelock + filepath + ghc-prim + haskeline + indexed-traversable + mtl + prettyprint-avh4 + process + raw-strings-qq + scientific + text + time + utf8-string + vector + ]; + testHaskellDepends = [ + ansi-terminal + ansi-wl-pprint + 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 + ]; + testToolDepends = [ hspec-discover ]; + jailbreak = true; + homepage = "https://gren-lang.org"; + description = "The `gren` command line interface"; + license = lib.licenses.bsd3; + mainProgram = "gren"; +} diff --git a/pkgs/by-name/gr/gren/package.nix b/pkgs/by-name/gr/gren/package.nix new file mode 100644 index 000000000000..aea0293fe2ea --- /dev/null +++ b/pkgs/by-name/gr/gren/package.nix @@ -0,0 +1,21 @@ +{ + lib, + haskell, + haskellPackages, +}: + +let + inherit (haskell.lib.compose) overrideCabal; + + raw-pkg = (haskellPackages.callPackage ./generated-package.nix { }).overrideScope ( + final: prev: { + ansi-wl-pprint = final.ansi-wl-pprint_0_6_9; + } + ); + + overrides = { + maintainers = with lib.maintainers; [ tomasajt ]; + passthru.updateScript = ./update.sh; + }; +in +overrideCabal overrides raw-pkg diff --git a/pkgs/by-name/gr/gren/update.sh b/pkgs/by-name/gr/gren/update.sh new file mode 100755 index 000000000000..1b697ecb88dd --- /dev/null +++ b/pkgs/by-name/gr/gren/update.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env nix-shell +#!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" +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}..." + +cat > "${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}" + +echo 'Finished.'