Merge pull request #160942 from mkg20001/flutter-fixup

This commit is contained in:
Maciej Krüger 2022-02-23 16:16:48 +01:00 committed by GitHub
commit f724c46b95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 105 additions and 8 deletions

View File

@ -2,13 +2,15 @@
, fetchFromGitLab
, flutter
, olm
, imagemagick
, makeDesktopItem
}:
flutter.mkFlutterApp rec {
pname = "fluffychat";
version = "1.2.0";
vendorHash = "sha256-Qg0IlajbIl8e3BkKgn4O+mbZGvhfqr7XwllBLJQAA/I=";
vendorHash = "sha256-j5opwEFifa+DMG7Uziv4SWEPVokD6OSq8mSIr0AdDL0=";
src = fetchFromGitLab {
owner = "famedly";
@ -17,10 +19,58 @@ flutter.mkFlutterApp rec {
hash = "sha256-PJH3jMQc6u9R6Snn+9rNN8t+8kt6l3Xt7zKPbpqj13E=";
};
desktopItem = makeDesktopItem {
name = "Fluffychat";
exec = "@out@/bin/fluffychat";
icon = "fluffychat";
desktopName = "Fluffychat";
genericName = "Chat with your friends (matrix client)";
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"
pushd $M
bash scripts/prepare.sh
popd
'';
# replace olm dummy path
postConfigure = ''
M=$(echo $TMP/.pub-cache/hosted/pub.dartlang.org/matrix-*)
ln -sf ${olm}/lib/libolm.so.3 $M/ffi/olm/libolm.so
'';
postInstall = ''
FAV=$out/app/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
D=$ICO/hicolor/''${s}x''${s}/apps
mkdir -p $D
convert $FAV -resize ''${s}x''${s} $D/fluffychat.png
done
substituteInPlace $out/share/applications/*.desktop \
--subst-var out
'';
meta = with lib; {
description = "Chat with your friends (matrix client)";
homepage = "https://fluffychat.im/";

View File

@ -63,6 +63,9 @@ let
nukeReferences
];
# avoid pub phase
dontBuild = true;
installPhase = ''
. ${../fetchgit/deterministic-git}
@ -76,6 +79,7 @@ let
flutter config --enable-linux-desktop
flutter packages get
flutter build linux || true # so it downloads tools
${lib.optionalString (args ? flutterExtraFetchCommands) args.flutterExtraFetchCommands}
RES="$TMP"
@ -127,6 +131,7 @@ let
'';
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
"GIT_PROXY_COMMAND" "NIX_GIT_SSL_CAINFO" "SOCKS_SERVER"
@ -207,6 +212,7 @@ let
# ensure we're using a lockfile for the right package version
if [ -e pubspec.lock ]; then
# FIXME: currently this is broken. in theory this should not break, but flutter has it's own way of doing things.
# diff -u pubspec.lock $depsFolder/pubspec.lock
true
else
@ -248,9 +254,10 @@ let
mkdir -p $out/bin
mv $built $out/app
for f in $built/data/flutter_assets/assets/*.desktop; do
for f in $(find $out/app -iname "*.desktop" -type f); do
install -D $f $out/share/applications/$(basename $f)
done
for f in $(find $out/app -maxdepth 1 -type f); do
ln -s $f $out/bin/$(basename $f)
done

View File

@ -4,20 +4,20 @@ let
getPatches = dir:
let files = builtins.attrNames (builtins.readDir dir);
in map (f: dir + ("/" + f)) files;
version = "2.10.0";
version = "2.10.1";
channel = "stable";
filename = "flutter_linux_${version}-${channel}.tar.xz";
# Decouples flutter derivation from dart derivation,
# use specific dart version to not need to bump dart derivation when bumping flutter.
dartVersion = "2.16.0";
dartVersion = "2.16.1";
dartSourceBase = "https://storage.googleapis.com/dart-archive/channels";
dartForFlutter = dart.override {
version = dartVersion;
sources = {
"${dartVersion}-x86_64-linux" = fetchurl {
url = "${dartSourceBase}/stable/release/${dartVersion}/sdk/dartsdk-linux-x64-release.zip";
sha256 = "sha256-n+hr3iMt5S0iEeR/X9zBQ86TbjCajaG0RyE+Ij1/aNM=";
sha256 = "sha256-PMY6DCFQC8XrlnFzOEPcwgBAs5/cAvNd78969Z+I1Fk=";
};
};
};
@ -29,7 +29,7 @@ in {
pname = "flutter";
src = fetchurl {
url = "https://storage.googleapis.com/flutter_infra_release/releases/${channel}/linux/${filename}";
sha256 = "sha256-4ZEpZPGVnisnK9QT1o4G2G6CiflYElh+e3+X8odnx1U=";
sha256 = "sha256-rSfwcglDV2rvJl10j7FByAWmghd2FYxrlkgYnvRO54Y=";
};
patches = getPatches ./patches;
};

View File

@ -0,0 +1,36 @@
{ lib
, stdenv
, fetchurl
, runCommand
, fetchCrate
, rustPlatform
, Security
, openssl
, pkg-config
, SystemConfiguration
, libiconv
}:
rustPlatform.buildRustPackage rec {
pname = "duckscript_cli";
version = "0.8.10";
src = fetchCrate {
inherit pname version;
sha256 = "sha256-cMvcCX8ViCcUFMuxAPo3/wxXvg5swAcBrLx1x7lSwvM=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ]
++ lib.optionals stdenv.isDarwin [ Security SystemConfiguration libiconv ];
cargoSha256 = "sha256-8ywMLXFmdq119K/hl1hpsVhzG+nrdO4eux3lAqUjB+A=";
meta = with lib; {
description = "Simple, extendable and embeddable scripting language.";
homepage = "https://github.com/sagiegurari/duckscript";
license = licenses.asl20;
maintainers = with maintainers; [ mkg20001 ];
};
}

View File

@ -7,7 +7,7 @@ flutter.mkFlutterApp {
pname = "firmware-updater";
version = "unstable";
vendorHash = "sha256-QgeRCFbd3AcFekJunFTwu2nDOQpAOMJUxZhgY4stJJc=";
vendorHash = "sha256-L8am4vTx4KlMHUdIhrUsCxGc27vkolawS/9DyFCPOJQ=";
src = fetchFromGitHub {
owner = "canonical";
@ -20,7 +20,7 @@ flutter.mkFlutterApp {
meta = with lib; {
description = "Firmware Updater for Linux";
homepage = "https://github.com/canonical/firmware-updater";
license = licenses.free;
license = licenses.gpl3Only;
maintainers = with maintainers; [ mkg20001 ];
platforms = platforms.linux;
};

View File

@ -13606,6 +13606,10 @@ with pkgs;
duktape = callPackage ../development/interpreters/duktape { };
duckscript = callPackage ../development/tools/rust/duckscript {
inherit (darwin.apple_sdk.frameworks) Security SystemConfiguration;
};
evcxr = callPackage ../development/interpreters/evcxr {
inherit (darwin.apple_sdk.frameworks) CoreServices Security;
};