2025-03-13 21:34:05 +01:00

35 lines
676 B
Nix

{
lib,
stdenv,
jq,
element-web-unwrapped,
conf ? { },
}:
if (conf == { }) then
element-web-unwrapped
else
stdenv.mkDerivation {
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" ${lib.escapeShellArg (builtins.toJSON conf)} > "$out/config.json"
runHook postInstall
'';
passthru = {
inherit conf;
};
}