Merge pull request #130561 from dotlambda/deltachat-desktop-init

deltachat-desktop: init at unstable-2021-08-04
This commit is contained in:
Robert Schütz 2021-08-10 01:55:54 +02:00 committed by GitHub
commit ffd075df9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 1730 additions and 111 deletions

View File

@ -0,0 +1,95 @@
{ lib
, copyDesktopItems
, electron
, esbuild
, fetchFromGitHub
, libdeltachat
, makeDesktopItem
, makeWrapper
, nodePackages
, pkg-config
, stdenv
, CoreServices
}:
let
electronExec = if stdenv.isDarwin then
"${electron}/Applications/Electron.app/Contents/MacOS/Electron"
else
"${electron}/bin/electron";
in nodePackages.deltachat-desktop.override rec {
pname = "deltachat-desktop";
version = "unstable-2021-08-04";
src = fetchFromGitHub {
owner = "deltachat";
repo = "deltachat-desktop";
rev = "2c47d6b7e46f4f68c7eb45508ab9e145af489ea1";
sha256 = "03b6j3cj2yanvsargh6q57bf1llg17yrqgmd14lp0wkam767kkfa";
};
nativeBuildInputs = [
esbuild
makeWrapper
pkg-config
] ++ lib.optionals stdenv.isLinux [
copyDesktopItems
];
buildInputs = [
libdeltachat
] ++ lib.optionals stdenv.isDarwin [
CoreServices
];
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
USE_SYSTEM_LIBDELTACHAT = "true";
VERSION_INFO_GIT_REF = src.rev;
postInstall = let
keep = lib.concatMapStringsSep " " (file: "! -name ${file}") [
"_locales" "build" "html-dist" "images" "index.js"
"node_modules" "themes" "tsc-dist"
];
in ''
rm -r node_modules/deltachat-node/{deltachat-core-rust,prebuilds,src}
patchShebangs node_modules/sass/sass.js
npm run build
npm prune --production
find . -mindepth 1 -maxdepth 1 ${keep} -print0 | xargs -0 rm -r
mkdir -p $out/share/icons/hicolor/scalable/apps
ln -s $out/lib/node_modules/deltachat-desktop/build/icon.png \
$out/share/icons/hicolor/scalable/apps/deltachat.png
makeWrapper ${electronExec} $out/bin/deltachat \
--add-flags $out/lib/node_modules/deltachat-desktop
'';
desktopItems = lib.singleton (makeDesktopItem {
name = "deltachat";
exec = "deltachat %u";
icon = "deltachat";
desktopName = "Delta Chat";
genericName = "Delta Chat";
comment = meta.description;
categories = "Network;InstantMessaging;Chat;";
extraEntries = ''
StartupWMClass=DeltaChat
MimeType=x-scheme-handler/openpgp4fpr;x-scheme-handler/mailto;
'';
});
passthru.updateScript = ./update.sh;
meta = with lib; {
description = "Email-based instant messaging for Desktop";
homepage = "https://github.com/deltachat/deltachat-desktop";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ dotlambda ];
};
}

View File

@ -0,0 +1,58 @@
{
"name": "deltachat-desktop",
"version": "1.20.3",
"dependencies": {
"@blueprintjs/core": "^3.22.3",
"@mapbox/geojson-extent": "^1.0.0",
"application-config": "^1.0.1",
"array-differ": "^3.0.0",
"classnames": "^2.3.1",
"debounce": "^1.2.0",
"deltachat-node": "1.56.2",
"emoji-js-clean": "^4.0.0",
"emoji-mart": "^3.0.0",
"emoji-regex": "^9.2.2",
"error-stack-parser": "^2.0.6",
"filesize": "^6.1.0",
"fs-extra": "^8.1.0",
"mapbox-gl": "^1.12.0",
"mime-types": "^2.1.31",
"moment": "^2.27.0",
"node-fetch": "^2.6.1",
"path-browserify": "^1.0.1",
"punycode": "^2.1.1",
"rc": "^1.2.8",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-qr-reader": "^2.2.1",
"react-qr-svg": "^2.1.0",
"react-string-replace": "^0.4.4",
"react-virtualized": "^9.21.2",
"simple-markdown": "^0.7.1",
"source-map-support": "^0.5.19",
"tempy": "^0.3.0",
"url-parse": "^1.4.7",
"use-debounce": "^3.3.0",
"@babel/core": "^7.7.7",
"@types/debounce": "^1.2.0",
"@babel/preset-env": "^7.7.7",
"@babel/preset-react": "^7.7.4",
"@types/emoji-mart": "^3.0.2",
"@types/fs-extra": "^8.0.1",
"@types/mapbox-gl": "^0.54.5",
"@types/mime-types": "^2.1.0",
"@types/node": "^14.14.20",
"@types/node-fetch": "^2.5.7",
"@types/prop-types": "^15.7.3",
"@types/rc": "^1.1.0",
"@types/react": "^16.9.17",
"@types/react-dom": "^16.9.4",
"@types/react-virtualized": "^9.21.10",
"@types/url-parse": "^1.4.3",
"electron": "^13.1.6",
"glob-watcher": "^5.0.5",
"sass": "^1.26.5",
"typescript": "^3.9.7",
"xml-js": "^1.6.8"
}
}

View File

@ -0,0 +1,42 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p curl jq nix-prefetch
set -euo pipefail
cd "$(dirname "$0")"
owner=deltachat
repo=deltachat-desktop
nixpkgs=../../../../..
rev=$(
curl -s "https://api.github.com/repos/$owner/$repo/releases" |
jq 'map(select(.prerelease | not)) | .[0].tag_name' --raw-output
)
ver=$(echo "$rev" | sed 's/^v//')
old_ver=$(sed -n 's/.*\bversion = "\(.*\)".*/\1/p' default.nix)
if [ "$ver" = "$old_ver" ]; then
echo "Up to date: $ver"
exit
fi
echo "$old_ver -> $ver"
sha256=$(nix-prefetch -f "$nixpkgs" deltachat-desktop --rev "$rev")
sed -e "s#\\bversion = \".*\"#version = \"$ver\"#" \
-e "s#\\bsha256 = \".*\"#sha256 = \"$sha256\"#" \
-i default.nix
src=$(nix-build "$nixpkgs" -A deltachat-desktop.src --no-out-link)
jq '{ name, version, dependencies: (.dependencies + (.devDependencies | del(.["@typescript-eslint/eslint-plugin","@typescript-eslint/parser","esbuild","electron-builder","electron-devtools-installer","electron-notarize","esbuild","eslint","eslint-config-prettier","eslint-plugin-react-hooks","hallmark","prettier","tape","testcafe","testcafe-browser-provider-electron","testcafe-react-selectors","walk"]))) }' \
"$src/package.json" > package.json.new
if cmp --quiet package.json{.new,}; then
echo "package.json not changed, skip updating nodePackages"
rm package.json.new
else
echo "package.json changed, updating nodePackages"
mv package.json{.new,}
pushd ../../../../development/node-packages
./generate.sh
popd
fi

View File

@ -1,40 +0,0 @@
{ lib, fetchurl, appimageTools, gsettings-desktop-schemas, gtk3 }:
let
pname = "deltachat-electron";
version = "1.20.3";
name = "${pname}-${version}";
src = fetchurl {
url = "https://download.delta.chat/desktop/v${version}/DeltaChat-${version}.AppImage";
sha256 = "sha256-u0YjaXb+6BOBWaZANPcaxp7maqlBWAtecSsCGbr67dk=";
};
appimageContents = appimageTools.extract { inherit name src; };
in
appimageTools.wrapType2 {
inherit name src;
profile = ''
export XDG_DATA_DIRS=${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS
'';
extraInstallCommands = ''
mv $out/bin/${name} $out/bin/${pname}
install -m 444 -D \
${appimageContents}/deltachat-desktop.desktop \
$out/share/applications/${pname}.desktop
substituteInPlace $out/share/applications/${pname}.desktop \
--replace 'Exec=AppRun' 'Exec=${pname}'
cp -r ${appimageContents}/usr/share/icons $out/share
'';
meta = with lib; {
description = "Electron client for DeltaChat";
homepage = "https://delta.chat/";
license = licenses.gpl3;
maintainers = with maintainers; [ ehmry ];
platforms = [ "x86_64-linux" ];
};
}

View File

@ -66,5 +66,6 @@ in mkDerivation rec {
homepage = "https://git.sr.ht/~link2xt/kdeltachat";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ dotlambda ];
platforms = platforms.linux;
};
}

View File

@ -1,12 +1,17 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, openssl
, perl
, pkg-config
, rustPlatform
, sqlite
, fixDarwinDylibNames
, CoreFoundation
, Security
, libiconv
}:
stdenv.mkDerivation rec {
@ -20,6 +25,15 @@ stdenv.mkDerivation rec {
sha256 = "sha256-ZyVEI6q+GzHLEFH01TxS7NqwT7zqVgg0vduyf/fibB8=";
};
patches = [
# https://github.com/deltachat/deltachat-core-rust/pull/2589
(fetchpatch {
url = "https://github.com/deltachat/deltachat-core-rust/commit/408467e85d04fbbfd6bed5908d84d9e995943487.patch";
sha256 = "1j2ywaazglgl6370js34acrg0wrh0b7krqg05dfjf65n527lzn59";
})
./no-static-lib.patch
];
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
name = "${pname}-${version}";
@ -33,11 +47,17 @@ stdenv.mkDerivation rec {
] ++ (with rustPlatform; [
cargoSetupHook
rust.cargo
]);
]) ++ lib.optionals stdenv.isDarwin [
fixDarwinDylibNames
];
buildInputs = [
openssl
sqlite
] ++ lib.optionals stdenv.isDarwin [
CoreFoundation
Security
libiconv
];
checkInputs = with rustPlatform; [
@ -49,7 +69,7 @@ stdenv.mkDerivation rec {
homepage = "https://github.com/deltachat/deltachat-core-rust/";
changelog = "https://github.com/deltachat/deltachat-core-rust/blob/${version}/CHANGELOG.md";
license = licenses.mpl20;
platforms = platforms.linux;
maintainers = with maintainers; [ dotlambda ];
platforms = platforms.unix;
};
}

View File

@ -0,0 +1,39 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe7abe08..acdbe0d6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,7 +13,6 @@ find_program(CARGO cargo)
add_custom_command(
OUTPUT
- "target/release/libdeltachat.a"
"target/release/libdeltachat.${DYNAMIC_EXT}"
"target/release/pkgconfig/deltachat.pc"
COMMAND
@@ -38,13 +37,11 @@ add_custom_target(
lib_deltachat
ALL
DEPENDS
- "target/release/libdeltachat.a"
"target/release/libdeltachat.${DYNAMIC_EXT}"
"target/release/pkgconfig/deltachat.pc"
)
include(GNUInstallDirs)
install(FILES "deltachat-ffi/deltachat.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
-install(FILES "target/release/libdeltachat.a" DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES "target/release/libdeltachat.${DYNAMIC_EXT}" DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES "target/release/pkgconfig/deltachat.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
diff --git a/deltachat-ffi/Cargo.toml b/deltachat-ffi/Cargo.toml
index a34a27ba..cf354abb 100644
--- a/deltachat-ffi/Cargo.toml
+++ b/deltachat-ffi/Cargo.toml
@@ -12,7 +12,7 @@ categories = ["cryptography", "std", "email"]
[lib]
name = "deltachat"
-crate-type = ["cdylib", "staticlib"]
+crate-type = ["cdylib"]
[dependencies]
deltachat = { path = "../", default-features = false }

View File

@ -46,6 +46,10 @@ let
'';
};
deltachat-desktop = super."deltachat-desktop-../../applications/networking/instant-messengers/deltachat-desktop".override {
meta.broken = true; # use the top-level package instead
};
fast-cli = super.fast-cli.override ({
nativeBuildInputs = [ pkgs.makeWrapper ];
prePatch = ''

View File

@ -78,6 +78,7 @@
, "csslint"
, "dat"
, "degit"
, {"deltachat-desktop": "../../applications/networking/instant-messengers/deltachat-desktop"}
, "dhcp"
, "diagnostic-languageserver"
, "dockerfile-language-server-nodejs"

File diff suppressed because it is too large Load Diff

View File

@ -182,6 +182,7 @@ mapAliases ({
debian_devscripts = debian-devscripts; # added 2016-03-23
deepin = throw "deepin was a work in progress and it has been canceled and removed https://github.com/NixOS/nixpkgs/issues/94870"; # added 2020-08-31
deepspeech = throw "deepspeech was removed in favor of stt. https://github.com/NixOS/nixpkgs/issues/119496"; # added 2021-05-05
deltachat-electron = deltachat-desktop; # added 2021-07-18
desktop_file_utils = desktop-file-utils; # added 2018-02-25
devicemapper = lvm2; # added 2018-04-25
digikam5 = digikam; # added 2017-02-18

View File

@ -1463,8 +1463,9 @@ with pkgs;
deltachat-cursed = callPackage ../applications/networking/instant-messengers/deltachat-cursed { };
deltachat-electron = callPackage
../applications/networking/instant-messengers/deltachat-electron { };
deltachat-desktop = callPackage ../applications/networking/instant-messengers/deltachat-desktop {
inherit (darwin.apple_sdk.frameworks) CoreServices;
};
deskew = callPackage ../applications/graphics/deskew { };
@ -16524,7 +16525,10 @@ with pkgs;
libdeflate = callPackage ../development/libraries/libdeflate { };
libdeltachat = callPackage ../development/libraries/libdeltachat { };
libdeltachat = callPackage ../development/libraries/libdeltachat {
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security;
inherit (darwin) libiconv;
};
libdevil = callPackage ../development/libraries/libdevil {
inherit (darwin.apple_sdk.frameworks) OpenGL;