Skip to content

Commit

Permalink
Merge pull request #81470 from pacien/riot-web-conf-attr-str-19.09
Browse files Browse the repository at this point in the history
[19.09] riot-web: accept conf override as attrset and str
  • Loading branch information
rnhmjoj committed Mar 1, 2020
2 parents 5c32423 + ad55e6e commit fadb703
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkgs/applications/networking/instant-messengers/riot/riot-web.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
# Versions of `riot-web` and `riot-desktop` should be kept in sync.

let
noPhoningHome = {
privacyOverrides = writeText "riot-config-privacy.json" (builtins.toJSON {
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));
});
userOverrides = writeText "riot-config-user.json" (
with builtins; if isAttrs conf then toJSON conf else conf
);

in stdenv.mkDerivation rec {
pname = "riot-web";
Expand All @@ -24,7 +26,12 @@ in stdenv.mkDerivation rec {
mkdir -p $out/
cp -R . $out/
${jq}/bin/jq -s '.[0] * .[1]' "config.sample.json" "${configOverrides}" > "$out/config.json"
${jq}/bin/jq -s '.[0] * .[1] * .[2]' \
"config.sample.json" \
"${privacyOverrides}" \
"${userOverrides}" \
> "$out/config.json"
runHook postInstall
'';
Expand Down

0 comments on commit fadb703

Please sign in to comment.