Unverified Commit abbaa4be authored by seth's avatar seth
Browse files
parent 3400d5e9
Loading
Loading
Loading
Loading
+11659 −0

File added.

Preview size limit exceeded, changes collapsed.

+18 −24
Original line number Diff line number Diff line
@@ -4,48 +4,42 @@
  callPackage,
  rustPlatform,
  fetchFromGitHub,
  darwin,
  gtk3,
  libsoup,
  gtk4,
  nix-update-script,
  openssl,
  pkg-config,
  webkitgtk_4_0,
  webkitgtk_4_1,
}:

rustPlatform.buildRustPackage rec {
  pname = "tauri";
  version = "1.7.1-unstable-2024-08-16";
  version = "2.1.0";

  src = fetchFromGitHub {
    owner = "tauri-apps";
    repo = "tauri";
    rev = "2b61447dfc167ec11724f99671bf9e2de0bf6768";
    hash = "sha256-gKG7olZuTCkW+SKI3FVZqgS6Pp5hFemRJshdma8rpyg=";
    rev = "refs/tags/tauri-v${version}";
    hash = "sha256-n1rSffVef9G9qtLyheuK5k6anAHsZANSu0C73QDdg2o=";
  };

  # 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 = "${src.name}/tooling/cli";

  cargoHash = "sha256-VXg/dAhwPTSrLwJm8HNzAi/sVF9RqgpHIF3PZe1LjSA=";
  cargoLock = {
    lockFile = ./Cargo.lock;
    outputHashes = {
      "schemars_derive-0.8.21" = "sha256-AmxBKZXm2Eb+w8/hLQWTol5f22uP8UqaIh+LVLbS20g=";
    };
  };

  nativeBuildInputs = [ pkg-config ];

  buildInputs =
    [ openssl ]
    ++ lib.optionals stdenv.hostPlatform.isLinux [
      gtk3
      libsoup
      webkitgtk_4_0
    ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin (
      with darwin.apple_sdk.frameworks;
      [
        CoreServices
        Security
        SystemConfiguration
      ]
    );
      gtk4
      webkitgtk_4_1
    ];

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

  passthru = {
    # See ./doc/hooks/tauri.section.md
+39 −22
Original line number Diff line number Diff line
@@ -5,50 +5,67 @@
  cargo-tauri,
  darwin,
  glib-networking,
  libsoup,
  libayatana-appindicator,
  nodejs,
  openssl,
  pkg-config,
  webkitgtk_4_0,
  wrapGAppsHook3,
  pnpm_9,
  webkitgtk_4_1,
  wrapGAppsHook4,
}:

rustPlatform.buildRustPackage rec {
  pname = "test-app";
  inherit (cargo-tauri) version src;

  # Basic example provided by upstream
  sourceRoot = "${src.name}/examples/workspace";
  cargoLock = {
    inherit (cargo-tauri.cargoDeps) lockFile;
    outputHashes = {
      "schemars_derive-0.8.21" = "sha256-AmxBKZXm2Eb+w8/hLQWTol5f22uP8UqaIh+LVLbS20g=";
    };
  };

  cargoPatches = [
    # https://github.com/NixOS/nixpkgs/issues/332957
    ./update-time-crate.patch
  ];
  postPatch = ''
    substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
      --replace "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
  '';

  cargoHash = "sha256-ull9BWzeKsnMi4wcH67FnKFzTjqEdiRlM3f+EKIPvvU=";
  pnpmDeps = pnpm_9.fetchDeps {
    inherit
      pname
      version
      src
      ;

    hash = "sha256-kTr61DFPIIYceB8tZrKFaMG65CZ//djGEOQBLRNPotk=";
  };

  nativeBuildInputs = [
    cargo-tauri.hook

    nodejs
    pkg-config
    wrapGAppsHook3
    pnpm_9.configHook
    wrapGAppsHook4
  ];

  buildInputs =
    [ openssl ]
    ++ lib.optionals stdenv.isLinux [
      glib-networking
      libsoup
      webkitgtk_4_0
      libayatana-appindicator
      webkitgtk_4_1
    ]
    ++ lib.optionals stdenv.isDarwin (
      with darwin.apple_sdk.frameworks;
      [
        AppKit
        CoreServices
        Security
        WebKit
      ]
    );
    ++ lib.optionals stdenv.isDarwin [
      darwin.apple_sdk.frameworks.WebKit
    ];

  buildAndTestSubdir = "examples/api/src-tauri";

  # This example depends on the actual `api` package to be built in-tree
  preBuild = ''
    pnpm --filter '@tauri-apps/api' build
  '';

  # No one should be actually running this, so lets save some time
  buildType = "debug";
+0 −1378

File deleted.

Preview size limit exceeded, changes collapsed.