element-desktop: fix darwin build (#132635)

Add Frameworks to native dependencies

Signed-off-by: Finn Behrens <me@kloenk.dev>
This commit is contained in:
Finn Behrens 2021-08-04 11:09:56 +02:00 committed by GitHub
parent f09a770d9c
commit 15af01b456
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 10 deletions

View File

@ -2,6 +2,9 @@
, makeWrapper, makeDesktopItem, mkYarnPackage , makeWrapper, makeDesktopItem, mkYarnPackage
, electron, element-web , electron, element-web
, callPackage , callPackage
, Security
, AppKit
, CoreServices
}: }:
# Notes for maintainers: # Notes for maintainers:
# * versions of `element-web` and `element-desktop` should be kept in sync. # * versions of `element-web` and `element-desktop` should be kept in sync.
@ -25,8 +28,8 @@ in mkYarnPackage rec {
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];
seshat = callPackage ./seshat {}; seshat = callPackage ./seshat { inherit CoreServices; };
keytar = callPackage ./keytar {}; keytar = callPackage ./keytar { inherit Security AppKit; };
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild

View File

@ -1,4 +1,5 @@
{ stdenv, fetchFromGitHub, nodejs-14_x, python3, callPackage, fixup_yarn_lock, yarn, pkg-config, libsecret }: { lib, stdenv, fetchFromGitHub, nodejs-14_x, python3, callPackage
, fixup_yarn_lock, yarn, pkg-config, libsecret, xcbuild, Security, AppKit }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "keytar"; pname = "keytar";
@ -11,8 +12,10 @@ stdenv.mkDerivation rec {
sha256 = "0ajvr4kjbyw2shb1y14c0dsghdlnq30f19hk2sbzj6n9y3xa3pmi"; sha256 = "0ajvr4kjbyw2shb1y14c0dsghdlnq30f19hk2sbzj6n9y3xa3pmi";
}; };
nativeBuildInputs = [ nodejs-14_x python3 yarn pkg-config]; nativeBuildInputs = [ nodejs-14_x python3 yarn pkg-config ]
buildInputs = [ libsecret ]; ++ lib.optional stdenv.isDarwin xcbuild;
buildInputs = lib.optionals (!stdenv.isDarwin) [ libsecret ]
++ lib.optionals stdenv.isDarwin [ Security AppKit ];
npm_config_nodedir = nodejs-14_x; npm_config_nodedir = nodejs-14_x;
@ -21,7 +24,8 @@ stdenv.mkDerivation rec {
buildPhase = '' buildPhase = ''
cp ${./yarn.lock} ./yarn.lock cp ${./yarn.lock} ./yarn.lock
chmod u+w . ./yarn.lock chmod u+w . ./yarn.lock
export HOME=/tmp export HOME=$PWD/tmp
mkdir -p $HOME
yarn config --offline set yarn-offline-mirror ${yarnOfflineCache} yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
${fixup_yarn_lock}/bin/fixup_yarn_lock yarn.lock ${fixup_yarn_lock}/bin/fixup_yarn_lock yarn.lock
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
@ -34,6 +38,7 @@ stdenv.mkDerivation rec {
installPhase = '' installPhase = ''
shopt -s extglob shopt -s extglob
rm -rf node_modules rm -rf node_modules
rm -rf $HOME
mkdir -p $out mkdir -p $out
cp -r ./!(build) $out cp -r ./!(build) $out
install -D -t $out/build/Release build/Release/keytar.node install -D -t $out/build/Release build/Release/keytar.node

View File

@ -1,4 +1,4 @@
{ rustPlatform, fetchFromGitHub, callPackage, sqlcipher, nodejs-14_x, python3, yarn, fixup_yarn_lock }: { lib, stdenv, rustPlatform, fetchFromGitHub, callPackage, sqlcipher, nodejs-14_x, python3, yarn, fixup_yarn_lock, CoreServices }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
pname = "seshat-node"; pname = "seshat-node";
@ -14,7 +14,7 @@ rustPlatform.buildRustPackage rec {
sourceRoot = "source/seshat-node/native"; sourceRoot = "source/seshat-node/native";
nativeBuildInputs = [ nodejs-14_x python3 yarn ]; nativeBuildInputs = [ nodejs-14_x python3 yarn ];
buildInputs = [ sqlcipher ]; buildInputs = [ sqlcipher ] ++ lib.optional stdenv.isDarwin CoreServices;
npm_config_nodedir = nodejs-14_x; npm_config_nodedir = nodejs-14_x;
@ -23,7 +23,8 @@ rustPlatform.buildRustPackage rec {
buildPhase = '' buildPhase = ''
cd .. cd ..
chmod u+w . ./yarn.lock chmod u+w . ./yarn.lock
export HOME=/tmp export HOME=$PWD/tmp
mkdir -p $HOME
yarn config --offline set yarn-offline-mirror ${yarnOfflineCache} yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
${fixup_yarn_lock}/bin/fixup_yarn_lock yarn.lock ${fixup_yarn_lock}/bin/fixup_yarn_lock yarn.lock
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
@ -37,6 +38,7 @@ rustPlatform.buildRustPackage rec {
shopt -s extglob shopt -s extglob
rm -rf native/!(index.node) rm -rf native/!(index.node)
rm -rf node_modules rm -rf node_modules
rm -rf $HOME
cp -r . $out cp -r . $out
''; '';

View File

@ -2632,7 +2632,9 @@ in
element = callPackage ../applications/science/chemistry/element { }; element = callPackage ../applications/science/chemistry/element { };
element-desktop = callPackage ../applications/networking/instant-messengers/element/element-desktop.nix { }; element-desktop = callPackage ../applications/networking/instant-messengers/element/element-desktop.nix {
inherit (darwin.apple_sdk.frameworks) Security AppKit CoreServices;
};
element-web = callPackage ../applications/networking/instant-messengers/element/element-web.nix { element-web = callPackage ../applications/networking/instant-messengers/element/element-web.nix {
conf = config.element-web.conf or {}; conf = config.element-web.conf or {};