Unverified Commit f4366b49 authored by Seth Flynn's avatar Seth Flynn Committed by GitHub
Browse files

cargo-tauri*: cleanup dependencies; cargo-tauri_1: 1.8.1 -> 1.6.6 (#435717)

parents c58ada2e e3a9a74a
Loading
Loading
Loading
Loading
+28 −18
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  bzip2,
  callPackage,
  rustPlatform,
  fetchFromGitHub,
  gtk4,
  nix-update-script,
  openssl,
  pkg-config,
  webkitgtk_4_1,
  testers,
  xz,
  zstd,
}:

rustPlatform.buildRustPackage rec {
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "tauri";
  version = "2.7.1";

  src = fetchFromGitHub {
    owner = "tauri-apps";
    repo = "tauri";
    tag = "tauri-cli-v${version}";
    tag = "tauri-cli-v${finalAttrs.version}";
    hash = "sha256-0J55AvAvvqTVls4474GcgLPBtSC+rh8cXVKluMjAVBE=";
  };

  cargoHash = "sha256-nkY1ydc2VewRwY+B5nR68mz8Ff3FK1KoHE4dLzNtPkY=";

  nativeBuildInputs = [ pkg-config ];
  nativeBuildInputs = lib.optionals (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isLinux) [
    pkg-config
  ];

  buildInputs = [
    openssl
  buildInputs =
    # Required for tauri-macos-sign and RPM support in tauri-bundler
    lib.optionals (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isLinux) [
      bzip2
      xz
    ]
    ++ lib.optionals stdenv.hostPlatform.isLinux [
    gtk4
    webkitgtk_4_1
      zstd
    ];

  cargoBuildFlags = [ "--package tauri-cli" ];
  cargoTestFlags = cargoBuildFlags;
  cargoTestFlags = finalAttrs.cargoBuildFlags;

  env = lib.optionalAttrs stdenv.hostPlatform.isLinux {
    ZSTD_SYS_USE_PKG_CONFIG = true;
  };

  passthru = {
    # See ./doc/hooks/tauri.section.md
    hook = callPackage ./hook.nix { };
    hook = callPackage ./hook.nix { cargo-tauri = finalAttrs.finalPackage; };

    tests = {
      hook = callPackage ./test-app.nix { };
      hook = callPackage ./test-app.nix { cargo-tauri = finalAttrs.finalPackage; };
      version = testers.testVersion { package = finalAttrs.finalPackage; };
    };

    updateScript = nix-update-script {
@@ -56,7 +66,7 @@ rustPlatform.buildRustPackage rec {
  meta = {
    description = "Build smaller, faster, and more secure desktop applications with a web frontend";
    homepage = "https://tauri.app/";
    changelog = "https://github.com/tauri-apps/tauri/releases/tag/${src.tag}";
    changelog = "https://github.com/tauri-apps/tauri/releases/tag/tauri-cli-v${finalAttrs.version}";
    license = with lib.licenses; [
      asl20 # or
      mit
@@ -68,4 +78,4 @@ rustPlatform.buildRustPackage rec {
    ];
    mainProgram = "cargo-tauri";
  };
}
})
+25 −24
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  bzip2,
  pkg-config,
  rustPlatform,
  fetchFromGitHub,
  xz,
  zstd,
  cargo-tauri,
  cargo-tauri_1,
  gtk3,
  libsoup_2_4,
  openssl,
  webkitgtk_4_0,
}:

cargo-tauri.overrideAttrs (
  newAttrs: oldAttrs: {
    version = "1.8.1";

    src = fetchFromGitHub {
      owner = "tauri-apps";
      repo = "tauri";
      rev = "tauri-v${newAttrs.version}";
      hash = "sha256-z8dfiLghN6m95PLCMDgpBMNo+YEvvsGN9F101fAcVF4=";
  finalAttrs: oldAttrs: {
    version = "1.6.6";

    src = oldAttrs.src.override {
      hash = "sha256-UE/mJ0WdbVT4E1YuUCtu80UB+1WR+KRWs+4Emy3Nclc=";
    };

    # Manually specify the sourceRoot since this crate depends on other crates in the workspace. Relevant info at
    # https://discourse.nixos.org/t/difficulty-using-buildrustpackage-with-a-src-containing-multiple-cargo-workspaces/10202
    sourceRoot = "${newAttrs.src.name}/tooling/cli";
    sourceRoot = "${finalAttrs.src.name}/tooling/cli";

    cargoDeps = rustPlatform.fetchCargoVendor {
      inherit (newAttrs)
      inherit (finalAttrs)
        pname
        version
        src
        sourceRoot
        ;
      hash = "sha256-t5sR02qC06H7A2vukwyZYKA2XMVUzJrgIOYuNSf42mE=";
      hash = "sha256-kAaq6Kam3e5n8569Y4zdFEiClI8q97XFX1hBD7NkUqw=";
    };

    nativeBuildInputs = oldAttrs.nativeBuildInputs or [ ] ++ [ pkg-config ];

    buildInputs = [
      openssl
      # Required by `zip` in `tauri-bundler`
      bzip2
      zstd
    ]
    ++ lib.optionals stdenv.hostPlatform.isLinux [
      gtk3
      libsoup_2_4
      webkitgtk_4_0
    ];
    # Required by `rpm` in `tauri-bundler`
    ++ lib.optionals stdenv.hostPlatform.isLinux [ xz ];

    env = {
      ZSTD_SYS_USE_PKG_CONFIG = true;
    };

    passthru = {
      hook = cargo-tauri.hook.override { cargo-tauri = cargo-tauri_1; };
      inherit (oldAttrs.passthru) hook;
      tests = { inherit (oldAttrs.passthru.tests) version; };
    };

    meta = {