Woes packaging deadlock-mod-manager

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 the chrono dependency when I try that
  • Notice the preBuild script. For some odd reason, there’s a separate package.json file in apps/desktop that contains the build script for the app. Tauri is configured to build using pnpm ui:build, a script which only exists in this sub-package. I’ve tried setting sourceRoot, but it’s caused problems with trying to access/modify node_modules (IIRC it gives a permission error). This preBuild 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.

1 Like

I’d probably try strace to get to the bottom of what it’s trying to open. It would be helpful if you post the patch (or a complete repo) so that other people have a cheap way to play with what you’ve done so far.

2 Likes

Not sure what’s happening, works on nixos but fails with that error on arch (I am using distrobox)

found one minor fix that helps with font config error that I encountered inside distrobox. I assume its not showing in your system because /etc/fonts exists.

source: https://github.com/NixOS/nixpkgs/issues/176081#issuecomment-1145825623

diff --git a/package.nix b/package.nix
index 7b22dd6..7a3acae 100644
--- a/package.nix
+++ b/package.nix
@@ -14,6 +14,8 @@
   glib,
   gtk3,
   webkitgtk_4_1,
+
+  fontconfig,
 }:
 rustPlatform.buildRustPackage rec {
   pname = "deadlock-mod-manager";
@@ -49,6 +51,10 @@ rustPlatform.buildRustPackage rec {
     hash = "sha256-uRDZD29iqTdzmqwFu7xOmfAqT7LiVJ4an4BQMQWXpGM=";
   };
 
+  preFixup = ''
+    gappsWrapperArgs+=(--set FONTCONFIG_FILE "${fontconfig.out}/etc/fonts/fonts.conf")
+  '';
+
   preBuild =
     # sh
     ''

As for where the error is occuring I wasn’t able to find it.

There is another thing I noticed, after building the package and running it, a file ~/.local/share/applications/.deadlock-mod-manager-wrapped-handler.desktop is getting created (source) with an absolute path to the executable, and its not getting updated when the package gets updated, so that means an outdated version will be launched. This should be patched.

I was also attempting to package this app recently and ran into the same error. Spent a long time looking through it with strace and unfortunately found nothing helpful.

I did find that the same error happens even if you build it with cargo in a devshell, so its not caused by the Nix build itself.

Hello everyone,
I’m the author of Deadlock Mod Manager. Thanks for taking the time to package it for NixOS. If there’s anything I can do to help, feel free to reach out.

1 Like

I’m so glad someone else is also making an attempt to get this packaged, I was running into the exact same issue. My very small look at trying to get it working resulted in me finding out that it has something to do with the program not being able to access the UI? I Don’t know enough about rust and the specific libraries to even know if this is something to look further into however. I’m fully willing to help out any way I can with my current work on the package