-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[feat] upstream nix requirements to nixpkgs #8588
[feat] upstream nix requirements to nixpkgs #8588
Comments
I think the main blocker here is that nobody in the tauri wg uses nix or nixos and i personally am not interested in getting into it either. The docs were contributed (and are semi-maintained) by the community. And together with my prior statement we currently rely on them to also fix issues with it / keep it updated.
Is it possible then to mark webkitgtk as platform specific? Because it is a hard dependency on Linux but indeed not used at all on macOS. But you're right, we should probably differntiate between nix and nixos (probably by adding a new nix section to macos. Or wherever we could fit it into the new docs.) Anyway, i believe that for the time being this is something we have to rely on the community to maintain if they want to use it. |
Actually, let me reopen this with the Help Needed tag for better visibility :) |
@FabianLars this issue is about an approach, the nix community is large and there is a have you tried filing issues for these dependencies and other concerns upstream? perhaps someone from the nix community would be willing to help |
The ideal solution for Nix/NixOS users would be for Tauri to have a flake. Said flake could provide a basic devshell that user flakes could inherit, and that would import the essential packages. It could also export Normally, I'd say the flake should be in this repo, but it might be good for it to be in its own repo because of the sheer size of this one. Would make it easier to delegate stewardship as well. |
I recently started using NixOS (x86_64-unknown-linux-gnu). I have a custom flake that I use for Tauri projects. How can I be of help?
{
inputs = {
nixpkgs.url = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
packages = with pkgs; [
cargo
cargo-tauri
toolchain
rust-analyzer-unwrapped
nodejs_18
nodePackages.pnpm
];
nativeBuildPackages = with pkgs; [
pkg-config
dbus
openssl
glib
gtk3
libsoup
webkitgtk
librsvg
];
libraries = with pkgs; [
webkitgtk
gtk3
cairo
gdk-pixbuf
glib
dbus
openssl
librsvg
];
in {
devShells.default = pkgs.mkShell {
buildInputs = packages;
nativeBuildInputs = nativeBuildPackages;
shellHook = with pkgs; ''
export LD_LIBRARY_PATH="${
lib.makeLibraryPath libraries
}:$LD_LIBRARY_PATH"
export OPENSSL_INCLUDE_DIR="${openssl.dev}/include/openssl"
export OPENSSL_LIB_DIR="${openssl.out}/lib"
export OPENSSL_ROOT_DIR="${openssl.out}"
export RUST_SRC_PATH="${toolchain}/lib/rustlib/src/rust/library"
'';
};
});
}
[toolchain]
# You can use a stable channel. Tauri recommends using a Rust version of at least 1.64
channel = "nightly-2023-08-08"
components = ["rustfmt", "clippy", "rust-src"]
targets = ["x86_64-unknown-linux-gnu"] |
Do we create |
I asked on the Discord, and the TL;DR is that it should probably be made and owned by a member of the community first. I'd be happy to own it. |
Yea the best path forward is to first make a repo community owned so that we see there's a real interest and that it's not just yet another feature request putting the burden of developing it on the WG. The question of whether it then becomes part of the official tauri-apps organisation is really the question of who will maintain the project and whether the community is ok with relinquishing control of the project over to the WG. Once something becomes official it falls under the control of Tauri with all the checks and balances that comes with it, such as demands for proper reviewing of PR's, CI/CD, supporting the project, ensuring it's safe and stable, the works. The closer the project adheres to Tauri's demands the easier it'll be to transition into being an official project. Note ofc that it's not impossible by any means to join the WG, if you own it @khionu and donate it to tauri-apps later, it could be seen as your contribution towards Tauri and qualify you for joining the WG if you so choose. Getting at least 2-3 WG members onboard with maintaining the project is a good idea. Getting the clear-to-go from the relevant domain lead is the final checkbox to tic I'd say (the development domain in this case, @lucasfernog, since the domain lead is the one that either creates or assigns a team to work on the project). |
I have created a repo https://github.com/ahkohd/tauri-flake where we can all contribute to the flake. I'm looking for a Darwin contributor and other reviewers. I can contribute to this, but I'll need to set up Nix first on my MBP; it will be faster if somebody already has this setup. |
Oh I missed this, oops. |
Look I could take a look at making a flake for tauri templates my only problem I use devenv wather then the normal shell stuff. Maybe we could make a nix folder somewhere and copy and paste template like |
But the problem is I can only test only on MacOS, So is anyone willing when my PR Comes out test it on NixOS? |
But the problem I've ran into is in issue #9433 where it requires Clang expression at start so I don't know how it will go but if someone like @FabianLars Tell me all the decencies required by Tauri on Both MacOS and Linux I can try to get some sort of flake template started |
I am going to get started on a repo called nix-tauri which includes stuff for tauri for Nix/NixOS |
I will build more of it tmr and get a prototype working maybe a include a build thing in nix??? where it build a tauri application |
MacOS version of the flake is fully working #9433 based on https://github.com/eveeifyeve/nix-tauri using |
Hey Good News I am working on a PR that will fix this issue. |
Right off the bat this is not possible.
I'm not entirely sure what you mean here by "Tauri tasks"? If you're implying building Tauri through Nix, then this makes sense as that isn't the job of a development shell, but a proper package
This is not a Nix issue, but one with newer versions of webkitgtk on NVIDIA GPUs. It should not be set in a shellHook or development shell universally, only on systems where you actually have these issues
Yes
As said above, this isn't really possible. Further, I believe it's very unreasonable to expect this from upstream -- especially as they have stated before no one in the WG uses it I believe the current best solution would be to document a basic dev shell similar to other distributions in the official documentation (see possibly tauri-apps/tauri-docs#2413) and further applications of Nix + Tauri should be documented on wiki.nixos.org for example To quickly solve some issues here though, A basic dev shell for a Tauri project may also look something like this pkgs.mkShell {
packages = with pkgs; [
nodejs
# This will automatically use whatever package manager is declared by package.json if using corepack (which you totally should, it's great)
# You can also replace this with any package manager of your choice, like `pnpm` or `bun`
corepack
];
nativeBuildInputs =
with pkgs;
[
# Rust toolchain
rustc
cargo
pkg-config
]
# Brings in most of our GTK stuff for Linux
++ lib.optionals stdenv.hostPlatform.isLinux [ wrapGAppsHook4 ];
buildInputs =
with pkgs;
[ openssl ]
++ lib.optionals stdenv.hostPlatform.isLinux [
# Required for most applications
glib-networking
webkitgtk_4_1
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.WebKit
];
} You may also have other tools required for your project like |
Describe the problem
Not sure if this is a bug or a feature, it's borderline imo.
Basically what I expect is that when i use the
cargo-tauri
derivation fromnixpkgs
that i don't also have to copy and paste a bunch of additional prerequisites from the tauri docs in order to get things half working.I say half working because I'm still running into bugs with
cargo-tauri
, especially on mac, one of which i already pushed a fix for NixOS/nixpkgs#279771 (comment)I also see that one of the dependencies,
webkitgtk
is marked as broken innixpkgs
on mac, but listed as a dependency on the tauri docs. I understand the nix docs say nixos rather thannix
but it's pretty common use case for people working on linux/mac to be using nix rather than committing to a full nixos setup.Additionally, I noticed that the prerequisites in the docs only work for a
nix develop
style shell, they don't work fornix run
, say if I wanted to lift some standard tauri tasks into a package, the instructions don't cover that. This is because the additional steps of setting up the library etc. are limited to ashellHook
.Further, the prerequisites are missing required steps in the
shellHook
. We found that when tauri is built via nix there is a need to disable webkit compositing mode likeexport WEBKIT_DISABLE_COMPOSITING_MODE=1
in theshellHook
. This seems to be some known tribal knowledge, as it appears in snippets from other people such as #8535 but it's not listed in the prerequisites in the docs.There are other issues like #8535 that I expect are probably not issues with tauri itself, but some additional work that needs to be done on the nix side. At the moment it isn't clear where to put or discuss such a fix, would it just result in more documented boilerplate? or is there a way to codify it?
Stepping back a bit, I feel like the meta issue is that fixes to issues are being pushed into the tauri docs (or not) rather than some derivation that is directly maintainable and reusable downstream.
Describe the solution you'd like
Tauri maintains the derivation in
nixpkgs
with the same dependencies that it outlines in the documentation, so then there are no manual steps for consumers.Alternatives considered
Another alternative would be that tauri maintains their own nix code separate to nixpkgs, such as an overlay or flake.
This would be fine too, the main problem to solve is to lift dependencies and other issues from docs and into nix-compatible code somewhere.
Additional context
No response
The text was updated successfully, but these errors were encountered: