at master 1.0 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 dconf2nix derivation to the latest version using 5# cabal2nix. 6 7set -eo pipefail 8 9# This is the directory of this update.sh script. 10script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 11 12# dconf2nix derivation created with cabal2nix. 13dconf2nix_derivation_file="${script_dir}/dconf2nix.nix" 14 15# This is the current revision of dconf2nix in Nixpkgs. 16old_version="$(sed -En 's/.*\bversion = "(.*?)".*/\1/p' "$dconf2nix_derivation_file")" 17 18# This is the latest release version of dconf2nix on GitHub. 19new_version=$(curl --silent "https://api.github.com/repos/gvolpe/dconf2nix/releases" | jq '.[0].tag_name' --raw-output) 20 21echo "Updating dconf2nix from old version $old_version to new version $new_version." 22echo "Running cabal2nix and outputting to ${dconf2nix_derivation_file}..." 23 24cabal2nix --revision "$new_version" "https://github.com/gvolpe/dconf2nix.git" > "$dconf2nix_derivation_file" 25 26echo "Finished."