(modify-phases %standard-phases (add-after 'install 'wrap-qt (lambda* (#:key outputs inputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (wrap-qt-program "qbittorrent" #:output out #:inputs inputs)) #t)) ;; NOTE(Krey): Package is checking for python executables (https://github.com/qbittorrent/qBittorrent/blob/master/src/base/utils/foreignapps.cpp#L277) which are required for some functionality such as the search engine, this phase is designed to adjust the source code to work with nix userland by using the python dependency from the store to avoid failure highlighted in https://github.com/qbittorrent/qBittorrent/issues/16139 ;; NOTE-IMPROVEMENT(Krey): This codeblock depends on upstream's declaration of https://github.com/qbittorrent/qBittorrent/blob/master/src/base/utils/foreignapps.cpp#L277, if the file declaration changes then this phase will be brake -> consider optimizing the upstream code for nix userland (add-after 'unpack 'patch-python-path (lambda* (#:key inputs #:allow-other-keys) (substitute* "src/base/utils/foreignapps.cpp" (("(if[ ]+\(testPythonInstallation\(\")(python3)(\",[ ]+pyInfo\)\)[ ]+return[ ]+pyInfo;)") head python-path tail) (string-append head (string-append (assoc-ref inputs "python-3") "/bin/python3") tail)))))))