summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2024-10-01 00:18:21 +0000
committerGitHub <noreply@github.com>2024-10-01 00:18:21 +0000
commit3c833cfcd12780ede91248757e0b4ab758d80a37 (patch)
tree0a533785811b1670b7dbd5ba4d65578923010c65 /doc
parentMerge master into haskell-updates (diff)
parentcargo-tauri.hook: init (#335751) (diff)
downloadnixpkgs-3c833cfcd12780ede91248757e0b4ab758d80a37.tar.gz
Merge master into haskell-updates
Diffstat (limited to 'doc')
-rw-r--r--doc/hooks/index.md1
-rw-r--r--doc/hooks/tauri.section.md108
2 files changed, 109 insertions, 0 deletions
diff --git a/doc/hooks/index.md b/doc/hooks/index.md
index 0d6fcd27f276..e96deb81bd4e 100644
--- a/doc/hooks/index.md
+++ b/doc/hooks/index.md
@@ -30,6 +30,7 @@ postgresql-test-hook.section.md
premake.section.md
python.section.md
scons.section.md
+tauri.section.md
tetex-tex-live.section.md
unzip.section.md
validatePkgConfig.section.md
diff --git a/doc/hooks/tauri.section.md b/doc/hooks/tauri.section.md
new file mode 100644
index 000000000000..1f468950580a
--- /dev/null
+++ b/doc/hooks/tauri.section.md
@@ -0,0 +1,108 @@
+# cargo-tauri.hook {#tauri-hook}
+
+[Tauri](https://tauri.app/) 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 {#tauri-hook-example-code-snippet}
+
+```nix
+{
+ lib,
+ stdenv,
+ rustPlatform,
+ fetchNpmDeps,
+ cargo-tauri,
+ darwin,
+ glib-networking,
+ libsoup,
+ nodejs,
+ npmHooks,
+ openssl,
+ pkg-config,
+ webkitgtk,
+ 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.isLinux [
+ glib-networking # Most Tauri apps need networking
+ libsoup
+ webkitgtk
+ ]
+ ++ lib.optionals stdenv.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-hook-variables-controlling}
+
+### Tauri Exclusive Variables {#tauri-hook-exclusive-variables}
+
+#### `tauriBuildFlags` {#tauri-build-flags}
+
+Controls the flags passed to `cargo tauri build`.
+
+#### `tauriBundleType` {#tauri-bundle-type}
+
+The [bundle type](https://tauri.app/v1/guides/building/) to build.
+
+#### `dontTauriBuild` {#dont-tauri-build}
+
+Disables using `tauriBuildHook`.
+
+#### `dontTauriInstall` {#dont-tauri-install}
+
+Disables using `tauriInstallPostBuildHook` and `tauriInstallHook`.
+
+### Honored Variables {#tauri-hook-honored-variables}
+
+Along with those found in [](#compiling-rust-applications-with-cargo), the
+following variables used by `cargoBuildHook` and `cargoInstallHook` are honored
+by the cargo-tauri setup hook.
+
+- `buildAndTestSubdir`
+- `cargoBuildType`
+- `cargoBuildNoDefaultFeatures`
+- `cargoBuildFeatures`