1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p cabal2nix curl jq nixfmt-rfc-style
6 # This is the directory of this update.sh script.
7 script_dir
="$(dirname "${BASH_SOURCE[0]}")"
8 derivation_file
="${script_dir}/generated-package.nix"
9 latest_version
="$(curl --silent 'https://api.github.com/repos/gren-lang/compiler/releases/latest' | jq --raw-output '.tag_name')"
11 echo "Updating gren to version ${latest_version}."
12 echo "Running cabal2nix and outputting to ${derivation_file}..."
14 cat > "${derivation_file}" << EOF
15 # This file has been autogenerated with cabal2nix.
16 # Update via ./update.sh
19 cabal2nix
'https://github.com/gren-lang/compiler.git' --revision "${latest_version}" --jailbreak >> "${derivation_file}"
20 nixfmt
"${derivation_file}"