Packaging Protonmail's Import-Export app (QT5)

I want to use ProtonMail’s import-export app: How to export emails using the Import-Export app | Proton.

I couldn’t get any of the tools like steam-run etc to work so I figured, I’ll just try and package it properly but I am kind of stuck (fairly new to Nix).

It is a QT5 app and I’ve figured out that I want to use wrapQtAppsHook. The app does have a launcher script which isn’t picked up by the hook AFAIK so I resorted to manually wrapping it. It builds fine but when I try to run it, I still get an error that I am trying to run an unpatched binary on NixOS.

This is where I am stuck. I thought the wrapQtAppsHook would take care of all of that? Here is what I have:

{ stdenv, lib, dpkg, fetchurl, qtbase, wrapQtAppsHook, patchelf, ... }:

stdenv.mkDerivation rec {
  pname = "protonmail-import-export-app";
  version = "1.3.3-1";

  src = fetchurl {
    url = "${version}_amd64.deb";
    hash = "sha256-gz82nTWNwT5q2BPeTYwHGtkefhJv0G8x+Lc2Zj6PP9A=";

  nativeBuildInputs = [ dpkg wrapQtAppsHook ];
  buildInputs = [ qtbase ];

  unpackPhase = ''
    dpkg-deb -x $src .

  installPhase = ''
    mkdir -p $out
    cp -r usr/* $out
    rm $out/bin/protonmail-import-export-app # Delete existing symlink so we can create our own.

  dontWrapQtApps = true;
  preFixup = ''
    wrapQtApp "$out/lib/protonmail/import-export/proton-ie"
    wrapQtApp "$out/lib/protonmail/import-export/proton-ie-launcher"

  postFixup = ''
    # Ensure the launcher is accessible and executable
    ln -s $out/lib/protonmail/import-export/proton-ie-launcher $out/bin/protonmail-import-export-app
    chmod +x $out/bin/protonmail-import-export-app

  meta = with stdenv.lib; {
    description = "Proton Import-Export app";
    homepage =;

I don’t have any experience with QT either so I am not sure why there is a launcher binary next to the actual app. Do I need to patch both? How do I do that?

ChatGPT was suggesting something like:

    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
             --set-rpath $out/lib:$out/lib/protonmail/import-export:${stdenv.lib.makeLibraryPath [ qtbase ]} \

But that didn’t work either.

The ldd output for both binaries is:

❯ ldd /nix/store/14mk99za3f8psykgshihp84kdpx6hbnw-protonmail-import-export-app-1.3.3-1/lib/protonmail/import-export/proton-ie (0x00007ffd52dc1000) => /nix/store/cyrrf49i2hm1w7vn2j945ic3rrzgxbqs-glibc-2.38-44/lib/ (0x00007f8b888d4000)
	/nix/store/cyrrf49i2hm1w7vn2j945ic3rrzgxbqs-glibc-2.38-44/lib/ => /nix/store/cyrrf49i2hm1w7vn2j945ic3rrzgxbqs-glibc-2.38-44/lib64/ (0x00007f8b88abf000)
❯ ldd /nix/store/14mk99za3f8psykgshihp84kdpx6hbnw-protonmail-import-export-app-1.3.3-1/lib/protonmail/import-export/proton-ie-launcher (0x00007ffdbf2dd000) => /nix/store/cyrrf49i2hm1w7vn2j945ic3rrzgxbqs-glibc-2.38-44/lib/ (0x00007f701a46b000)
	/nix/store/cyrrf49i2hm1w7vn2j945ic3rrzgxbqs-glibc-2.38-44/lib/ => /nix/store/cyrrf49i2hm1w7vn2j945ic3rrzgxbqs-glibc-2.38-44/lib64/ (0x00007f701a656000)