about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/fluffychat
diff options
context:
space:
mode:
authorgilice <104317939+gilice@users.noreply.github.com>2023-03-25 20:15:45 +0100
committergilice <104317939+gilice@users.noreply.github.com>2023-03-31 16:28:33 +0200
commit01b3e4487a565e6c39f6351099469e71603368c1 (patch)
tree0c428a598c9af8d3259cdc2670311a32a4668b2e /pkgs/applications/networking/instant-messengers/fluffychat
parent91793861d5d50160d578277ab2acb417cdf9081d (diff)
fluffychat: 1.2.0 -> 1.2.10, build from binary
I understand that this may be a controversial change.
Here is my reasoning:
 - Fluffychat in nixpkgs has been broken since August
   because of reproducibility issues
 - Flutter in general has very bad nondeterminism going on with hashes,
   see https://github.com/NixOS/nixpkgs/issues/211606
 - End users are most likely to care about the programs working. It wasn't working earlier.
   Source builds at least won't break randomly.

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'pkgs/applications/networking/instant-messengers/fluffychat')
-rw-r--r--pkgs/applications/networking/instant-messengers/fluffychat/default.nix78
1 files changed, 35 insertions, 43 deletions
diff --git a/pkgs/applications/networking/instant-messengers/fluffychat/default.nix b/pkgs/applications/networking/instant-messengers/fluffychat/default.nix
index 22bbeb212f0eb..e9b02b9cd385c 100644
--- a/pkgs/applications/networking/instant-messengers/fluffychat/default.nix
+++ b/pkgs/applications/networking/instant-messengers/fluffychat/default.nix
@@ -1,22 +1,31 @@
 { lib
-, fetchFromGitLab
-, flutter2
-, olm
+, stdenv
+, fetchzip
 , imagemagick
+, autoPatchelfHook
+, gtk3
+, libsecret
+, jsoncpp
+, wrapGAppsHook
 , makeDesktopItem
 }:
 
-flutter2.mkFlutterApp rec {
-  pname = "fluffychat";
-  version = "1.2.0";
-
-  vendorHash = "sha256-1PDX023WXRmRe/b1L+6Du91BvGwYNp3YATqYSQdPrRY=";
+let
+  version = "1.10.0";
+  # map of nix platform -> expected url platform
+  platformMap = {
+    x86_64-linux = "linux-x86";
+    aarch64-linux = "linux-arm64";
+  };
+in
+stdenv.mkDerivation {
+  inherit version;
+  name = "fluffychat";
 
-  src = fetchFromGitLab {
-    owner = "famedly";
-    repo = "fluffychat";
-    rev = "v${version}";
-    hash = "sha256-PJH3jMQc6u9R6Snn+9rNN8t+8kt6l3Xt7zKPbpqj13E=";
+  src = fetchzip {
+    url = "https://gitlab.com/api/v4/projects/16112282/packages/generic/fluffychat/${version}/fluffychat-${platformMap.${stdenv.hostPlatform.system}}.tar.gz";
+    stripRoot = false;
+    sha256 = "sha256-SbzTEMeJRFEUN0nZF9hL0UEzTWl1VtHVPIx/AGgQvM8=";
   };
 
   desktopItem = makeDesktopItem {
@@ -28,45 +37,27 @@ flutter2.mkFlutterApp rec {
     categories = [ "Chat" "Network" "InstantMessaging" ];
   };
 
-  buildInputs = [
-    olm
-  ];
-
-  nativeBuildInputs = [
-    imagemagick
-  ];
-
-  flutterExtraFetchCommands = ''
-    M=$(echo $TMP/.pub-cache/hosted/pub.dartlang.org/matrix-*)
-    sed -i $M/scripts/prepare.sh \
-      -e "s|/usr/lib/x86_64-linux-gnu/libolm.so.3|/bin/sh|g"  \
-      -e "s|if which flutter >/dev/null; then|exit; if which flutter >/dev/null; then|g"
+  buildInputs = [ gtk3 libsecret jsoncpp ];
+  nativeBuildInputs = [ autoPatchelfHook wrapGAppsHook imagemagick ];
 
-    pushd $M
-    bash scripts/prepare.sh
-    popd
-  '';
+  installPhase = ''
+    mkdir -p $out/bin
+    mkdir -p $out/share
+    mv * $out/share
 
-  # replace olm dummy path
-  postConfigure = ''
-    M=$(echo $depsFolder/.pub-cache/hosted/pub.dartlang.org/matrix-*)
-    ln -sf ${olm}/lib/libolm.so.3 $M/ffi/olm/libolm.so
-  '';
+    ln -s $out/share/fluffychat $out/bin/fluffychat
 
-  postInstall = ''
-    FAV=$out/app/data/flutter_assets/assets/favicon.png
+    FAV=$out/share/data/flutter_assets/assets/favicon.png
     ICO=$out/share/icons
 
     install -D $FAV $ICO/fluffychat.png
     mkdir $out/share/applications
     cp $desktopItem/share/applications/*.desktop $out/share/applications
-
-    for s in 24 32 42 64 128 256 512; do
+    for size in 24 32 42 64 128 256 512; do
       D=$ICO/hicolor/''${s}x''${s}/apps
       mkdir -p $D
-      convert $FAV -resize ''${s}x''${s} $D/fluffychat.png
+      convert $FAV -resize ''${size}x''${size} $D/fluffychat.png
     done
-
     substituteInPlace $out/share/applications/*.desktop \
       --subst-var out
   '';
@@ -75,7 +66,8 @@ flutter2.mkFlutterApp rec {
     description = "Chat with your friends (matrix client)";
     homepage = "https://fluffychat.im/";
     license = licenses.agpl3Plus;
-    maintainers = with maintainers; [ mkg20001 ];
-    platforms = platforms.linux;
+    maintainers = with maintainers; [ mkg20001 gilice ];
+    platforms = [ "x86_64-linux" "aarch64-linux" ];
+    sourceProvenance = [ sourceTypes.binaryNativeCode ];
   };
 }