about summary refs log tree commit diff
path: root/third_party/lieer/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-23T12·26+0100
committerVincent Ambo <tazjin@google.com>2019-12-23T12·26+0100
commit41eea96e63b9fdc9da9895093a0ae65013cf06d2 (patch)
treecb61f4ddca3931f9e4b927412306e12a10c84dc4 /third_party/lieer/default.nix
parenta260eba3cf478c99dcfd92b821934b40ed905894 (diff)
feat(third_party/lieer): Overwrite included client secret r/294
Diffstat (limited to 'third_party/lieer/default.nix')
-rw-r--r--third_party/lieer/default.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/third_party/lieer/default.nix b/third_party/lieer/default.nix
index 80bd06350120..810a3df1a507 100644
--- a/third_party/lieer/default.nix
+++ b/third_party/lieer/default.nix
@@ -7,7 +7,18 @@
 
 with pkgs.third_party;
 
-python3Packages.buildPythonApplication rec {
+let
+  # My employer does not allow third-party projects to use our email
+  # accounts, but I want to use lieer for it anyways.
+  #
+  # To accomplish this the following derivation creates a patch that
+  # replaces the API client with one that I control.
+  authPatch = runCommand "client_secret.patch" {} ''
+    export PATH=${lib.makeBinPath [ gettext ]}:$PATH
+    export CLIENT_SECRET='${builtins.getEnv "LIEER_CLIENT_SECRET"}'
+    cat ${./api_client.patch} | envsubst > $out
+  '';
+in python3Packages.buildPythonApplication rec {
   name = "lieer-${version}";
   version = "1.0";
 
@@ -18,6 +29,8 @@ python3Packages.buildPythonApplication rec {
     sha256 = "1zzylv8xbcrh34bz0s29dawzcyx39lai8y8wk0bl4x75v1jfynvf";
   };
 
+  patches = [ authPatch ];
+
   propagatedBuildInputs = with python3Packages; [
     notmuch
     oauth2client