Skip to content

Commit

Permalink
element-{web,desktop}: move to pkgs/by-name, format
Browse files Browse the repository at this point in the history
with `nixfmt-rfc-style`
  • Loading branch information
teutat3s committed Dec 17, 2024
1 parent 10c1621 commit 51ff21f
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 106 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@
element-web,
sqlcipher,
callPackage,
Security,
AppKit,
CoreServices,
darwin,
desktopToDarwinBundle,
useKeytar ? true,
# command line arguments which are always set
commandLineArgs ? "",
}:

let
pinData = import ./pin.nix;
pinData = import ../element-web-unwrapped/pin.nix;
inherit (pinData.hashes) desktopSrcHash desktopYarnHash;
executableName = "element-desktop";
keytar = callPackage ./keytar { inherit Security AppKit; };
seshat = callPackage ./seshat { inherit CoreServices; };
keytar = callPackage ./keytar { inherit (darwin.apple_sdk.frameworks) Security AppKit; };
seshat = callPackage ./seshat { inherit (darwin.apple_sdk.frameworks) CoreServices; };
electron = electron_33;
in
stdenv.mkDerivation (
Expand Down
100 changes: 100 additions & 0 deletions pkgs/by-name/el/element-web-unwrapped/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchYarnDeps,
jq,
yarn,
fixup-yarn-lock,
nodejs,
jitsi-meet,
}:

let
pinData = import ./pin.nix;
inherit (pinData.hashes) webSrcHash webYarnHash;
noPhoningHome = {
disable_guests = true; # disable automatic guest account registration at matrix.org
};
in
stdenv.mkDerivation (
finalAttrs:
builtins.removeAttrs pinData [ "hashes" ]
// {
pname = "element-web";

src = fetchFromGitHub {
owner = "element-hq";
repo = "element-web";
rev = "v${finalAttrs.version}";
hash = webSrcHash;
};

offlineCache = fetchYarnDeps {
yarnLock = finalAttrs.src + "/yarn.lock";
sha256 = webYarnHash;
};

nativeBuildInputs = [
yarn
fixup-yarn-lock
jq
nodejs
];

buildPhase = ''
runHook preBuild
export VERSION=${finalAttrs.version}
yarn --offline build:res
yarn --offline build:module_system
yarn --offline build:bundle
runHook postBuild
'';

configurePhase = ''
runHook preConfigure
export HOME=$PWD/tmp
# with the update of openssl3, some key ciphers are not supported anymore
# this flag will allow those codecs again as a workaround
# see https://medium.com/the-node-js-collection/node-js-17-is-here-8dba1e14e382#5f07
# and https://github.com/element-hq/element-web/issues/21043
export NODE_OPTIONS=--openssl-legacy-provider
mkdir -p $HOME
fixup-yarn-lock yarn.lock
yarn config --offline set yarn-offline-mirror $offlineCache
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
patchShebangs node_modules
runHook postConfigure
'';

installPhase = ''
runHook preInstall
cp -R webapp $out
tar --extract --to-stdout --file ${jitsi-meet.src} jitsi-meet/libs/external_api.min.js > $out/jitsi_external_api.min.js
echo "${finalAttrs.version}" > "$out/version"
jq -s '.[0] * $conf' "config.sample.json" --argjson "conf" '${builtins.toJSON noPhoningHome}' > "$out/config.json"
runHook postInstall
'';

passthru = {
# run with: nix-shell ./maintainers/scripts/update.nix --argstr package element-web
updateScript = ./update.sh;
};

meta = {
description = "Glossy Matrix collaboration client for the web";
homepage = "https://element.io/";
changelog = "https://github.com/element-hq/element-web/blob/v${finalAttrs.version}/CHANGELOG.md";
maintainers = lib.teams.matrix.members;
license = lib.licenses.asl20;
platforms = lib.platforms.all;
};
}
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=../../../../../ -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github jq
#!nix-shell -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github jq

if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
echo "Regenerates packaging data for the element packages."
Expand All @@ -22,6 +22,8 @@ version="${version#v}"
web_src="https://raw.githubusercontent.com/element-hq/element-web/v$version"
web_src_hash=$(nix-prefetch-github element-hq element-web --rev v${version} | jq -r .hash)

cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1

web_tmpdir=$(mktemp -d)
trap 'rm -rf "$web_tmpdir"' EXIT

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions pkgs/top-level/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ mapAliases {
elasticsearch7Plugins = elasticsearchPlugins;

# Electron
element-desktop-wayland = element-desktop; # Added 2024-12-17


elixir_ls = elixir-ls; # Added 2023-03-20
Expand Down
14 changes: 0 additions & 14 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2290,20 +2290,6 @@ with pkgs;

electronplayer = callPackage ../applications/video/electronplayer/electronplayer.nix { };

element-desktop = callPackage ../applications/networking/instant-messengers/element/element-desktop.nix {
inherit (darwin.apple_sdk.frameworks) Security AppKit CoreServices;
};
element-desktop-wayland = writeScriptBin "element-desktop" ''
#!/bin/sh
NIXOS_OZONE_WL=1 exec ${element-desktop}/bin/element-desktop "$@"
'';

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 { };
};

elm-github-install = callPackage ../tools/package-management/elm-github-install { };

espanso-wayland = espanso.override {
Expand Down

0 comments on commit 51ff21f

Please sign in to comment.