nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 jq,
5 element-web-unwrapped,
6 config,
7 conf ? config.element-web.conf or { },
8}:
9
10if (conf == { }) then
11 element-web-unwrapped
12else
13 stdenv.mkDerivation {
14 pname = "${element-web-unwrapped.pname}-wrapped";
15 inherit (element-web-unwrapped) version meta;
16
17 dontUnpack = true;
18
19 nativeBuildInputs = [ jq ];
20
21 installPhase = ''
22 runHook preInstall
23
24 mkdir -p $out
25 ln -s ${element-web-unwrapped}/* $out
26 rm $out/config.json
27 jq -s '.[0] * $conf' "${element-web-unwrapped}/config.json" --argjson "conf" ${lib.escapeShellArg (builtins.toJSON conf)} > "$out/config.json"
28
29 runHook postInstall
30 '';
31
32 passthru = {
33 inherit conf;
34 };
35 }