about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/signal-desktop
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2021-05-14 02:23:56 +0200
committerMichael Weiss <dev.primeos@gmail.com>2021-05-14 02:33:42 +0200
commit940dfa99401c04c78bc530c72ecba6f6ccee62e8 (patch)
tree4c9121f527ebfc9b2d2ae9a1e0983a84498dc3d3 /pkgs/applications/networking/instant-messengers/signal-desktop
parent1cdf5f44364fe06ce3d0cded1d784e132e6f3354 (diff)
signal-desktop: Fix the database encryption by preloading SQLCipher
AFAIK this is the only reliable way for us to ensure SQLCipher will be
loaded instead of SQLite. It feels like a hack/workaround but according
to the SQLCipher developers [0] "this issue can and should be handled
downstream at the application level: 1. While it may feel like a
workaround, using LD_PRELOAD is a legitimate approach here because it
will substitute the system SQLite with SQLCipher which is the intended
usage model;".

This fixes #108772 for NixOS 20.09 users who upgrade to NixOS 21.05 and
replaces #117555.

For nixos-unstable users this will unfortunately break everything again
so we should add a script to ease the transition (in a separate commit
so that we can revert it for NixOS 21.05).

[0]: https://github.com/sqlcipher/sqlcipher/issues/385#issuecomment-802874340
Diffstat (limited to 'pkgs/applications/networking/instant-messengers/signal-desktop')
-rw-r--r--pkgs/applications/networking/instant-messengers/signal-desktop/default.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix b/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix
index 50161f1be143e..38d52b26bff30 100644
--- a/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix
+++ b/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix
@@ -117,9 +117,15 @@ in stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
+  # Required for $SQLCIPHER_LIB which contains "/build/" inside the path:
+  noAuditTmpdir = true;
+
   preFixup = ''
+    export SQLCIPHER_LIB="$out/lib/Signal/resources/app.asar.unpacked/node_modules/better-sqlite3/build/Release/better_sqlite3.node"
+    test -x "$SQLCIPHER_LIB" # To ensure the location hasn't changed
     gappsWrapperArgs+=(
       --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc ] }"
+      --prefix LD_PRELOAD : "$SQLCIPHER_LIB"
       ${customLanguageWrapperArgs}
     )