Merge pull request #200336 from linsui/element-23b

element-web: export unwrapped
This commit is contained in:
Nick Cao 2023-01-13 11:28:42 +08:00 committed by GitHub
commit 7a79aed149
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 87 additions and 81 deletions

View file

@ -0,0 +1,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
'';
}

View file

@ -9,7 +9,6 @@
, fixup_yarn_lock
, nodejs
, jitsi-meet
, conf ? { }
}:
let
@ -17,8 +16,8 @@ let
noPhoningHome = {
disable_guests = true; # disable automatic guest account registration at matrix.org
};
unwrapped = stdenv.mkDerivation rec {
in
stdenv.mkDerivation rec {
pname = "element-web";
inherit (pinData) version;
@ -85,25 +84,4 @@ let
license = lib.licenses.asl20;
platforms = lib.platforms.all;
};
};
in
if (conf == { }) then unwrapped else
stdenv.mkDerivation rec {
pname = "${unwrapped.pname}-wrapped";
inherit (unwrapped) version meta;
dontUnpack = true;
nativeBuildInputs = [ jq ];
installPhase = ''
runHook preInstall
mkdir -p $out
ln -s ${unwrapped}/* $out
rm $out/config.json
jq -s '.[0] * $conf' "${unwrapped}/config.json" --argjson "conf" '${builtins.toJSON conf}' > "$out/config.json"
runHook postInstall
'';
}

View file

@ -4389,7 +4389,9 @@ with pkgs;
NIXOS_OZONE_WL=1 exec ${element-desktop}/bin/element-desktop "$@"
'';
element-web = callPackage ../applications/networking/instant-messengers/element/element-web.nix {
element-web-unwrapped = callPackage ../applications/networking/instant-messengers/element/element-web.nix { };
element-web = callPackage ../applications/networking/instant-messengers/element/element-web-wrapper.nix {
conf = config.element-web.conf or { };
};