element-web: export element-web-unwrapped

This commit is contained in:
linsui 2022-11-09 20:24:04 +08:00
parent 2db0b4b00b
commit 88527c2e31
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
@ -18,8 +17,8 @@ let
disable_guests = true; # disable automatic guest account registration at matrix.org
piwik = false; # disable analytics
};
unwrapped = stdenv.mkDerivation rec {
in
stdenv.mkDerivation rec {
pname = "element-web";
inherit (pinData) version;
@ -86,25 +85,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

@ -3910,8 +3910,10 @@ with pkgs;
NIXOS_OZONE_WL=1 exec ${element-desktop}/bin/element-desktop "$@"
'';
element-web = callPackage ../applications/networking/instant-messengers/element/element-web.nix {
conf = config.element-web.conf or {};
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 { };
};
elementary-xfce-icon-theme = callPackage ../data/icons/elementary-xfce-icon-theme { };