nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1#!/usr/bin/env nix-shell
2#!nix-shell -i bash -p cabal2nix curl jq nix-update nixfmt
3
4set -euo pipefail
5
6# This is the directory of this update.sh script.
7script_dir="$(dirname "${BASH_SOURCE[0]}")"
8
9backend_derivation_file="${script_dir}/generated-backend-package.nix"
10
11latest_version="$(curl --silent 'https://api.github.com/repos/gren-lang/compiler/releases/latest' | jq --raw-output '.tag_name')"
12
13echo "Updating gren backend to version ${latest_version}."
14echo "Running cabal2nix and outputting to ${backend_derivation_file}..."
15
16cat > "${backend_derivation_file}" << EOF
17# This file has been autogenerated with cabal2nix.
18# Update via ./update.sh
19EOF
20
21cabal2nix 'https://github.com/gren-lang/compiler.git' --revision "${latest_version}" --jailbreak >> "${backend_derivation_file}"
22nixfmt "${backend_derivation_file}"
23
24echo 'Finished backend generation.'
25
26echo "Updating frontend to version ${latest_version}"
27
28nix-update gren --version "${latest_version}"