Change:
<ins> { stdenv , fetchFromGitHub , fetchurl , python27Packages , substituteAll , gnome3 , gobject-introspection , wrapGAppsHook , gtk3 , webkitgtk , libnotify , keybinder3 , libappindicator , intltool , wmctrl , hicolor-icon-theme , xvfb_run }: python27Packages.buildPythonApplication rec  { pname = "ulauncher"; version = "4.4.0.r1"; # Python 3 support is currently in development # on the dev branch and 5.x.x releases disabled = ! python27Packages.isPy27; src = fetchurl { url = "https://github.com/Ulauncher/Ulauncher/releases/download/${version}/ulauncher_${version}.tar.gz"; sha256 = "12v7qpjhf0842ivsfflsl2zlvhiaw25f9ffv7vhnkvrhrmksim9f"; }; nativeBuildInputs = with python27Packages;  [ distutils_extra intltool wrapGAppsHook ]; buildInputs = [ gnome3.adwaita-icon-theme gobject-introspection hicolor-icon-theme keybinder3 libappindicator libnotify webkitgtk wmctrl ]; propagatedBuildInputs = with python27Packages; [ dbus-python notify pygobject3 pyinotify pysqlite python-Levenshtein pyxdg websocket_client ]; checkInputs = with python27Packages; [ mock pytest_3 pytest-mock pytestpep8 xvfb_run ]; patches = [ ./fix-path.patch ]; postPatch = '' substituteInPlace setup.py --subst-var out ''; # https://github.com/Ulauncher/Ulauncher/issues/390 doCheck = false; preCheck = '' export PYTHONPATH=$PYTHONPATH:$out/${python27Packages.python.sitePackages} ''; # Simple translation of # - https://github.com/Ulauncher/Ulauncher/blob/f5a601bdca75198a6a31b9d84433496b63530e74/test checkPhase = '' runHook preCheck # skip tests in invocation that handle paths that # aren't nix friendly (i think) xvfb-run -s '-screen 0 1024x768x16'  pytest -k 'not TestPath and not test_handle_key_press_event' --pep8 tests runHook postCheck ''; preFixup = '' gappsWrapperArgs+=(--prefix PATH : "${stdenv.lib.makeBinPath [ wmctrl ]}") ''; meta = with stdenv.lib; { description = "A fast application launcher for Linux, written in Python, using GTK"; homepage = https://ulauncher.io/; license = licenses.gpl3; platforms = platforms.linux; maintainers = with maintainers; [ aaronjanse worldofpeace ]; }; } </ins>

Discussion:
Ulauncher is an application launcher for Linux: Tried to package it myself but I am a rookie and this seems like a bit painful for the first package.
For those interested I made a really quick. However, if you build and execute it you'll realize there's definitely some problems.
More specifically, the first error I run into halts with the following stack trace: Any ideas for workarounds?
If you just examine the result of the derivation you'll notice that things in appear to be in the wrong locations. So that'll definitely make it not work. There's probably something wrong with and I don't think is maintained. So perhaps we can just change the build system if it's easy? Maybe do what  is doing.
Looking at the beginning of the build log, I noticed: Note that it thinks the version is . Maybe this has to do with ? I assume that is supposed to be replaced with something else at But clearly something is not working. That's all I've got. Cheers
Very late edit, I managed to change this after the build via: But last executable still cries:
Would you mind sharing your full nix expression? I can't figure out how to get past the issue. (I suspect you replaced it in ?)
Yes, but I did it after the build. the last status (which is a wreck with too many unnecessary stuff probably, I gave up after trying a bit).
I'm not sure how to implement this in Nix, but we can get past the error by setting the environment variable to the generated site-packages folder (). In other words: We still get an error but I think this is a step forward?
:) I guess. I am still rookie on nixland and this made me confused since we have defined under everything like crazy.
Just so we are on the same page, this is what I am currently using to build ulauncher: I replaced the version substitution code to put the version number where I think the ulauncher source code intends for it to be put. Doing so does not break the build.
The means that the is missing. I'm working on creating a . I've run into , meaning that I needed to make to load a few libraries with using absolute paths. I'm using to apply the patches: Applying the patches is the only way I was able to manage getting to build.

The patch was applied with during build time. During runtime, however, the patch was applied, but without substitutions: How do we get the patch substitutions working for runtime?
module is provided by which we already have packaged. definitely should not be used.