push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,136 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchzip,
imagemagick,
libgbm,
libdrm,
flutter332,
pulseaudio,
copyDesktopItems,
makeDesktopItem,
callPackage,
vodozemac-wasm ? callPackage ./vodozemac-wasm.nix { flutter = flutter332; },
targetFlutterPlatform ? "linux",
}:
let
libwebrtcRpath = lib.makeLibraryPath [
libgbm
libdrm
];
pubspecLock = lib.importJSON ./pubspec.lock.json;
libwebrtc = fetchzip {
url = "https://github.com/flutter-webrtc/flutter-webrtc/releases/download/v1.1.0/libwebrtc.zip";
sha256 = "sha256-lRfymTSfoNUtR5tSUiAptAvrrTwbB8p+SaYQeOevMzA=";
};
in
flutter332.buildFlutterApplication (
rec {
pname = "fluffychat-${targetFlutterPlatform}";
version = "2.1.1";
src = fetchFromGitHub {
owner = "krille-chan";
repo = "fluffychat";
tag = "v${version}";
hash = "sha256-Gk3PtIb90rmrEIq52aL+vBHhRG6LoyfG2jrAGH5Iyqo=";
};
inherit pubspecLock;
gitHashes = {
flutter_web_auth_2 = "sha256-3aci73SP8eXg6++IQTQoyS+erUUuSiuXymvR32sxHFw=";
flutter_typeahead = "sha256-ZGXbbEeSddrdZOHcXE47h3Yu3w6oV7q+ZnO6GyW7Zg8=";
flutter_secure_storage_linux = "sha256-cFNHW7dAaX8BV7arwbn68GgkkBeiAgPfhMOAFSJWlyY=";
};
inherit targetFlutterPlatform;
meta = {
description = "Chat with your friends (matrix client)";
homepage = "https://fluffychat.im/";
license = lib.licenses.agpl3Plus;
maintainers = with lib.maintainers; [
mkg20001
tebriel
aleksana
];
badPlatforms = lib.platforms.darwin;
}
// lib.optionalAttrs (targetFlutterPlatform == "linux") {
mainProgram = "fluffychat";
};
}
// lib.optionalAttrs (targetFlutterPlatform == "linux") {
nativeBuildInputs = [
imagemagick
copyDesktopItems
];
runtimeDependencies = [ pulseaudio ];
env.NIX_LDFLAGS = "-rpath-link ${libwebrtcRpath}";
desktopItems = [
(makeDesktopItem {
name = "Fluffychat";
exec = "fluffychat";
icon = "fluffychat";
desktopName = "Fluffychat";
genericName = "Chat with your friends (matrix client)";
categories = [
"Chat"
"Network"
"InstantMessaging"
];
})
];
customSourceBuilders = {
flutter_webrtc =
{ version, src, ... }:
stdenv.mkDerivation {
pname = "flutter_webrtc";
inherit version src;
inherit (src) passthru;
postPatch = ''
substituteInPlace third_party/CMakeLists.txt \
--replace-fail "\''${CMAKE_CURRENT_LIST_DIR}/downloads/libwebrtc.zip" ${libwebrtc}
ln -s ${libwebrtc} third_party/libwebrtc
'';
installPhase = ''
runHook preInstall
mkdir $out
cp -r ./* $out/
runHook postInstall
'';
};
};
postInstall = ''
FAV=$out/app/fluffychat-linux/data/flutter_assets/assets/favicon.png
ICO=$out/share/icons
for size in 24 32 42 64 128 256 512; do
D=$ICO/hicolor/''${size}x''${size}/apps
mkdir -p $D
magick $FAV -resize ''${size}x''${size} $D/fluffychat.png
done
patchelf --add-rpath ${libwebrtcRpath} $out/app/fluffychat-linux/lib/libwebrtc.so
'';
}
// lib.optionalAttrs (targetFlutterPlatform == "web") {
preBuild = ''
cp -r ${vodozemac-wasm}/* ./assets/vodozemac/
'';
}
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,123 @@
{
lib,
stdenv,
fluffychat-web,
symlinkJoin,
buildPackages,
rustc,
rustPlatform,
cargo,
flutter,
flutter_rust_bridge_codegen,
which,
wasm-pack,
wasm-bindgen-cli_0_2_100,
binaryen,
writableTmpDirAsHomeHook,
runCommand,
}:
let
pubSources = fluffychat-web.pubspecLock.dependencySources;
# wasm-pack doesn't take 'RUST_SRC_PATH' into consideration
rustcWithLibSrc = buildPackages.rustc.override {
sysroot = symlinkJoin {
name = "rustc_unwrapped_with_libsrc";
paths = [
buildPackages.rustc.unwrapped
];
postBuild = ''
mkdir -p $out/lib/rustlib/src/rust
ln -s ${rustPlatform.rustLibSrc} $out/lib/rustlib/src/rust/library
'';
};
};
in
# https://github.com/krille-chan/fluffychat/blob/main/scripts/prepare-web.sh
stdenv.mkDerivation {
pname = "vodozemac-wasm";
inherit (pubSources.vodozemac) version;
# These two were in the same repository, so just reuse them
unpackPhase = ''
runHook preUnpack
cp -r ${pubSources.flutter_vodozemac}/rust ./rust
cp -r ${pubSources.vodozemac} ./dart
chmod -R +rwx .
runHook postUnpack
'';
# Remove dev_dependencies to avoid downloading them
postPatch = ''
sed -i '/^dev_dependencies:/,/^$/d' dart/pubspec.yaml
'';
cargoRoot = "rust";
cargoDeps = symlinkJoin {
name = "vodozemac-wasm-cargodeps";
paths = [
pubSources.flutter_vodozemac.passthru.cargoDeps
# Pull in rust vendor so we don't have to vendor rustLibSrc again
# This is required because `-Z build-std=std,panic_abort` rebuilds std
rustPlatform.rustVendorSrc
];
};
nativeBuildInputs = [
rustPlatform.cargoSetupHook
rustcWithLibSrc
rustc.llvmPackages.lld
cargo
flutter
flutter_rust_bridge_codegen
which
wasm-pack
wasm-bindgen-cli_0_2_100
binaryen
writableTmpDirAsHomeHook
];
buildPhase = ''
runHook preBuild
pushd dart
dart pub get --offline
popd
RUST_LOG=info flutter_rust_bridge_codegen build-web \
--dart-root $(realpath ./dart) --rust-root $(realpath ./rust) --release
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r dart/web/pkg/vodozemac_bindings_dart* $out/
runHook postInstall
'';
env = {
# Build a pub cache from fluffychat, as dart-vodozemac should be a subset
# This is required because dart-vodozemac, as a pub, doesn't have a pubspec.lock
# But flutter_rust_bridge_codegen still requires all dependencies of it
PUB_CACHE = runCommand "fluffychat-pub-cache" { } ''
mkdir -p $out/hosted/pub.dev
pushd $out/hosted/pub.dev
${lib.concatMapAttrsStringSep "; " (
_: p:
"ln -s ${p} ./${if lib.hasPrefix "pub-" p.name then lib.removePrefix "pub-" p.name else p.name}"
) pubSources}
popd
'';
RUSTC_BOOTSTRAP = 1; # `-Z build-std=std,panic_abort` requires nightly toolchain
};
inherit (fluffychat-web) meta;
}