about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/element/element-web-wrapper.nix
blob: c9a143ecb49e65c268ac6830d307dbc912395431 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{ stdenv
, jq
, element-web-unwrapped
, conf ? { }
}:

if (conf == { }) then element-web-unwrapped else
stdenv.mkDerivation rec {
  pname = "${element-web-unwrapped.pname}-wrapped";
  inherit (element-web-unwrapped) version meta;

  dontUnpack = true;

  nativeBuildInputs = [ jq ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out
    ln -s ${element-web-unwrapped}/* $out
    rm $out/config.json
    jq -s '.[0] * $conf' "${element-web-unwrapped}/config.json" --argjson "conf" '${builtins.toJSON conf}' > "$out/config.json"

    runHook postInstall
  '';
}