mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
86d9f7ed0d
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2.3 KiB
2.3 KiB
cargo-tauri.hook
Tauri is a framework for building smaller, faster, and more secure desktop applications with a web frontend.
In Nixpkgs, cargo-tauri.hook
overrides the default build and install phases.
Example code snippet
{
lib,
stdenv,
rustPlatform,
fetchNpmDeps,
cargo-tauri,
darwin,
glib-networking,
libsoup,
nodejs,
npmHooks,
openssl,
pkg-config,
webkitgtk_4_0,
wrapGAppsHook3,
}:
rustPlatform.buildRustPackage rec {
# . . .
cargoHash = "...";
# Assuming our app's frontend uses `npm` as a package manager
npmDeps = fetchNpmDeps {
name = "${pname}-npm-deps-${version}";
inherit src;
hash = "...";
};
nativeBuildInputs = [
# Pull in our main hook
cargo-tauri.hook
# Setup npm
nodejs
npmHooks.npmConfigHook
# Make sure we can find our libraries
pkg-config
wrapGAppsHook3
];
buildInputs =
[ openssl ]
++ lib.optionals stdenv.hostPlatform.isLinux [
glib-networking # Most Tauri apps need networking
libsoup
webkitgtk_4_0
]
++ lib.optionals stdenv.hostPlatform.isDarwin (
with darwin.apple_sdk.frameworks;
[
AppKit
CoreServices
Security
WebKit
]
);
# Set our Tauri source directory
cargoRoot = "src-tauri";
# And make sure we build there too
buildAndTestSubdir = cargoRoot;
# . . .
}
Variables controlling cargo-tauri
Tauri Exclusive Variables
tauriBuildFlags
Controls the flags passed to cargo tauri build
.
tauriBundleType
The bundle type to build.
dontTauriBuild
Disables using tauriBuildHook
.
dontTauriInstall
Disables using tauriInstallPostBuildHook
and tauriInstallHook
.
Honored Variables
Along with those found in , the
following variables used by cargoBuildHook
and cargoInstallHook
are honored
by the cargo-tauri setup hook.
buildAndTestSubdir
cargoBuildType
cargoBuildNoDefaultFeatures
cargoBuildFeatures