Unverified Commit 6d48c1b7 authored by Marcel's avatar Marcel
Browse files

flare-signal: 0.16.3 -> 0.17.0

parent 85dbfc7a
Loading
Loading
Loading
Loading
+56 −8
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchFromGitLab,
  runCommand,
  cargo,
  meson,
  ninja,
@@ -14,31 +16,60 @@
  gtksourceview5,
  rustPlatform,
  rustc,
  appstream-glib,
  yq,
  appstream,
  blueprint-compiler,
  desktop-file-utils,
  wrapGAppsHook4,
}:

let
  presage = fetchFromGitHub {
    owner = "whisperfish";
    repo = "presage";
    # match with commit from Cargo.toml
    rev = "123c1f926e359c21b34d099279ee8a92462ce96d";
    hash = "sha256-qKpPbK5ToFnWucujDlV8qxeT+XrRGYYnm7jp8UOXgZ0=";
  };
in

stdenv.mkDerivation (finalAttrs: {
  pname = "flare";
  version = "0.16.3";
  # NOTE: also update presage commit
  version = "0.17.0";

  src = fetchFromGitLab {
    domain = "gitlab.com";
    owner = "schmiddi-on-mobile";
    repo = "flare";
    tag = finalAttrs.version;
    hash = "sha256-uUEeARhKhI6SvzZHLAvDgBjOxw82Yp88c6U0cHeRKoc=";
    hash = "sha256-Zdzs9ZLvrI5rGhC1K0SLPsv/xMtJEu5vFRnH3+z/keA=";
  };

  cargoDeps =
    let
      cargoDeps = rustPlatform.fetchCargoVendor {
        inherit (finalAttrs) pname version src;
    hash = "sha256-bQiQrl+yqKDGFXN7VfS7VEWKAcT1LtoRZjWq/BwHgKw=";
        hash = "sha256-XBUpFQy68qwrKgsKi5TeoakalNLTqolv6z5YfyiaEZI=";
      };
    in
    # Replace with simpler solution:
    # https://github.com/NixOS/nixpkgs/pull/432651#discussion_r2312796706
    # depending on sqlx release and update in flare-signal
    runCommand "${finalAttrs.pname}-${finalAttrs.version}-vendor-patched" { inherit cargoDeps; }
      # https://github.com/flathub/de.schmidhuberj.Flare/commit/b1352087beaf299569c798bc69e31660712853db
      # bash
      ''
        mkdir $out
        find $cargoDeps -maxdepth 1 -exec sh -c "ln -s {} $out/\$(basename {})" \;
        rm $out/presage-store-sqlite-*
        cp -r $cargoDeps/presage-store-sqlite-* $out
        chmod +w $out/presage-store-sqlite-*
        ln -s ${presage}/.sqlx $out/presage-store-sqlite-*
      '';

  nativeBuildInputs = [
    appstream-glib # for appstream-util
    appstream # for appstream-util
    blueprint-compiler
    desktop-file-utils # for update-desktop-database
    meson
@@ -48,8 +79,25 @@ stdenv.mkDerivation (finalAttrs: {
    rustPlatform.cargoSetupHook
    cargo
    rustc
    # yq contains tomlq
    yq
  ];

  postPatch = ''
    cargoPresageRev="$(tomlq -r '.dependencies.presage.rev' Cargo.toml)"
    actualPresageRev="${presage.rev}"
    if [ "$cargoPresageRev" != "$actualPresageRev" ]; then
      echo ""
      echo "fetchFromGitHub presage revision does not match revision specified in Cargo.toml"
      echo "consider replacing fetchFromGitHub's revision with revision specified in Cargo.toml"
      echo ""
      echo "  fetchFromGitHub = ''${actualPresageRev}"
      echo "  Cargo.toml = ''${cargoPresageRev}"
      echo ""
      exit 1
    fi
  '';

  buildInputs = [
    gtksourceview5
    libadwaita