nixpkgs/pkgs/applications/networking/instant-messengers/fluffychat/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

99 lines
2.8 KiB
Nix
Raw Normal View History

2020-10-23 23:42:42 +00:00
{ lib
2024-01-18 00:38:10 +00:00
, fetchzip
2023-08-14 06:27:40 +00:00
, fetchFromGitHub
2022-02-20 18:05:42 +00:00
, imagemagick
2023-08-14 06:27:40 +00:00
, mesa
, libdrm
2024-03-09 22:20:23 +00:00
, flutter
2023-08-14 06:27:40 +00:00
, pulseaudio
2022-02-20 18:05:42 +00:00
, makeDesktopItem
2023-05-14 15:12:01 +00:00
, gnome
2024-01-18 00:38:10 +00:00
, targetFlutterPlatform ? "linux"
2020-10-23 23:42:42 +00:00
}:
2023-08-14 06:27:40 +00:00
let
libwebrtcRpath = lib.makeLibraryPath [ mesa libdrm ];
2024-01-20 15:45:09 +00:00
pubspecLock = lib.importJSON ./pubspec.lock.json;
2023-08-14 06:27:40 +00:00
in
2024-03-09 22:20:23 +00:00
flutter.buildFlutterApplication (rec {
pname = "fluffychat-${targetFlutterPlatform}";
2024-03-09 22:20:23 +00:00
version = "1.18.0";
2020-10-23 23:42:42 +00:00
2023-08-14 06:27:40 +00:00
src = fetchFromGitHub {
owner = "krille-chan";
2023-04-26 06:55:12 +00:00
repo = "fluffychat";
2023-08-14 06:27:40 +00:00
rev = "refs/tags/v${version}";
2024-03-09 22:20:23 +00:00
hash = "sha256-xm3+zBqg/mW2XxqFDXxeC+gIc+TgeciJmQf8w1kcW5Y=";
2020-10-23 23:42:42 +00:00
};
2024-01-20 15:45:09 +00:00
inherit pubspecLock;
2023-10-25 11:29:28 +00:00
gitHashes = {
2024-03-09 22:20:23 +00:00
flutter_shortcuts = "sha256-4nptZ7/tM2W/zylk3rfQzxXgQ6AipFH36gcIb/0RbHo=";
2023-10-25 11:29:28 +00:00
keyboard_shortcuts = "sha256-U74kRujftHPvpMOIqVT0Ph+wi1ocnxNxIFA1krft4Os=";
wakelock_windows = "sha256-Dfwe3dSScD/6kvkP67notcbb+EgTQ3kEYcH7wpra2dI=";
2023-10-25 11:29:28 +00:00
};
2023-04-26 06:55:12 +00:00
inherit targetFlutterPlatform;
2024-01-18 00:38:10 +00:00
meta = with lib; {
description = "Chat with your friends (matrix client)";
homepage = "https://fluffychat.im/";
license = licenses.agpl3Plus;
2024-01-12 15:05:01 +00:00
mainProgram = "fluffychat";
2024-01-18 00:38:10 +00:00
maintainers = with maintainers; [ mkg20001 gilice ];
platforms = [ "x86_64-linux" "aarch64-linux" ];
sourceProvenance = [ sourceTypes.fromSource ];
};
} // lib.optionalAttrs (targetFlutterPlatform == "linux") {
2024-01-18 00:38:10 +00:00
nativeBuildInputs = [ imagemagick ];
runtimeDependencies = [ pulseaudio ];
extraWrapProgramArgs = "--prefix PATH : ${gnome.zenity}/bin";
env.NIX_LDFLAGS = "-rpath-link ${libwebrtcRpath}";
2022-02-20 18:05:42 +00:00
desktopItem = makeDesktopItem {
name = "Fluffychat";
exec = "fluffychat";
2022-02-20 18:05:42 +00:00
icon = "fluffychat";
desktopName = "Fluffychat";
genericName = "Chat with your friends (matrix client)";
categories = [ "Chat" "Network" "InstantMessaging" ];
2022-02-20 18:05:42 +00:00
};
2022-02-23 14:09:47 +00:00
2023-04-26 06:55:12 +00:00
postInstall = ''
FAV=$out/app/data/flutter_assets/assets/favicon.png
2022-02-20 18:05:42 +00:00
ICO=$out/share/icons
install -D $FAV $ICO/fluffychat.png
mkdir $out/share/applications
cp $desktopItem/share/applications/*.desktop $out/share/applications
for size in 24 32 42 64 128 256 512; do
2022-02-20 18:05:42 +00:00
D=$ICO/hicolor/''${s}x''${s}/apps
mkdir -p $D
convert $FAV -resize ''${size}x''${size} $D/fluffychat.png
2022-02-20 18:05:42 +00:00
done
2023-08-14 06:27:40 +00:00
patchelf --add-rpath ${libwebrtcRpath} $out/app/lib/libwebrtc.so
2022-02-20 18:05:42 +00:00
'';
} // lib.optionalAttrs (targetFlutterPlatform == "web") {
2024-01-18 00:38:10 +00:00
prePatch =
# https://github.com/krille-chan/fluffychat/blob/v1.17.1/scripts/prepare-web.sh
let
# Use Olm 1.3.2, the oldest version, for FluffyChat 1.14.1 which depends on olm_flutter 1.2.0.
2024-01-20 15:45:09 +00:00
olmVersion = pubspecLock.packages.flutter_olm.version;
2024-01-18 00:38:10 +00:00
olmJs = fetchzip {
url = "https://github.com/famedly/olm/releases/download/v${olmVersion}/olm.zip";
stripRoot = false;
hash = "sha256-Vl3Cp2OaYzM5CPOOtTHtUb1W48VXePzOV6FeiIzyD1Y=";
};
in
''
rm -r assets/js/package
cp -r '${olmJs}/javascript' assets/js/package
'';
})