2023-11-22 13:28:50 +00:00
{ lib
, fetchFromGitHub
, copyDesktopItems
, stdenv
, stdenvNoCC
, rustc
, rustPlatform
, cargo
, cargo-tauri
, openssl
, libayatana-appindicator
, webkitgtk
, pkg-config
, makeDesktopItem
, jq
, moreutils
, nodePackages
, cacert
} :
stdenv . mkDerivation rec {
pname = " k i w i t a l k " ;
version = " 0 . 5 . 1 " ;
src = fetchFromGitHub {
owner = " K i w i T a l k " ;
repo = " K i w i T a l k " ;
rev = " v ${ version } " ;
hash = " s h a 2 5 6 - T h 8 q + Z b c 1 0 2 f I k 2 v 7 O 3 O O e S r i U V / y d z 6 0 Q w x z m S 7 A Y 8 = " ;
} ;
postPatch = ''
substituteInPlace $ cargoDepsCopy/libappindicator-sys- * /src/lib.rs \
- - replace " l i b a y a t a n a - a p p i n d i c a t o r 3 . s o . 1 " " ${ libayatana-appindicator } / l i b / l i b a y a t a n a - a p p i n d i c a t o r 3 . s o . 1 "
'' ;
pnpm-deps = stdenvNoCC . mkDerivation {
pname = " ${ pname } - p n p m - d e p s " ;
inherit src version ;
nativeBuildInputs = [
jq
moreutils
nodePackages . pnpm
cacert
] ;
installPhase = ''
export HOME = $ ( mktemp - d )
pnpm config set store-dir $ out
# This version of the package has different versions of esbuild as a dependency.
# You can use the command below to get esbuild binaries for a specific platform and calculate hashes for that platforms. (linux, darwin for os, and x86, arm64, ia32 for cpu)
# cat package.json | jq '.pnpm.supportedArchitectures += { "os": ["linux"], "cpu": ["arm64"] }' | sponge package.json
pnpm install - - frozen-lockfile - - ignore-script
# Remove timestamp and sort the json files.
rm - rf $ out/v3/tmp
for f in $ ( find $ out - name " * . j s o n " ) ; do
sed - i - E - e ' s / " c h e c k e d A t " : [ 0 -9 ] + , // g' $ f
jq - - sort-keys . $ f | sponge $ f
done
'' ;
dontBuild = true ;
dontFixup = true ;
outputHashMode = " r e c u r s i v e " ;
outputHash = {
x86_64-linux = " s h a 2 5 6 - L J P j W N p V f d U u 8 F 5 B M h A z p T o / h 6 a x 7 l x Y 2 E E S H j 5 P 3 9 0 = " ;
aarch64-linux = " s h a 2 5 6 - N 1 K 4 p V 5 r b W m O / K o n v Y e g z B o W a 6 T Y Q I q h Q y x H / s W j O J Q = " ;
i686-linux = " s h a 2 5 6 - / Q 7 V Z a h Y h L d K V F B 2 5 C a n R O Y x D 2 e t Q O c R g + 4 b X Z U M q T c = " ;
x86_64-darwin = " s h a 2 5 6 - 9 b i F A b F D 7 B v a 7 K P K z t g C v c a o X 8 E 6 A l J B K k j l D Q d P 6 Z w = " ;
aarch64-darwin = " s h a 2 5 6 - t o 5 Y 0 R 9 t m 9 b 7 j U Q A K 3 e B y l L h p u + w 5 o D d 6 3 F b B C B A v d 8 = " ;
2024-02-10 23:03:49 +00:00
} . ${ stdenv . system } or ( throw " U n s u p p o r t e d s y s t e m : ${ stdenv . system } " ) ;
2023-11-22 13:28:50 +00:00
} ;
cargoDeps = rustPlatform . importCargoLock {
lockFile = ./Cargo.lock ;
outputHashes = {
" t a u r i - p l u g i n - l o g - 0 . 0 . 0 " = " s h a 2 5 6 - 8 B r F f 7 v h e M J I a Z D 0 o X p i 8 V 4 h m U J F z H J m k c R t P L 1 / J 4 8 = " ;
" t a u r i - p l u g i n - s i n g l e - i n s t a n c e - 0 . 0 . 0 " = " s h a 2 5 6 - 8 B r F f 7 v h e M J I a Z D 0 o X p i 8 V 4 h m U J F z H J m k c R t P L 1 / J 4 8 = " ;
} ;
} ;
nativeBuildInputs = [
rustPlatform . cargoSetupHook
cargo
rustc
cargo-tauri
nodePackages . pnpm
copyDesktopItems
pkg-config
] ;
buildInputs = [
openssl
libayatana-appindicator
webkitgtk
] ;
preBuild = ''
export HOME = $ ( mktemp - d )
pnpm config set store-dir $ { pnpm-deps }
pnpm install - - offline - - frozen-lockfile - - ignore-script
pnpm rebuild
cargo tauri build - b deb
'' ;
preInstall = ''
mv target/release/bundle/deb /* / d a t a / u s r / $ o u t
# delete the generated desktop entry
rm - r $ out/share/applications
'' ;
desktopItems = [
( makeDesktopItem {
name = " K i w i T a l k " ;
exec = " k i w i - t a l k " ;
icon = " k i w i - t a l k " ;
desktopName = " K i w i T a l k " ;
comment = " A n U N O F F I C I A L c r o s s - p l a t f o r m K a k a o T a l k c l i e n t " ;
categories = [ " N e t w o r k " " I n s t a n t M e s s a g i n g " ] ;
terminal = false ;
} )
] ;
meta = with lib ; {
description = " A n U N O F F I C I A L c r o s s - p l a t f o r m K a k a o T a l k c l i e n t w r i t t e n i n T y p e S c r i p t & R u s t ( S o l i d J S , t a u r i ) " ;
homepage = " h t t p s : / / g i t h u b . c o m / K i w i T a l k / K i w i T a l k " ;
maintainers = with maintainers ; [ honnip ] ;
license = licenses . asl20 ;
platforms = platforms . linux ++ platforms . darwin ;
mainProgram = " k i w i - t a l k " ;
} ;
}