cinny, cinny-desktop: build from source

This commit is contained in:
huantian 2023-09-01 12:46:12 -07:00
parent 6d9e1eb60a
commit e095938c26
No known key found for this signature in database
GPG key ID: 4A0318E04E555DE5
3 changed files with 68 additions and 33 deletions

View file

@ -1,45 +1,74 @@
{ stdenv
, lib
, dpkg
, fetchurl
, autoPatchelfHook
, glib-networking
, openssl
, webkitgtk
{ lib
, fetchFromGitHub
, rustPlatform
, cinny
, copyDesktopItems
, wrapGAppsHook
, pkg-config
, openssl
, dbus
, glib
, glib-networking
, webkitgtk
, makeDesktopItem
}:
stdenv.mkDerivation rec {
rustPlatform.buildRustPackage rec {
pname = "cinny-desktop";
version = "2.2.6";
src = fetchurl {
url = "https://github.com/cinnyapp/cinny-desktop/releases/download/v${version}/Cinny_desktop-x86_64.deb";
sha256 = "sha256-Bh7qBlHh2bQ6y2HnI4TtxMU6N3t04tr1Juoul2KMrqs=";
src = fetchFromGitHub {
owner = "cinnyapp";
repo = "cinny-desktop";
rev = "v${version}";
hash = "sha256-RW6LeItIAHJk1e7qMa1MLIGb3jHvJ/KM8E9l1qR48w8=";
};
sourceRoot = "${src.name}/src-tauri";
cargoHash = "sha256-Iab/icQ9hFVh/o6egZVPa2zeKgO5WxzkluhRckcayvw=";
postPatch = ''
substituteInPlace tauri.conf.json \
--replace '"distDir": "../cinny/dist",' '"distDir": "${cinny}",'
'';
postInstall = ''
install -DT icons/128x128@2x.png $out/share/icons/hicolor/256x256@2/apps/cinny.png
install -DT icons/128x128.png $out/share/icons/hicolor/128x128/apps/cinny.png
install -DT icons/32x32.png $out/share/icons/hicolor/32x32/apps/cinny.png
'';
nativeBuildInputs = [
autoPatchelfHook
dpkg
copyDesktopItems
wrapGAppsHook
pkg-config
];
buildInputs = [
glib-networking
openssl
dbus
glib
glib-networking
webkitgtk
wrapGAppsHook
];
unpackCmd = "dpkg-deb -x $curSrc source";
installPhase = "mv usr $out";
desktopItems = [
(makeDesktopItem {
name = "cinny";
exec = "cinny";
icon = "cinny";
desktopName = "Cinny";
comment = meta.description;
categories = [ "Network" "InstantMessaging" ];
})
];
meta = with lib; {
description = "Yet another matrix client for desktop";
homepage = "https://github.com/cinnyapp/cinny-desktop";
maintainers = [ maintainers.aveltras ];
license = licenses.agpl3Only;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
platforms = platforms.linux;
mainProgram = "cinny";
};

View file

@ -1,22 +1,30 @@
{ lib, stdenv, fetchurl, writeText, jq, conf ? {} }:
{ lib, buildNpmPackage, fetchFromGitHub, writeText, jq, conf ? { } }:
let
configOverrides = writeText "cinny-config-overrides.json" (builtins.toJSON conf);
in stdenv.mkDerivation rec {
in
buildNpmPackage rec {
pname = "cinny";
version = "2.2.6";
src = fetchurl {
url = "https://github.com/ajbura/cinny/releases/download/v${version}/cinny-v${version}.tar.gz";
hash = "sha256-AvYM8++PqKmm7CJN5hmg9GSC72IoHX+rRxuT3GflvjU=";
src = fetchFromGitHub {
owner = "cinnyapp";
repo = "cinny";
rev = "v${version}";
hash = "sha256-Da/gbq9piKvkIMiamoafcRrqxF7128GXoswk2C43An8=";
};
npmDepsHash = "sha256-3wgB/dQmLtwxbRsk+OUcyfx98vpCvhvseEOCrJIFohY=";
nativeBuildInputs = [
jq
];
installPhase = ''
runHook preInstall
mkdir -p $out/
cp -R . $out/
${jq}/bin/jq -s '.[0] * .[1]' "config.json" "${configOverrides}" > "$out/config.json"
cp -r dist $out
jq -s '.[0] * .[1]' "config.json" "${configOverrides}" > "$out/config.json"
runHook postInstall
'';
@ -25,7 +33,7 @@ in stdenv.mkDerivation rec {
description = "Yet another Matrix client for the web";
homepage = "https://cinny.in/";
maintainers = with maintainers; [ abbe ];
license = licenses.mit;
license = licenses.agpl3Only;
platforms = platforms.all;
};
}

View file

@ -4612,11 +4612,9 @@ with pkgs;
cht-sh = callPackage ../tools/misc/cht.sh { };
cinny = callPackage ../applications/networking/instant-messengers/cinny { stdenv = stdenvNoCC; };
cinny = callPackage ../applications/networking/instant-messengers/cinny { };
cinny-desktop = callPackage ../applications/networking/instant-messengers/cinny-desktop {
openssl = openssl_1_1;
};
cinny-desktop = callPackage ../applications/networking/instant-messengers/cinny-desktop { };
ckbcomp = callPackage ../tools/X11/ckbcomp { };