I’m working on packaging deadlock-mod-manager, specifically the desktop app, which is made with Tauri. I used the fedistar package as reference for the use of cargo-tauri.hook
with pnpm. Here’s the current state of package.nix
:
{
fetchFromGitHub,
rustPlatform,
# nativeBuildInputs
pnpm_10,
nodejs_24,
cargo-tauri,
pkg-config,
wrapGAppsHook4,
# buildInputs
openssl,
glib,
gtk3,
webkitgtk_4_1,
}:
rustPlatform.buildRustPackage rec {
pname = "deadlock-mod-manager";
version = "0.9.1";
src = fetchFromGitHub {
owner = pname;
repo = pname;
tag = "v${version}";
hash = "sha256-f0V9aov8tRDnS+t3Qhgs/v7HjEg2bX1qk/PxnLSU+S0=";
};
patches = [ ./no-updater-artifacts.patch ];
buildInputs = [
openssl
glib.dev
gtk3.dev
webkitgtk_4_1.dev
];
nativeBuildInputs = [
cargo-tauri.hook
nodejs_24
pnpm_10.configHook
pkg-config
wrapGAppsHook4
];
pnpmDeps = pnpm_10.fetchDeps {
inherit pname version src;
fetcherVersion = 2;
hash = "sha256-uRDZD29iqTdzmqwFu7xOmfAqT7LiVJ4an4BQMQWXpGM=";
};
preBuild =
# sh
''
cd apps/desktop
'';
cargoRoot = "apps/desktop";
cargoHash = "sha256-LNYQIvhGDBdQ72Fm7H6U6lf7CfafBGo8Suh6vde0dRE=";
}
A couple of notes:
- I’m somewhat conflicted on what directory I should use as
cargoRoot
.apps/desktop
is the only thing that’s successfully built, but judging by other tauri apps,apps/desktop/src-tauri
feels more appropriate. Only problem there is that I get a strange bug about not being able to find a matching version for thechrono
dependency when I try that - Notice the
preBuild
script. For some odd reason, there’s a separatepackage.json
file inapps/desktop
that contains the build script for the app. Tauri is configured to build usingpnpm ui:build
, a script which only exists in this sub-package. I’ve tried settingsourceRoot
, but it’s caused problems with trying to access/modifynode_modules
(IIRC it gives a permission error). ThispreBuild
is the only thing that I’ve gotten to work - I’ve tried to set
buildAndTestSubdir
, but it’s caused a strange error from the pushd command about invalid inputs or something
Right now this builds, but when I try to run the binary it panics:
thread 'main' panicked at /build/deadlock-mod-manager-0.9.1-vendor/tauri-2.8.5/src/app.rs:1301:11:
Failed to setup app: error encountered during setup hook: No such file or directory (os error 2)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
It’s proven difficult to determine the file that tauri isn’t finding, but with a bit more work I could probably track it down in the source code.
Any ideas for fixes? If you want to see specific error messages, let me know. This being a very sizeable rust crate, it can sometimes take a while to test the build, so I’ve decided to just record what I can remember right now.