Unverified Commit 9f136138 authored by Ryan Omasta's avatar Ryan Omasta
Browse files

cinny-desktop: format using nixfmt-rfc-style

parent ce84b361
Loading
Loading
Loading
Loading
+74 −57
Original line number Diff line number Diff line
{ lib
, stdenv
, darwin
, fetchFromGitHub
, rust
, rustPlatform
, cargo-tauri
, cinny
, copyDesktopItems
, wrapGAppsHook3
, pkg-config
, openssl
, dbus
, glib
, glib-networking
, libayatana-appindicator
, webkitgtk
, makeDesktopItem
{
  lib,
  stdenv,
  darwin,
  fetchFromGitHub,
  rust,
  rustPlatform,
  cargo-tauri,
  cinny,
  copyDesktopItems,
  wrapGAppsHook3,
  pkg-config,
  openssl,
  dbus,
  glib,
  glib-networking,
  libayatana-appindicator,
  webkitgtk,
  makeDesktopItem,
}:

rustPlatform.buildRustPackage rec {
@@ -34,20 +35,25 @@ rustPlatform.buildRustPackage rec {

  cargoHash = "sha256-bM+V37PJAob/DA2jy2g69zUY99ZyZBzgO6djadbdiJw=";

  postPatch = let
  postPatch =
    let
      cinny' =
      assert lib.assertMsg (cinny.version == version) "cinny.version (${cinny.version}) != cinny-desktop.version (${version})";
        assert lib.assertMsg (
          cinny.version == version
        ) "cinny.version (${cinny.version}) != cinny-desktop.version (${version})";
        cinny.override {
          conf = {
            hashRouter.enabled = true;
          };
        };
  in ''
    in
    ''
      substituteInPlace tauri.conf.json \
        --replace '"distDir": "../cinny/dist",' '"distDir": "${cinny'}",'
      substituteInPlace tauri.conf.json \
        --replace '"cd cinny && npm run build"' '""'
  '' + lib.optionalString stdenv.hostPlatform.isLinux ''
    ''
    + lib.optionalString stdenv.hostPlatform.isLinux ''
      substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
        --replace "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
    '';
@@ -56,11 +62,13 @@ rustPlatform.buildRustPackage rec {
    cargo tauri build --bundles app --target "${rust.envVars.rustHostPlatform}"
  '';

  postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
  postInstall =
    lib.optionalString stdenv.hostPlatform.isLinux ''
      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
  '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
    ''
    + lib.optionalString stdenv.hostPlatform.isDarwin ''
      mkdir -p "$out/Applications/"
      cp -r "target/${rust.envVars.rustHostPlatform}/release/bundle/macos/Cinny.app" "$out/Applications/"
      ln -sf "$out/Applications/Cinny.app/Contents/MacOS/Cinny" "$out/bin/cinny"
@@ -73,15 +81,18 @@ rustPlatform.buildRustPackage rec {
    cargo-tauri
  ];

  buildInputs = [
  buildInputs =
    [
      openssl
      dbus
      glib
  ] ++ lib.optionals stdenv.hostPlatform.isLinux [
    ]
    ++ lib.optionals stdenv.hostPlatform.isLinux [
      glib-networking
      libayatana-appindicator
      webkitgtk
  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
    ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
      darwin.DarwinTools
      darwin.apple_sdk.frameworks.WebKit
    ];
@@ -93,14 +104,20 @@ rustPlatform.buildRustPackage rec {
      icon = "cinny";
      desktopName = "Cinny";
      comment = meta.description;
      categories = [ "Network" "InstantMessaging" ];
      categories = [
        "Network"
        "InstantMessaging"
      ];
    })
  ];

  meta = {
    description = "Yet another matrix client for desktop";
    homepage = "https://github.com/cinnyapp/cinny-desktop";
    maintainers = with lib.maintainers; [ qyriad ryand56 ];
    maintainers = with lib.maintainers; [
      qyriad
      ryand56
    ];
    license = lib.licenses.agpl3Only;
    platforms = lib.platforms.linux ++ lib.platforms.darwin;
    mainProgram = "cinny";