about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/riot
diff options
context:
space:
mode:
authorpacien <pacien.trangirard@pacien.net>2020-02-17 16:54:13 +0100
committerpacien <pacien.trangirard@pacien.net>2020-02-17 16:54:13 +0100
commitc9e5cca071223b8869ac12111131e27eb17ff95d (patch)
treea3c7f5eebc58587b29340f99dbf7f96803f16e4c /pkgs/applications/networking/instant-messengers/riot
parent3285f0f2ff36aea7d5e87520a3e9ef66c44f87b8 (diff)
downloadnixlib-c9e5cca071223b8869ac12111131e27eb17ff95d.tar
nixlib-c9e5cca071223b8869ac12111131e27eb17ff95d.tar.gz
nixlib-c9e5cca071223b8869ac12111131e27eb17ff95d.tar.bz2
nixlib-c9e5cca071223b8869ac12111131e27eb17ff95d.tar.lz
nixlib-c9e5cca071223b8869ac12111131e27eb17ff95d.tar.xz
nixlib-c9e5cca071223b8869ac12111131e27eb17ff95d.tar.zst
nixlib-c9e5cca071223b8869ac12111131e27eb17ff95d.zip
riot-web: add config overrides for privacy
Preventing the app from phoning home by default.

GitHub: closes https://github.com/NixOS/nixpkgs/issues/80358
Diffstat (limited to 'pkgs/applications/networking/instant-messengers/riot')
-rw-r--r--pkgs/applications/networking/instant-messengers/riot/riot-web.nix19
1 files changed, 11 insertions, 8 deletions
diff --git a/pkgs/applications/networking/instant-messengers/riot/riot-web.nix b/pkgs/applications/networking/instant-messengers/riot/riot-web.nix
index 2156214db6b0..c31f0cc06cb9 100644
--- a/pkgs/applications/networking/instant-messengers/riot/riot-web.nix
+++ b/pkgs/applications/networking/instant-messengers/riot/riot-web.nix
@@ -1,9 +1,16 @@
-{ lib, stdenv, fetchurl, writeText, conf ? null }:
+{ lib, stdenv, fetchurl, writeText, jq, conf ? {} }:
 
 # Note for maintainers:
 # Versions of `riot-web` and `riot-desktop` should be kept in sync.
 
-stdenv.mkDerivation rec {
+let
+  noPhoningHome = {
+    disable_guests = true; # disable automatic guest account registration at matrix.org
+    piwik = false; # disable analytics
+  };
+  configOverrides = writeText "riot-config-overrides.json" (builtins.toJSON (noPhoningHome // conf));
+
+in stdenv.mkDerivation rec {
   pname = "riot-web";
   version = "1.5.8";
 
@@ -12,16 +19,12 @@ stdenv.mkDerivation rec {
     sha256 = "112zjlmxy2s8qcd227laf1lfvbbwwcipn51xb779hy2dci48kpkx";
   };
 
-  installPhase = let
-    configFile = if (conf != null)
-      then writeText "riot-config.json" conf
-      else "$out/config.sample.json";
-  in ''
+  installPhase = ''
     runHook preInstall
 
     mkdir -p $out/
     cp -R . $out/
-    ln -s ${configFile} $out/config.json
+    ${jq}/bin/jq -s '.[0] * .[1]' "config.sample.json" "${configOverrides}" > "$out/config.json"
 
     runHook postInstall
   '';