summary refs log tree commit diff
path: root/pkgs/development/misc/haskell/hasura/update.sh
blob: 227d3229ebe38bec8a0584914710d6c93ebd754d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p cabal2nix curl jq -I nixpkgs=.
#
# This script will update the hasura derivations to the latest version using
# cabal2nix.
#
# Note that you should always try building hasura graphql-engine after updating it here, since
# some of the overrides in pkgs/development/haskell/configuration-nix.nix may
# need to be updated/changed.

set -eo pipefail

# This is the directory of this update.sh script.
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# graphql-engine derivation created with cabal2nix.
engine_derivation_file="${script_dir}/graphql-engine.nix"
parser_derivation_file="${script_dir}/graphql-parser.nix"
ciinfo_derivation_file="${script_dir}/ci-info.nix"
pgclient_derivation_file="${script_dir}/pg-client.nix"
pool_derivation_file="${script_dir}/pool.nix"

# TODO: get current revision of graphql-engine in Nixpkgs.
# old_version="$(sed -En 's/.*\bversion = "(.*?)".*/\1/p' "$engine_derivation_file")"

# This is the latest release version of graphql-engine on GitHub.
new_version=$(curl --silent "https://api.github.com/repos/hasura/graphql-engine/releases" | jq '.[0].tag_name' --raw-output)

echo "Running cabal2nix and outputting to ${engine_derivation_file}..."

echo "# This has been automatically generated by the script" > "$engine_derivation_file"
echo "# ./update.sh.  This should not be changed by hand." >> "$engine_derivation_file"

# 2.0.5 hardcoded for now, because 2.0.6 failed to build. should be removed when updating
# cabal2nix --revision "$new_version" --subpath server --maintainer lassulus "https://github.com/hasura/graphql-engine.git" >> "$engine_derivation_file"
cabal2nix --revision "v2.0.5" --subpath server --maintainer lassulus --no-check "https://github.com/hasura/graphql-engine.git" >> "$engine_derivation_file"

echo "Running cabal2nix and outputting to ${parser_derivation_file}..."

echo "# This has been automatically generated by the script" > "$parser_derivation_file"
echo "# ./update.sh.  This should not be changed by hand." >> "$parser_derivation_file"

cabal2nix "https://github.com/hasura/graphql-parser-hs.git" >> "$parser_derivation_file"

echo "Running cabal2nix and outputting to ${ciinfo_derivation_file}..."

echo "# This has been automatically generated by the script" > "$ciinfo_derivation_file"
echo "# ./update.sh.  This should not be changed by hand." >> "$ciinfo_derivation_file"

cabal2nix "https://github.com/hasura/ci-info-hs.git" >> "$ciinfo_derivation_file"

echo "Running cabal2nix and outputting to ${pgclient_derivation_file}..."

echo "# This has been automatically generated by the script" > "$pgclient_derivation_file"
echo "# ./update.sh.  This should not be changed by hand." >> "$pgclient_derivation_file"

cabal2nix "https://github.com/hasura/pg-client-hs.git" >> "$pgclient_derivation_file"

echo "Running cabal2nix and outputting to ${pool_derivation_file}..."

echo "# This has been automatically generated by the script" > "$pool_derivation_file"
echo "# ./update.sh.  This should not be changed by hand." >> "$pool_derivation_file"

cabal2nix "https://github.com/hasura/pool.git" >> "$pool_derivation_file"

echo "###################"
echo "please update pkgs/servers/hasura/cli.nix vendorSha256"
echo "please update pkgs/development/haskell-modules/configuration-common.nix graphql-engine version"
echo "###################"

echo "Finished."