anchor.diff:  
     meta = with stdenv.lib; {
       description = "Linux application sandboxing and distribution framework";
  -    homepage = https://flatpak.org/;
  +    homepage = "https://flatpak.org/";
       license = licenses.lgpl21;
       maintainers = with maintainers; [ jtojnar ];
       platforms = platforms.linux;
  
positive.code:   };
  
    patches = [
      (substituteAll {
        src = ./fix-test-paths.patch;
        inherit coreutils gettext glibcLocales;
        hicolorIconTheme = hicolor-icon-theme;
      })
      (substituteAll {
        src = ./fix-paths.patch;
        p11 = p11-kit;
      })
      (substituteAll {
        src = ./bubblewrap-paths.patch;
        inherit (builtins) storeDir;
      })
      # patch taken from gtk_doc
      ./respect-xml-catalog-files-var.patch
      ./use-flatpak-from-path.patch
      ./unset-env-vars.patch
      ./validate-icon-pixbuf.patch
    ];
  
    nativeBuildInputs = [
      autoreconfHook libxml2 docbook_xml_dtd_412 docbook_xml_dtd_42 docbook_xml_dtd_43 docbook_xsl which gobject-introspection
      gtk-doc intltool libxslt pkgconfig xmlto appstream-glib yacc wrapGAppsHook
    ];
  
    buildInputs = [
      bubblewrap bzip2 dbus dconf glib gpgme json-glib libarchive libcap libseccomp
      libsoup lzma ostree polkit python3 systemd xorg.libXau fuse
      gsettings-desktop-schemas glib-networking
      librsvg # for flatpak-validate-icon
    ];
  
    checkInputs = [ valgrind ];
  
    doCheck = false; # TODO: some issues with temporary files
  
    NIX_LDFLAGS = "-lpthread";
  
  
negative.code:   ];
  
    makeFlags = [
      "installed_testdir=${placeholder "installedTests"}/libexec/installed-tests/flatpak"
      "installed_test_metadir=${placeholder "installedTests"}/share/installed-tests/flatpak"
    ];
  
    postPatch = ''
  