Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nix/NixOS Requirements and Documentation #2413

Draft
wants to merge 32 commits into
base: v2
Choose a base branch
from
Draft
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
112628a
feat: nix docs for macos
Eveeifyeve Jul 15, 2024
5d111d2
feat: xcode, rust, android & ios deps for nix
Eveeifyeve Aug 14, 2024
36bebcc
feat: distrobuting on nix
Eveeifyeve Oct 2, 2024
8fd9b83
feat: nix documentation
Eveeifyeve Oct 2, 2024
6733a9c
fix: fmt
Eveeifyeve Oct 2, 2024
1a273dd
chore: changed requirements for nix/nixos
Eveeifyeve Oct 2, 2024
0e90ce6
fix: required frameworks
Eveeifyeve Oct 2, 2024
cca2543
chore: updated macOS nix note to use better wording
Eveeifyeve Oct 2, 2024
49b1f8c
fix: Selecting in android
Eveeifyeve Oct 2, 2024
2439d01
chore: updated wording on flake templates
Eveeifyeve Oct 2, 2024
0591150
fix: capitalisation in the Nix/Nixos section in linux
Eveeifyeve Oct 2, 2024
fe198a0
fix: shell.nix
Eveeifyeve Oct 2, 2024
74e882a
chore: updated nix-shell title to shell.nix
Eveeifyeve Oct 2, 2024
47742a5
chore: updated ios nix section to be less informative
Eveeifyeve Oct 2, 2024
d2c83dc
chore: removed next for flakes
Eveeifyeve Oct 2, 2024
7c7411d
fix: flakes caution
Eveeifyeve Oct 2, 2024
b80355c
chore: moved rust to nix/nixos section
Eveeifyeve Oct 2, 2024
c52f7bd
chore: moved node packages to nix/nixos section
Eveeifyeve Oct 2, 2024
a21b062
chore: removed unneeded tab at nodejs
Eveeifyeve Oct 2, 2024
921b840
chore: remove nix android instructions
Eveeifyeve Oct 3, 2024
1afb630
fix: code block for shell.nix
Eveeifyeve Oct 3, 2024
b5f43e8
chore: removed warning for nix/nixos
Eveeifyeve Oct 3, 2024
264e53c
chore: remove extra nix/nixos download step for android
Eveeifyeve Oct 3, 2024
4f440cf
chore: added wiki link
Eveeifyeve Oct 3, 2024
a201d12
chore: remvoed distrobuting for nix as it's in wiki page.
Eveeifyeve Oct 3, 2024
9be5614
Merge branch 'v2' into nix-documentation
Eveeifyeve Jan 31, 2025
722f67c
chore: remove macos note
Eveeifyeve Jan 31, 2025
40ae9b9
chore: deprecate using tauri flake templates
Eveeifyeve Jan 31, 2025
818a19a
chore: move nixos section note to nixos tabitem
Eveeifyeve Jan 31, 2025
cd1eacc
fix: netlify build issue with missing tab closing
Eveeifyeve Jan 31, 2025
493ae4a
chore: remove extra tabs
Eveeifyeve Jan 31, 2025
6d5756d
fix: tab closing in nixos section at distros
Eveeifyeve Jan 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 59 additions & 39 deletions src/content/docs/start/prerequisites.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,43 +115,7 @@ sudo apk add \
```
</TabItem>
<TabItem label="NixOS">

:::note
This will also install Rust and Node.js as well as the `cargo-tauri` CLI for you, so you can skip those steps below.
:::

Using `nix-shell`:

```nix
let
pkgs = import <nixpkgs> { };
in
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
pkg-config
gobject-introspection
cargo
cargo-tauri
nodejs
];

buildInputs = with pkgs;[
at-spi2-atk
atkmm
cairo
gdk-pixbuf
glib
gtk3
harfbuzz
librsvg
libsoup_3
pango
webkitgtk_4_1
openssl
];
}
```

This section has been moved Nix/NixOS to a dedicated section [here](#nixnixos)
Copy link
Contributor

@vasfvitor vasfvitor Feb 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if you wrap it into a :::info aside, as of now it kinda mixed with the text content right after it. Ofc if you have a better idea than aside it could work.
image

</TabItem>
</Tabs>

Expand Down Expand Up @@ -179,7 +143,6 @@ xcode-select --install
```

</details>

Next: [Install Rust](#rust)

### Windows
Expand Down Expand Up @@ -209,6 +172,50 @@ Install WebView2 by visiting the [WebView2 Runtime download section](https://dev

Next: [Install Rust](#rust)

### Nix/NixOS

Using a [`shell.nix`](https://nix.dev/tutorials/first-steps/declarative-shell):

```nix
let
pkgs = import <nixpkgs> {
config = { };
overlays = [ ];
};
in

pkgs.mkShell {
nativeBuildInputs =
with pkgs;
[
rustc
cargo
# Uncomment if `@tauri-apps/cli` doesn't work on your system
# cargo-tauri
pkg-config
]
++ lib.optionalAttrs stdenv.hostPlatform.isLinux [ wrapGAppsHook4 ];

buildInputs =
with pkgs;
[ openssl ]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@getchoo for some reason libiconv is required maybe for plugins?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What plugins specifically? It'd be nice to note it

I also imagine that would be a macOS exclusive dependency; libiconv is hardly ever used on Linux

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have to test to see which plugins require it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will investigate and create a minimal environment.

++ lib.optionals stdenv.hostPlatform.isLinux [
glib-networking
webkitgtk_4_1
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.WebKit
];
}
```

:::caution[Experimental]
Flakes are [experimental](https://nix.dev/manual/nix/stable/contributing/experimental-features.html) in Nix and may change at any time.
:::

If you prefer to use Flakes, Please follow the following [wiki page how you can use the above `shell.nix` `pkgs.mkShell` inside of a flake](https://wiki.nixos.org/wiki/Flakes#Output_schema)
For more info about Tauri on Nix/NixOS, Checkout the [NixOS Wiki Page.](https://wiki.nixos.org/wiki/Tauri)

## Rust

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.
Expand Down Expand Up @@ -291,6 +298,7 @@ If you'd like to target your app for Android or iOS then there are a few additio
### Android

1. Download and install [Android Studio from the Android Developers website](https://developer.android.com/studio)

2. Set the `JAVA_HOME` environment variable:

{/* TODO: Can this be done in the 4th step? */}
Expand Down Expand Up @@ -364,7 +372,6 @@ However you can refresh the current session:
:::

</TabItem>

</Tabs>

5. Add the Android targets with `rustup`:
Expand All @@ -381,6 +388,8 @@ Next: [Setup for iOS](#ios) or [Create a project](/start/create-project/).
iOS development requires Xcode and is only available on macOS. Be sure that you've installed Xcode and not Xcode Command Line Tools in the [macOS system dependencies section](#macos).
:::

<Tabs>
<TabItem label="macOS">
1. Add the iOS targets with `rustup` in Terminal:

```sh
Expand All @@ -405,6 +414,17 @@ Next: [Create a project](/start/create-project/).

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).

</TabItem>
<TabItem label="Nix">
Add the following to your development shell's `buildInputs`
```nix
darwin.xcode
darwin.apple_sdk.frameworks.UiKit
```

</TabItem>
</Tabs>

<Card title="Next Steps" icon="rocket">

Now that you've installed all of the prerequisistes you're ready to [create your first Tauri project](/start/create-project/)!
Expand Down