1{ lib, stdenv, fetchzip, python3Packages, makeWrapper }:
2
3with python3Packages;
4
5stdenv.mkDerivation rec {
6 pname = "google-app-engine-go-sdk";
7 version = "1.9.61";
8 src =
9 if stdenv.hostPlatform.system == "x86_64-linux" then
10 fetchzip {
11 url = "https://storage.googleapis.com/appengine-sdks/featured/go_appengine_sdk_linux_amd64-${version}.zip";
12 sha256 = "1i2j9ympl1218akwsmm7yb31v0gibgpzlb657bcravi1irfv1hhs";
13 }
14 else
15 fetchzip {
16 url = "https://storage.googleapis.com/appengine-sdks/featured/go_appengine_sdk_darwin_amd64-${version}.zip";
17 sha256 = "0s8sqyc72lnc7dxd4cl559gyfx83x71jjpsld3i3nbp3mwwamczp";
18 };
19
20 nativeBuildInputs = [ makeWrapper ];
21 buildInputs = [ python ];
22
23 installPhase = ''
24 mkdir -p $out/bin $out/share/
25 cp -r "$src" "$out/share/go_appengine"
26
27 # create wrappers with correct env
28 for i in goapp go-app-stager *.py; do
29 makeWrapper "$out/share/go_appengine/$i" "$out/bin/$i" \
30 --prefix PATH : "${python}/bin" \
31 --prefix PYTHONPATH : "$(toPythonPath ${cffi}):$(toPythonPath ${cryptography}):$(toPythonPath ${pyopenssl})"
32 done
33 '';
34
35 meta = with lib; {
36 description = "Google App Engine SDK for Go";
37 version = version;
38 homepage = "https://cloud.google.com/appengine/docs/go/";
39 sourceProvenance = with sourceTypes; [
40 fromSource
41 binaryNativeCode # includes golang toolchain binaries
42 ];
43 license = licenses.asl20;
44 platforms = ["x86_64-linux" "x86_64-darwin"];
45 maintainers = with maintainers; [ lufia ];
46 };
47}