about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/misc/haskell/hasura/update.sh
blob: 77a5d5fc6dead475e6e1bda330c3c2d2283eb813 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/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"
ekgcore_derivation_file="${script_dir}/ekg-core.nix"
ekgjson_derivation_file="${script_dir}/ekg-json.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"

cabal2nix --revision "$new_version" --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 --maintainer lassulus "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 --maintainer lassulus "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 --maintainer lassulus "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 --maintainer lassulus "https://github.com/hasura/pool.git" >> "$pool_derivation_file"

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

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

cabal2nix --maintainer lassulus "https://github.com/hasura/ekg-core.git" >> "$ekgcore_derivation_file"

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

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

cabal2nix --maintainer lassulus "https://github.com/hasura/ekg-json.git" >> "$ekgjson_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."