From e76be6b401570744e8269f301f17952eeb8c2624 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 26 Dec 2019 15:01:21 +0100 Subject: feat(third_party/lieer): Introduce configuration for OAuth client It turns out I'm going to need multiple different OAuth clients for a variety of reasons. This defaults to the client for tazj.in accounts, but I use a different one in my work overlay. --- third_party/lieer/default.nix | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'third_party/lieer/default.nix') diff --git a/third_party/lieer/default.nix b/third_party/lieer/default.nix index 0c399db158b5..2f58d5f1179b 100644 --- a/third_party/lieer/default.nix +++ b/third_party/lieer/default.nix @@ -5,9 +5,28 @@ # version using the previous branding (gmailieer). { pkgs, ... }: +# For a variety of reasons (specific to my setup), custom OAuth2 +# scopes are used. +# +# The below client ID is the default for *@tazj.in and is overridden +# in a private repository for my work account. Publishing it here is +# not a security issue. +{ + clientId ? "515965513093-7b4bo4gm0q09ccsmikkuaas9a40j0jcj.apps.googleusercontent.com", + clientSecret ? "3jVbpfT4GmubFD64svctJSdQ", + project ? "tazjins-infrastructure" +}: + with pkgs.third_party; -python3Packages.buildPythonApplication rec { +let + authPatch = runCommand "client_secret.patch" {} '' + export CLIENT_ID='${clientId}' + export CLIENT_SECRET='${clientSecret}' + export PROJECT_ID='${project}' + cat ${./api_client.patch} | ${gettext}/bin/envsubst > $out + ''; +in python3Packages.buildPythonApplication rec { name = "lieer-${version}"; version = "1.0"; @@ -18,7 +37,10 @@ python3Packages.buildPythonApplication rec { sha256 = "1zzylv8xbcrh34bz0s29dawzcyx39lai8y8wk0bl4x75v1jfynvf"; }; - patches = [ ./send_scope.patch ]; + patches = [ + authPatch + ./send_scope.patch + ]; propagatedBuildInputs = with python3Packages; [ notmuch -- cgit 1.4.1