Trouble packaging software made with Tauri

Disclaimer

This is my first time making a Nix package. To learn the its ins and outs of Nixpkgs, I have mostly been digging through its source code, instead of following tutorials. If there is any weirdness within my package, do let me know.

Hello,

The software I’m trying to package is a Titanfall 2 mod manager, which was made with Tauri and Vue.

I am currently getting the following error message at the end of tauriBuildHook:

# ...
  Compiling async-recursion v1.1.1
   Finished `release` profile [optimized + debuginfo] target(s) in 16m 53s
      Built application at: /build/source/target/x86_64-unknown-linux-gnu/release/flightcore
       Info Patching binary "/build/source/target/x86_64-unknown-linux-gnu/release/flightcore" for type deb
       Warn Failed to add bundler type to the binary: __TAURI_BUNDLE_TYPE variable not found in binary. Make sure tauri crate and tauri-cli are up to date and that symbol stripping is disabled (https://doc.rust->
   Bundling FlightCore_3.2.0_amd64.deb (/build/source/target/x86_64-unknown-linux-gnu/release/bundle/deb/FlightCore_3.2.0_amd64.deb)
      Error failed to bundle project Unable to find a bundled project for the updater

I have no idea whether the issue lies with my package, or something upstream. I was also unable to find any solutions for this error message. I have already tried cleaning up my Nix store, and checking the hashes, but to no avail.

Happy Friday.

Package files

default.nix:

{
  buildNpmPackage,
  cargo-tauri,
  fetchFromGitHub,
  fetchNpmDeps,
  glib-networking,
  lib,
  nodejs,
  npmHooks,
  openssl,
  pkg-config,
  rustPlatform,
  stdenv,
  webkitgtk_4_1,
  wrapGAppsHook4,
}:
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "flightcore";
  version = "3.2.0";

  src = fetchFromGitHub {
    owner = "R2NorthstarTools";
    repo = "FlightCore";
    tag = "v${finalAttrs.version}";
    hash = "sha256-MFnW9cXFzqmdtC31r8cRcihV3NjGAC6+2/DnNVMheCI=";
  };

  # `source/package.json`
  npmDeps = fetchNpmDeps {
    inherit (finalAttrs) pname version src;
    hash = "sha256-6k582aTReT9JLXmIw4i3iccLSVCKsnCthVfeF8vrsp4=";
  };

  frontend = buildNpmPackage {
    pname = "${finalAttrs.pname}-frontend";
    inherit (finalAttrs) version src;
    sourceRoot = "source/src-vue";

    # `source/src-vue/package.json`
    npmDepsHash = "sha256-QhUPkCBK1kcAF7gByFxlg8Ca9PLF3evCl0QYEPP/Q2c=";

    installPhase = ''
      runHook preInstall

      mkdir -p "$out"
      cp -a dist "$out"

      runHook postInstall
    '';
  };

  cargoHash = "sha256-qh8mHDgIwh20I8P8rx25CZIVB8X4ZtY7/lyGQ3xy/7k=";

  cargoRoot = "src-tauri";
  buildAndTestSubdir = finalAttrs.cargoRoot;

  # This flag empties Tauri's `beforeBuildCommand` option.
  #
  # FlightCore is configured to automatically build the front-end before
  # building the back-end. However, since Nixpkgs requires NPM dependencies to
  # be hashed, we need to build the front-end in a separate step.
  #
  # This way, we end up fetching the NPM dependencies from both
  # `source/package.json`, and `source/src-vue/package.json`.
  tauriBuildFlags = "-c ${./override_tauri.conf.json}";

  # Copy [frontend] to where it can be picked up by Tauri.
  preBuild = ''
    cp -a "${finalAttrs.frontend}"/dist src-vue
  '';

  nativeBuildInputs = [
    cargo-tauri.hook
    nodejs
    pkg-config
  ]
  ++ lib.optionals stdenv.hostPlatform.isLinux [
    wrapGAppsHook4
  ];

  buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
    glib-networking
    openssl
    webkitgtk_4_1
  ];

  # TODO: propagatedBuildInputs, makeDesktopItem

  meta = {
    description = "Updater and mod manager for Northstarr";
    homepage = "https://github.com/R2NorthstarTools/FlightCore";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ username-generic ];
    mainProgram = "flightcore";
    platforms = [ "x86_64-linux" ];
  };
})

override_tauri.conf.json:

{
  "build": {
    "beforeBuildCommand": ""
  }
}
1 Like

Try adding this to override_tauri.conf.json

“bundle”: {
  “createUpdaterArtifacts”: false
}

These are some funky quotation marks, but that did the trick. Thanks a bunch!

1 Like