Unverified Commit ae96b319 authored by seth's avatar seth Committed by Seth Flynn
Browse files
parent 6fd56f4d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -27,7 +27,10 @@ in {
      }
    ];

    environment.systemPackages = [ cfg.package ];
    environment.systemPackages = [
      cfg.package
      pkgs.fuse3
    ];

    security.polkit.enable = true;

+7 −6
Original line number Diff line number Diff line
diff --git a/session-helper/flatpak-session-helper.c b/session-helper/flatpak-session-helper.c
index 5dd7629e..ddc71a4c 100644
index 31e94384..2c297551 100644
--- a/session-helper/flatpak-session-helper.c
+++ b/session-helper/flatpak-session-helper.c
@@ -693,7 +693,7 @@ start_p11_kit_server (const char *flatpak_dir)
@@ -698,7 +698,7 @@ start_p11_kit_server (const char *flatpak_dir)
   g_auto(GStrv) stdout_lines = NULL;
   int i;
   char *p11_argv[] = {
   const char * const p11_argv[] = {
-    "p11-kit", "server",
+    "@p11kit@", "server",
     /* We explicitly request --sh here, because we then fail on earlier versions that doesn't support
      * this flag. This is good, because those earlier versions did not properly daemonize and caused
      * the spawn_sync to hang forever, waiting for the pipe to close.
@@ -836,7 +836,7 @@ main (int    argc,
@@ -852,8 +852,7 @@ main (int    argc,
       exit (1);
     }
 
-  if (g_find_program_in_path ("p11-kit"))
-  pk11_program = g_find_program_in_path ("p11-kit");
-  if (pk11_program)
+  if (TRUE)
     start_p11_kit_server (flatpak_dir);
   else
     g_debug ("p11-kit not found");
     g_info ("p11-kit not found");
+121 −139
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchurl,
  fetchpatch,
  runCommand,
  appstream,
  autoreconfHook,
  bison,
  bubblewrap,
  buildPackages,
  bzip2,
  coreutils,
  curl,
  dbus,
  dconf,
  desktop-file-utils,
  docbook_xml_dtd_45,
  docbook-xsl-nons,
  docbook_xml_dtd_45,
  fetchurl,
  fuse3,
  gdk-pixbuf,
  gettext,
  glib,
  glib-networking,
  gobject-introspection,
  gpgme,
  gsettings-desktop-schemas,
  gtk3,
  gtk-doc,
  gtk3,
  hicolor-icon-theme,
  intltool,
  json-glib,
  libarchive,
  libcap,
@@ -35,50 +30,60 @@
  libseccomp,
  libxml2,
  libxslt,
  malcontent,
  meson,
  ninja,
  nix-update-script,
  nixosTests,
  nixos-icons,
  ostree,
  p11-kit,
  pkg-config,
  polkit,
  pkgsCross,
  python3,
  runCommand,
  shared-mime-info,
  socat,
  substituteAll,
  systemd,
  testers,
  valgrind,
  which,
  validatePkgConfig,
  wayland,
  wayland-protocols,
  wayland-scanner,
  wrapGAppsNoGuiHook,
  xdg-dbus-proxy,
  xmlto,
  xorg,
  xz,
  zstd,
  withAutoSideloading ? false,
  withDocbookDocs ? true,
  withGtkDoc ? stdenv.buildPlatform.canExecute stdenv.hostPlatform,
  withMan ? true,
  withSELinuxModule ? false,
  withSystemd ? true,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "flatpak";
  version = "1.14.10";
  version = "1.16.0";

  # TODO: split out lib once we figure out what to do with triggerdir
  outputs = [
  outputs =
    [
      "out"
      "dev"
    "man"
    "doc"
    ]
    ++ lib.optionals (withDocbookDocs || withGtkDoc) [
      "devdoc"
    "installedTests"
  ];

  separateDebugInfo = true;
      "doc"
    ]
    ++ lib.optional finalAttrs.doCheck "installedTests"
    ++ lib.optional withMan "man";

  src = fetchurl {
    url = "https://github.com/flatpak/flatpak/releases/download/${finalAttrs.version}/flatpak-${finalAttrs.version}.tar.xz";
    hash = "sha256-a73HkIEnNQrYWkpH1wKSyi9MRul3sysf0jHCpxnYIc0=";
    hash = "sha256-ywrFZa3LYhJ8bRHtUO5wRNaoNvppw1Sy9LZAoiv6Syo=";
  };

  patches = [
@@ -89,98 +94,98 @@ stdenv.mkDerivation (finalAttrs: {
      inherit
        coreutils
        gettext
        socat
        gtk3
        socat
        ;
      smi = shared-mime-info;
      dfu = desktop-file-utils;
      hicolorIconTheme = hicolor-icon-theme;
      smi = shared-mime-info;
    })

    # Hardcode paths used by Flatpak itself.
    (substituteAll {
      src = ./fix-paths.patch;
      p11kit = "${p11-kit.bin}/bin/p11-kit";
      p11kit = lib.getExe p11-kit;
    })

    # Allow gtk-doc to find schemas using XML_CATALOG_FILES environment variable.
    # Patch taken from gtk-doc expression.
    ./respect-xml-catalog-files-var.patch

    # Nix environment hacks should not leak into the apps.
    # https://github.com/NixOS/nixpkgs/issues/53441
    ./unset-env-vars.patch

    # Use flatpak from PATH to avoid references to `/nix/store` in `/desktop` files.
    # Applications containing `DBusActivatable` entries should be able to find the flatpak binary.
    # https://github.com/NixOS/nixpkgs/issues/138956
    ./binary-path.patch

    # The icon validator needs to access the gdk-pixbuf loaders in the Nix store
    # and cannot bind FHS paths since those are not available on NixOS.
    finalAttrs.passthru.icon-validator-patch

    # Try mounting fonts and icons from NixOS locations if FHS locations don't exist.
    # https://github.com/NixOS/nixpkgs/issues/119433
    ./fix-fonts-icons.patch

    # TODO: Remove when updating to 1.16
    # Ensure flatpak uses the system's zoneinfo from $TZDIR
    # https://github.com/NixOS/nixpkgs/issues/238386
    (fetchpatch {
      url = "https://github.com/flatpak/flatpak/pull/5850/commits/a8a35bf4d9fc3d76e1a5049a6a591faec04a42fd.patch";
      hash = "sha256-JqkPbnzgZNZq/mplZqohhHFdjRrvYFjE4C02pI3feBo=";
    })
    (fetchpatch {
      url = "https://github.com/flatpak/flatpak/pull/5850/commits/5ea13b09612215559081c27b60df4fb720cb08d5.patch";
      hash = "sha256-BWbyQ2en3RtN4Ec5n62CULAhvywlQLhcl3Fmd4fsR1s=";
    })
    (fetchpatch {
      url = "https://github.com/flatpak/flatpak/pull/5850/commits/7c8a81f08908019bbf69358de199748a9bcb29e3.patch";
      hash = "sha256-RiG2jPmG+Igskxv8oQquOUYsG4srgdMXWe34ojMXslo=";
    })
    # Nix environment hacks should not leak into the apps.
    # https://github.com/NixOS/nixpkgs/issues/53441
    ./unset-env-vars.patch

    # The icon validator needs to access the gdk-pixbuf loaders in the Nix store
    # and cannot bind FHS paths since those are not available on NixOS.
    finalAttrs.passthru.icon-validator-patch
  ];

  nativeBuildInputs = [
    autoreconfHook
    libxml2
    docbook_xml_dtd_45
    docbook-xsl-nons
    which
  # Fixup shebangs in some scripts
  #
  # Don't prefix the already absolute `man` directory with the install prefix
  postPatch = ''
    patchShebangs buildutil/ tests/
    patchShebangs --build subprojects/variant-schema-compiler/variant-schema-compiler

    substituteInPlace doc/meson.build \
      --replace-fail '$MESON_INSTALL_DESTDIR_PREFIX/@1@/@2@' '@1@/@2@'
  '';

  strictDeps = true;

  nativeBuildInputs =
    [
      (python3.pythonOnBuildForHost.withPackages (p: [ p.pyparsing ]))
      bison
      gobject-introspection
    gtk-doc
    intltool
    libxslt
      meson
      ninja
      pkg-config
    xmlto
    bison
      validatePkgConfig
      wrapGAppsNoGuiHook
    ]
    ++ lib.optional withGtkDoc gtk-doc
    ++ lib.optional withMan libxslt
    ++ lib.optional withSELinuxModule bzip2
    ++ lib.optionals withDocbookDocs [
      docbook-xsl-nons
      docbook_xml_dtd_45
      xmlto
    ];

  buildInputs = [
  buildInputs =
    [
      appstream
    bubblewrap
    bzip2
      curl
    dbus
      dconf
      fuse3
      gdk-pixbuf
      glib-networking
      gpgme
      gsettings-desktop-schemas
      json-glib
      libarchive
      libcap
      librsvg # for flatpak-validate-icon
      libseccomp
      libxml2
    xz
    zstd
      malcontent
      polkit
      python3
    systemd
      wayland
      wayland-protocols
      wayland-scanner
      xorg.libXau
    fuse3
    gsettings-desktop-schemas
    glib-networking
    librsvg # for flatpak-validate-icon
  ] ++ lib.optionals withGtkDoc [ gtk-doc ];
      zstd
    ]
    ++ lib.optional withGtkDoc gtk-doc
    ++ lib.optional withSystemd systemd;

  # Required by flatpak.pc
  propagatedBuildInputs = [
@@ -188,51 +193,29 @@ stdenv.mkDerivation (finalAttrs: {
    ostree
  ];

  nativeCheckInputs = [ valgrind ];

  # TODO: some issues with temporary files
  doCheck = false;
  strictDeps = true;

  NIX_LDFLAGS = "-lpthread";

  enableParallelBuilding = true;

  configureFlags = [
    "--with-curl"
    "--with-system-bubblewrap=${lib.getExe bubblewrap}"
    "--with-system-dbus-proxy=${lib.getExe xdg-dbus-proxy}"
    "--with-dbus-config-dir=${placeholder "out"}/share/dbus-1/system.d"
    "--with-profile-dir=${placeholder "out"}/etc/profile.d"
    "--localstatedir=/var"
    "--sysconfdir=/etc"
    "--enable-gtk-doc=${if withGtkDoc then "yes" else "no"}"
    "--enable-installed-tests"
    "--enable-selinux-module=no"
  mesonFlags = [
    (lib.mesonBool "auto_sideloading" withAutoSideloading)
    (lib.mesonBool "installed_tests" finalAttrs.finalPackage.doCheck)
    (lib.mesonBool "tests" finalAttrs.finalPackage.doCheck)
    (lib.mesonEnable "selinux_module" withSELinuxModule)
    (lib.mesonOption "dbus_config_dir" (placeholder "out" + "/share/dbus-1/system.d"))
    (lib.mesonOption "profile_dir" (placeholder "out" + "/etc/profile.d"))
    (lib.mesonOption "system_bubblewrap" (lib.getExe bubblewrap))
    (lib.mesonOption "system_dbus_proxy" (lib.getExe xdg-dbus-proxy))
    (lib.mesonOption "system_fusermount" "/run/wrappers/bin/fusermount3")
    (lib.mesonOption "system_install_dir" "/var/lib/flatpak")
  ];

  makeFlags = [
    "installed_testdir=${placeholder "installedTests"}/libexec/installed-tests/flatpak"
    "installed_test_metadir=${placeholder "installedTests"}/share/installed-tests/flatpak"
  nativeCheckInputs = [
    polkit
    socat
    valgrind
  ];

  postPatch =
    let
      vsc-py = python3.pythonOnBuildForHost.withPackages (pp: [ pp.pyparsing ]);
    in
    ''
      patchShebangs buildutil
      patchShebangs tests
      PATH=${lib.makeBinPath [ vsc-py ]}:$PATH patchShebangs --build subprojects/variant-schema-compiler/variant-schema-compiler
  # TODO: Many issues with temporary files, FHS environments, timeouts, and our current patches
  doCheck = false;

      substituteInPlace configure.ac \
        --replace-fail '$BWRAP --' ${
          lib.escapeShellArg (stdenv.hostPlatform.emulator buildPackages + " $BWRAP --")
        } \
        --replace-fail '$DBUS_PROXY --' ${
          lib.escapeShellArg (stdenv.hostPlatform.emulator buildPackages + " $DBUS_PROXY --")
        }
    '';
  separateDebugInfo = true;

  passthru = {
    icon-validator-patch = substituteAll {
@@ -240,12 +223,8 @@ stdenv.mkDerivation (finalAttrs: {
      inherit (builtins) storeDir;
    };

    updateScript = nix-update-script { };

    tests = {
      cross = pkgsCross.aarch64-multiplatform.flatpak;

      installedTests = nixosTests.installed-tests.flatpak;
      pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage; };

      validate-icon = runCommand "test-icon-validation" { } ''
        ${finalAttrs.finalPackage}/libexec/flatpak-validate-icon \
@@ -257,6 +236,8 @@ stdenv.mkDerivation (finalAttrs: {

      version = testers.testVersion { package = finalAttrs.finalPackage; };
    };

    updateScript = nix-update-script { };
  };

  meta = {
@@ -267,5 +248,6 @@ stdenv.mkDerivation (finalAttrs: {
    maintainers = with lib.maintainers; [ getchoo ];
    mainProgram = "flatpak";
    platforms = lib.platforms.linux;
    pkgConfigModules = [ "flatpak" ];
  };
})
+0 −15
Original line number Diff line number Diff line
diff --git a/acinclude.m4 b/acinclude.m4
index 92ec3985..b3fccf1d 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -40,8 +40,8 @@ AC_DEFUN([JH_CHECK_XML_CATALOG],
 [
   AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl
   AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
-  if $jh_found_xmlcatalog && \
-     AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
+  # empty argument forces libxml to use XML_CATALOG_FILES variable
+  if AC_RUN_LOG([$XMLCATALOG --noout "" "$1" >&2]); then
     AC_MSG_RESULT([found])
     ifelse([$3],,,[$3
 ])dnl