nixfiles/pkgs/cinny/cinny-desktop.nix
2026-03-13 01:40:02 +01:00

103 lines
2.7 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
rustPlatform,
cargo-tauri,
cinny,
desktop-file-utils,
wrapGAppsHook4,
makeBinaryWrapper,
pkg-config,
openssl,
glib-networking,
webkitgtk_4_1,
jq,
moreutils,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "cinny-desktop";
version = "4.11.1";
# nixpkgs-update: no auto update
src = fetchFromGitHub {
owner = "cinnyapp";
repo = "cinny-desktop";
tag = "v4.11.2";
hash = "sha256-iH3OBpLM5JyFo5QLjHSvGMgl0xDP9hpfngW49hvjLMY=";
};
sourceRoot = "${finalAttrs.src.name}/src-tauri";
cargoHash = "sha256-g1xDdqmouHD+qr5OvO2PVjFKAy2AXiatuTrLfh/QxAE=";
postPatch =
let
cinny' =
assert lib.assertMsg (
cinny.version == finalAttrs.version
) "cinny.version (${cinny.version}) != cinny-desktop.version (${finalAttrs.version})";
cinny.override {
conf = {
hashRouter.enabled = true;
};
};
in
# 'del(.app.windows) | del(.plugins.updater) | .bundle.createUpdaterArtifacts = false | .build.frontendDist = "${cinny'}" | del(.build.beforeBuildCommand)' tauri.conf.json \
''
${lib.getExe jq} \
'del(.plugins.tauri.updater) | .bundle.createUpdaterArtifacts = false | .build.frontendDist = "${cinny'}" | del(.build.beforeBuildCommand)' tauri.conf.json \
| ${lib.getExe' moreutils "sponge"} tauri.conf.json
cat tauri.conf.json
'';
postInstall =
lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$out/bin"
makeWrapper "$out/Applications/Cinny.app/Contents/MacOS/Cinny" "$out/bin/cinny"
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
desktop-file-edit \
--set-comment "Yet another matrix client for desktop" \
--set-key="Categories" --set-value="Network;InstantMessaging;" \
$out/share/applications/Cinny.desktop
'';
preFixup = ''
gappsWrapperArgs+=(
--set-default WEBKIT_DISABLE_DMABUF_RENDERER "1"
)
'';
nativeBuildInputs = [
cargo-tauri.hook
]
++ lib.optionals stdenv.hostPlatform.isLinux [
desktop-file-utils
pkg-config
wrapGAppsHook4
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
makeBinaryWrapper
];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
glib-networking
openssl
webkitgtk_4_1
];
meta = {
description = "Yet another matrix client for desktop";
homepage = "https://github.com/cinnyapp/cinny-desktop";
maintainers = with lib.maintainers; [
qyriad
rebmit
ryand56
];
license = lib.licenses.agpl3Only;
platforms = lib.platforms.linux ++ lib.platforms.darwin;
mainProgram = "cinny";
};
})