Skip to content

Commit 8b9152a

Browse files
committed
feat: nix documentation
Moved nix to it's own section in system deps Updated rust & nodejs for nix Init android documentation for nix Init ios documentation for nix
1 parent cbdb5f8 commit 8b9152a

File tree

1 file changed

+69
-72
lines changed

1 file changed

+69
-72
lines changed

src/content/docs/start/prerequisites.mdx

Lines changed: 69 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ Tauri requires various system dependencies for development on Linux. These may b
2828
{/* Note: These are the officially supported linux distributions. */}
2929
{/* If you wish to add another please open an issue to discuss prior to opening a PR */}
3030

31+
:::note
32+
Using nix/nixos? we have moved nix/nixos to a dedicated section [here](#nixnixos)
33+
:::
34+
3135
<Tabs>
3236
<TabItem label="Debian">
3337

@@ -117,35 +121,7 @@ sudo apk add \
117121
librsvg
118122
```
119123
</TabItem>
120-
<TabItem label="NixOS">
121-
122-
Using `nix-shell`:
123124

124-
```sh
125-
with import <nixpkgs> { };
126-
mkShell {
127-
buildInputs = [
128-
at-spi2-atk
129-
atkmm
130-
cairo
131-
gdk-pixbuf
132-
glib
133-
gobject-introspection
134-
gobject-introspection.dev
135-
gtk3
136-
harfbuzz
137-
librsvg
138-
libsoup_3
139-
pango
140-
webkitgtk_4_1
141-
webkitgtk_4_1.dev
142-
];
143-
144-
PKG_CONFIG_PATH = "${glib.dev}/lib/pkgconfig:${libsoup_3.dev}/lib/pkgconfig:${webkitgtk_4_1.dev}/lib/pkgconfig:${at-spi2-atk.dev}/lib/pkgconfig:${gtk3.dev}/lib/pkgconfig:${gdk-pixbuf.dev}/lib/pkgconfig:${cairo.dev}/lib/pkgconfig:${pango.dev}/lib/pkgconfig:${harfbuzz.dev}/lib/pkgconfig";
145-
}
146-
```
147-
148-
</TabItem>
149125
</Tabs>
150126

151127
If your distribution isn't included above then you may want to check [Awesome Tauri on GitHub](https://github.com/tauri-apps/awesome-tauri#guides) to see if a guide has been created.
@@ -154,11 +130,11 @@ Next: [Install Rust](#rust)
154130

155131
### macOS
156132

157-
Tauri requires various system dependencies for development on MacOS. This may depend on the type of package manager you use or don't have a package manager at all.
133+
:::note
134+
Using Nix? we have a dedicated section on getting started on nix [here](#nixnixos)
135+
:::
158136

159-
<Tabs>
160-
<TabItem label="MacOS">
161-
Tauri uses [Xcode](https://developer.apple.com/xcode/resources/) and various macOS and iOS development dependencies.
137+
Tauri uses [Xcode](https://developer.apple.com/xcode/resources/) and various macOS and iOS development dependencies.
162138

163139
Download and install Xcode from one of the following places:
164140

@@ -176,29 +152,8 @@ xcode-select --install
176152
```
177153

178154
</details>
179-
180-
</TabItem>
181-
<TabItem label="Nix">
182-
183-
Tauri uses [Xcode](https://developer.apple.com/xcode/resources/) and various macOS and iOS development dependencies.
184-
185-
The required dependencies can be installed by adding the following packages to your shell.
186-
```nix
187-
darwin.apple_sdk.frameworks.WebKit
188-
darwin.apple_sdk.frameworks.AppKit
189-
darwin.apple_sdk.frameworks.CoreServices
190-
darwin.apple_sdk.frameworks.Foundation
191-
darwin.apple_sdk.frameworks.Security
192-
```
193-
194-
You have installed all of the required xcode dependencies.
195-
196-
</TabItem>
197-
198155
Next: [Install Rust](#rust)
199156

200-
</Tabs>
201-
202157
### Windows
203158

204159
Tauri uses the Microsoft C++ Build Tools for development as well as Microsoft Edge WebView2. These are both required for development on Windows.
@@ -226,6 +181,43 @@ Install WebView2 by visiting the [WebView2 Runtime download section](https://dev
226181

227182
Next: [Install Rust](#rust)
228183

184+
185+
186+
### Nix/NixOS
187+
188+
Using `nix-shell`:
189+
190+
```sh
191+
with import <nixpkgs> { };
192+
mkShell {
193+
buildInputs = [
194+
libiconv
195+
] ++ lib.optionals stdenv.isLinux [ gtk3 libsoup_3 webkitgtk_4_1] ++
196+
lib.optionals stdenv.isDarwin [
197+
# Required deps for mac
198+
darwin.libobjc
199+
darwin.apple_sdk.frameworks.AppKit
200+
darwin.apple_sdk.frameworks.WebKit
201+
darwin.apple_sdk.frameworks.SystemConfiguration
202+
darwin.apple_sdk.frameworks.CoreSevices
203+
darwin.apple_sdk.frameworks.Security
204+
];
205+
}
206+
```
207+
208+
:::caution[Experimental]
209+
Just to note flakes are experimental in nix and may change any time.
210+
:::
211+
212+
Using `flake.nix`: checkout [eveeifyeve/Tauri-Flake-Templates](https://github.com/Eveeifyeve/Tauri-Flake-Templates) on github to use a community maintained nix flake.
213+
214+
Feel free to follow along if your using the flake template as this is the same thing
215+
216+
217+
218+
Next: [Install Rust](#rust)
219+
220+
229221
## Rust
230222
231223
Tauri is built with [Rust](https://www.rust-lang.org) and requires it for development. Install Rust using one of following methods. You can view more installation methods at https://www.rust-lang.org/tools/install.
@@ -252,13 +244,14 @@ Visit https://www.rust-lang.org/tools/install to install `rustup`.
252244
253245
</TabItem>
254246
<TabItem label="Nix/NixOS">
255-
Add the following packages below to install Rust on nix/NixOS.
247+
Add the following in your buildinputs from [Previous Section](#nixnixos) below to install Rust on nix/NixOS.
256248
```nix
257249
cargo
258250
rustc
259251
rustfmt
260-
rustup # if you want to use rustup
261252
```
253+
254+
262255
</TabItem>
263256
264257
</Tabs>
@@ -292,11 +285,14 @@ While npm is the default package manager for Node.js, you can also use others li
292285
293286
</TabItem>
294287
<TabItem label="Nix/NixOS">
295-
To install Node.js Add the following packages below to install Node.js on nix/NixOS.
288+
Add the following to your `buildInputs` to install Nodejs:
296289
```nix
297-
nodejs-slim # feel free to change the version
290+
nodejs # feel free to change the version
298291
npm
299292
```
293+
294+
While npm is the default package manager for Node.js, you can also use others like pnpm or yarn. To install them look for that package on [nixpkgs](https://search.nixos.org/packages) and add the package above. This step is optional and only needed if you prefer using a package manager other than npm.
295+
300296
</TabItem>
301297
</Tabs>
302298
@@ -312,7 +308,7 @@ If you'd like to target your app for Android or iOS then there are a few additio
312308
### Android
313309
314310
:::caution[Nix/NixOS]
315-
Android development only supports Linux Nix/NixOS.
311+
Android Studio only supports Linux Nix/NixOS.
316312
If you are using Nix on darwin you could try the [homebrew route through nix-darwin](https://daiderd.com/nix-darwin/manual/index.html#opt-homebrew.brews) to install Android Studio.
317313
:::
318314
@@ -343,10 +339,6 @@ export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"
343339
[System.Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Android\Android Studio\jbr", "User")
344340
```
345341
346-
</TabItem>
347-
<TabItem label="Nix/NixOS">
348-
{/* TODO: Add NixOS instructions */}
349-
350342
</TabItem>
351343
</Tabs>
352344
3. Use the SDK Manager in Android Studio to install the following:
@@ -357,7 +349,7 @@ export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"
357349
- Android SDK Build-Tools
358350
- Android SDK Command-line Tools
359351
360-
Selecting "Show Package Details" in the SDK Manager enables the installation of older package versions. Only install older versions if necessary, as they may introduce compatibility issues or security risks.
352+
/electing "Show Package Details" in the SDK Manager enables the installation of older package versions. Only install older versions if necessary, as they may introduce compatibility issues or security risks.
361353
362354
4. Set `ANDROID_HOME` and `NDK_HOME` environment variables.
363355
@@ -386,9 +378,6 @@ $VERSION = Get-ChildItem -Name "$env:LocalAppData\Android\Sdk\ndk"
386378
[System.Environment]::SetEnvironmentVariable("NDK_HOME", "$env:LocalAppData\Android\Sdk\ndk\$VERSION", "User")
387379
```
388380
389-
</TabItem>
390-
<TabItem label="Nix/NixOS">
391-
{/* TODO: Add NixOS instructions */}
392381
</TabItem>
393382
</Tabs>
394383
@@ -398,6 +387,15 @@ $VERSION = Get-ChildItem -Name "$env:LocalAppData\Android\Sdk\ndk"
398387
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
399388
```
400389
390+
# Nix/Nixos
391+
392+
Add the following to `buildInputs` to install the tools/Android Studio(Linux only):
393+
```nix
394+
android-studio # Linux only
395+
android-tools
396+
```
397+
398+
401399
Next: [Setup for iOS](#ios) or [Create a project](/start/create-project/).
402400
403401
### iOS
@@ -433,13 +431,12 @@ Next: [Create a project](/start/create-project/).
433431
If you run into any issues during installation be sure to check the [Troubleshooting Guide](/develop/debug/) or reach out on the [Tauri Discord](https://discord.com/invite/tauri).
434432
435433
</TabItem>
436-
<TabItem label="Nix/NixOS">
437-
1. Add the iOS targets with `rustup` in Terminal:
438-
439-
```sh
440-
rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim
434+
<TabItem label="Nix">
435+
Add the following to `buildInputs` under darwin section to install
436+
```nix
437+
darwin.xcode
438+
darwin.apple_sdk.frameworks.UiKit
441439
```
442-
TODO: Find out what you need to install for NixOS
443440
444441
</TabItem>
445442
</Tabs>

0 commit comments

Comments
 (0)