1 # cargo-tauri.hook {#tauri-hook}
3 [Tauri](https://tauri.app/) is a framework for building smaller, faster, and
4 more secure desktop applications with a web frontend.
6 In Nixpkgs, `cargo-tauri.hook` overrides the default build and install phases.
8 ## Example code snippet {#tauri-hook-example-code-snippet}
28 rustPlatform.buildRustPackage rec {
33 # Assuming our app's frontend uses `npm` as a package manager
34 npmDeps = fetchNpmDeps {
35 name = "${pname}-npm-deps-${version}";
41 # Pull in our main hook
46 npmHooks.npmConfigHook
48 # Make sure we can find our libraries
55 ++ lib.optionals stdenv.hostPlatform.isLinux [
56 glib-networking # Most Tauri apps need networking
60 ++ lib.optionals stdenv.hostPlatform.isDarwin (
61 with darwin.apple_sdk.frameworks;
70 # Set our Tauri source directory
71 cargoRoot = "src-tauri";
72 # And make sure we build there too
73 buildAndTestSubdir = cargoRoot;
79 ## Variables controlling cargo-tauri {#tauri-hook-variables-controlling}
81 ### Tauri Exclusive Variables {#tauri-hook-exclusive-variables}
83 #### `tauriBuildFlags` {#tauri-build-flags}
85 Controls the flags passed to `cargo tauri build`.
87 #### `tauriBundleType` {#tauri-bundle-type}
89 The [bundle type](https://tauri.app/v1/guides/building/) to build.
91 #### `dontTauriBuild` {#dont-tauri-build}
93 Disables using `tauriBuildHook`.
95 #### `dontTauriInstall` {#dont-tauri-install}
97 Disables using `tauriInstallPostBuildHook` and `tauriInstallHook`.
99 ### Honored Variables {#tauri-hook-honored-variables}
101 Along with those found in [](#compiling-rust-applications-with-cargo), the
102 following variables used by `cargoBuildHook` and `cargoInstallHook` are honored
103 by the cargo-tauri setup hook.
105 - `buildAndTestSubdir`
107 - `cargoBuildNoDefaultFeatures`
108 - `cargoBuildFeatures`