diff --git a/pkgs/applications/networking/instant-messengers/element/element-desktop.nix b/pkgs/applications/networking/instant-messengers/element/element-desktop.nix index 60c6f3328477..a873af6d2ef6 100644 --- a/pkgs/applications/networking/instant-messengers/element/element-desktop.nix +++ b/pkgs/applications/networking/instant-messengers/element/element-desktop.nix @@ -2,6 +2,9 @@ , makeWrapper, makeDesktopItem, mkYarnPackage , electron, element-web , callPackage +, Security +, AppKit +, CoreServices }: # Notes for maintainers: # * versions of `element-web` and `element-desktop` should be kept in sync. @@ -25,8 +28,8 @@ in mkYarnPackage rec { nativeBuildInputs = [ makeWrapper ]; - seshat = callPackage ./seshat {}; - keytar = callPackage ./keytar {}; + seshat = callPackage ./seshat { inherit CoreServices; }; + keytar = callPackage ./keytar { inherit Security AppKit; }; buildPhase = '' runHook preBuild diff --git a/pkgs/applications/networking/instant-messengers/element/keytar/default.nix b/pkgs/applications/networking/instant-messengers/element/keytar/default.nix index 87ef174271dc..f848601874a4 100644 --- a/pkgs/applications/networking/instant-messengers/element/keytar/default.nix +++ b/pkgs/applications/networking/instant-messengers/element/keytar/default.nix @@ -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 { pname = "keytar"; @@ -11,8 +12,10 @@ stdenv.mkDerivation rec { sha256 = "0ajvr4kjbyw2shb1y14c0dsghdlnq30f19hk2sbzj6n9y3xa3pmi"; }; - nativeBuildInputs = [ nodejs-14_x python3 yarn pkg-config]; - buildInputs = [ libsecret ]; + nativeBuildInputs = [ nodejs-14_x python3 yarn pkg-config ] + ++ lib.optional stdenv.isDarwin xcbuild; + buildInputs = lib.optionals (!stdenv.isDarwin) [ libsecret ] + ++ lib.optionals stdenv.isDarwin [ Security AppKit ]; npm_config_nodedir = nodejs-14_x; @@ -21,7 +24,8 @@ stdenv.mkDerivation rec { buildPhase = '' cp ${./yarn.lock} ./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} ${fixup_yarn_lock}/bin/fixup_yarn_lock yarn.lock yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive @@ -34,6 +38,7 @@ stdenv.mkDerivation rec { installPhase = '' shopt -s extglob rm -rf node_modules + rm -rf $HOME mkdir -p $out cp -r ./!(build) $out install -D -t $out/build/Release build/Release/keytar.node diff --git a/pkgs/applications/networking/instant-messengers/element/seshat/default.nix b/pkgs/applications/networking/instant-messengers/element/seshat/default.nix index 6dbd15efe724..ae9dd96228b5 100644 --- a/pkgs/applications/networking/instant-messengers/element/seshat/default.nix +++ b/pkgs/applications/networking/instant-messengers/element/seshat/default.nix @@ -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 { pname = "seshat-node"; @@ -14,7 +14,7 @@ rustPlatform.buildRustPackage rec { sourceRoot = "source/seshat-node/native"; nativeBuildInputs = [ nodejs-14_x python3 yarn ]; - buildInputs = [ sqlcipher ]; + buildInputs = [ sqlcipher ] ++ lib.optional stdenv.isDarwin CoreServices; npm_config_nodedir = nodejs-14_x; @@ -23,7 +23,8 @@ rustPlatform.buildRustPackage rec { buildPhase = '' cd .. chmod u+w . ./yarn.lock - export HOME=/tmp + export HOME=$PWD/tmp + mkdir -p $HOME yarn config --offline set yarn-offline-mirror ${yarnOfflineCache} ${fixup_yarn_lock}/bin/fixup_yarn_lock yarn.lock yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive @@ -37,6 +38,7 @@ rustPlatform.buildRustPackage rec { shopt -s extglob rm -rf native/!(index.node) rm -rf node_modules + rm -rf $HOME cp -r . $out ''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 412985e644a5..89eb3115537b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2632,7 +2632,9 @@ in 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 { conf = config.element-web.conf or {};