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
="$( cd "$
( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
8 derivation_file
="${script_dir}/generated-package.nix"
9 latest_version
="$(curl --silent https://api.github.com/repos/pdobsan/oama/releases/latest | jq --raw-output '.tag_name')"
11 echo "Updating oama to version ${latest_version}."
12 echo "Running cabal2nix and outputting to ${derivation_file}..."
14 cat > "${derivation_file}" << EOF
15 # This file has been autogenerate with cabal2nix.
16 # Update via ./update.sh
19 cabal2nix
--revision "${latest_version}" https
://github.com
/pdobsan
/oama.git
>> "${derivation_file}"
20 nixfmt
"${derivation_file}"