From 97935971beb82ed55d30cc39917ee13cf6fa2f84 Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 17 Feb 2020 16:54:13 +0100 Subject: [PATCH] riot-web: add config overrides for privacy Preventing the app from phoning home by default. GitHub: closes https://github.com/NixOS/nixpkgs/issues/80358 (cherry picked from commit c9e5cca071223b8869ac12111131e27eb17ff95d) --- .../instant-messengers/riot/riot-web.nix | 19 +++++++++++-------- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/riot/riot-web.nix b/pkgs/applications/networking/instant-messengers/riot/riot-web.nix index 48e1beed2e7e..ea8626d6b06e 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.9"; @@ -12,16 +19,12 @@ stdenv.mkDerivation rec { sha256 = "1qibbgjzhiwn1lnfm3pbfn6jahphgyf6625mp4v0ah2is75x16ys"; }; - 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 ''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 447e5fee395d..1a075293a0a2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2113,7 +2113,7 @@ in riot-desktop = callPackage ../applications/networking/instant-messengers/riot/riot-desktop.nix { }; riot-web = callPackage ../applications/networking/instant-messengers/riot/riot-web.nix { - conf = config.riot-web.conf or null; + conf = config.riot-web.conf or {}; }; ripasso-cursive = callPackage ../tools/security/ripasso/cursive.nix {