nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 20.03 30 lines 1.2 kB view raw
1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p cabal2nix curl jq 3# 4# This script will update the spago derivation to the latest version using 5# cabal2nix. 6# 7# Note that you should always try building spago after updating it here, since 8# some of the overrides in pkgs/development/haskell/configuration-nix.nix may 9# need to be updated/changed. 10 11set -eo pipefail 12 13# This is the directory of this update.sh script. 14script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 15 16# Spago derivation created with cabal2nix. 17spago_derivation_file="${script_dir}/spago.nix" 18 19# This is the current revision of spago in Nixpkgs. 20old_version="$(sed -En 's/.*\bversion = "(.*?)".*/\1/p' "$spago_derivation_file")" 21 22# This is the latest release version of spago on GitHub. 23new_version=$(curl --silent "https://api.github.com/repos/spacchetti/spago/releases" | jq '.[0].tag_name' --raw-output) 24 25echo "Updating spago from old version $old_version to new version $new_version." 26echo "Running cabal2nix and outputting to ${spago_derivation_file}..." 27 28cabal2nix --revision "$new_version" "https://github.com/spacchetti/spago.git" > "$spago_derivation_file" 29 30echo "Finished."