nixpkgs/pkgs/by-name/ci/cinny-desktop/package.nix

98 lines
2.4 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
rustPlatform,
cargo-tauri_1,
cinny,
desktop-file-utils,
wrapGAppsHook3,
pkg-config,
openssl,
glib-networking,
webkitgtk_4_0,
jq,
moreutils,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "cinny-desktop";
# We have to be using the same version as cinny-web or this isn't going to work.
version = "4.8.0";
src = fetchFromGitHub {
owner = "cinnyapp";
repo = "cinny-desktop";
tag = "v${finalAttrs.version}";
hash = "sha256-cixpsn0jMufd6VrBCsCH9t3bpkKdgi1i0qnkBlLgLG0=";
};
sourceRoot = "${finalAttrs.src.name}/src-tauri";
useFetchCargoVendor = true;
cargoHash = "sha256-twfRuoA4z+Xgyyn7aIRy6MV1ozN2+qhSLh8i+qOTa2Q=";
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
''
${lib.getExe jq} \
'del(.tauri.updater) | .build.distDir = "${cinny'}" | del(.build.beforeBuildCommand)' tauri.conf.json \
| ${lib.getExe' moreutils "sponge"} tauri.conf.json
'';
postInstall =
lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$out/bin"
ln -sf "$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_1.hook
]
++ lib.optionals stdenv.hostPlatform.isLinux [
desktop-file-utils
pkg-config
wrapGAppsHook3
];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
glib-networking
openssl
webkitgtk_4_0
];
meta = {
description = "Yet another matrix client for desktop";
homepage = "https://github.com/cinnyapp/cinny-desktop";
maintainers = with lib.maintainers; [
qyriad
ryand56
];
license = lib.licenses.agpl3Only;
platforms = lib.platforms.linux ++ lib.platforms.darwin;
mainProgram = "cinny";
};
})