Unverified Commit 8ccc2513 authored by Masum Reza's avatar Masum Reza Committed by GitHub
Browse files

xdg-desktop-portal-cosmic: 1.0.0-alpha.5.1 -> 1.0.0-alpha.6 (#386198)

parents e09eae7b a7cb4b51
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ rustPlatform.buildRustPackage rec {
    (placeholder "out")
  ];

  env.XDP_COSMIC = lib.getExe xdg-desktop-portal-cosmic;
  env.XDP_COSMIC = "${xdg-desktop-portal-cosmic}/libexec/xdg-desktop-portal-cosmic";

  passthru.providedSessions = [ "cosmic" ];

+56 −34
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  rustPlatform,
  fetchFromGitHub,
  gst_all_1,
  libgbm,
  fetchpatch,
  libcosmicAppHook,
  pkg-config,
  libglvnd,
  libxkbcommon,
  util-linux,
  libgbm,
  pipewire,
  wayland,
  gst_all_1,
  coreutils,
  nix-update-script,
}:

rustPlatform.buildRustPackage rec {
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "xdg-desktop-portal-cosmic";
  version = "1.0.0-alpha.5.1";
  version = "1.0.0-alpha.6";

  src = fetchFromGitHub {
    owner = "pop-os";
    repo = "xdg-desktop-portal-cosmic";
    rev = "epoch-${version}";
    hash = "sha256-wff805IIXrXC/kn5l4HrYenxNRTGDYHPmT7qTTtBi/c=";
    tag = "epoch-${finalAttrs.version}";
    hash = "sha256-ymBmnSEXGCNbLTIVzHP3tjKAG0bgvEFU1C8gnxiow98=";
  };

  env.VERGEN_GIT_COMMIT_DATE = "2025-01-14";
  env.VERGEN_GIT_SHA = src.rev;
  env = {
    VERGEN_GIT_COMMIT_DATE = "2025-02-20";
    VERGEN_GIT_SHA = finalAttrs.src.rev;
  };

  useFetchCargoVendor = true;
  cargoHash = "sha256-Dwlow5nUl7qHLfu4Acic2CRCJViylpPLyLBVtBgWd9A=";
  cargoHash = "sha256-FO/GIzv9XVu8SSV+JbOf98UX/XriRgqTthtzvRIWNjo=";

  separateDebugInfo = true;

  nativeBuildInputs = [
    libcosmicAppHook
    rustPlatform.bindgenHook
    pkg-config
    util-linux
  ];

  buildInputs = [
    libglvnd
    libxkbcommon
    libgbm
    pipewire
    wayland
  ];

  checkInputs = [ gst_all_1.gstreamer ];

  # Force linking to libEGL, which is always dlopen()ed, and to
  # libwayland-client, which is always dlopen()ed except by the
  # obscure winit backend.
  RUSTFLAGS = map (a: "-C link-arg=${a}") [
    "-Wl,--push-state,--no-as-needed"
    "-lEGL"
    "-lwayland-client"
    "-Wl,--pop-state"
  # TODO: Remove this when updating to the next version
  patches = [
    (fetchpatch {
      name = "cosmic-portal-fix-examples-after-ashpd-api-update.patch";
      url = "https://github.com/pop-os/xdg-desktop-portal-cosmic/commit/df831ce7a48728aa9094fa1f30aed61cf1cc6ac3.diff?full_index=1";
      hash = "sha256-yRrB3ds9TtN1OBZEZbnE6h2fkPyP4PP2IJ17n+0ugEo=";
    })
  ];

  postInstall = ''
    mkdir -p $out/share/{dbus-1/services,icons,xdg-desktop-portal/portals}
    cp -r data/icons $out/share/icons/hicolor
    cp data/*.service $out/share/dbus-1/services/
    cp data/cosmic-portals.conf $out/share/xdg-desktop-portal/
    cp data/cosmic.portal $out/share/xdg-desktop-portal/portals/
  # Also modifies the functionality by replacing 'false' with 'true' to enable the portal to start properly.
  postPatch = ''
    substituteInPlace data/org.freedesktop.impl.portal.desktop.cosmic.service \
      --replace-fail 'Exec=/bin/false' 'Exec=${lib.getExe' coreutils "true"}'
  '';

  meta = with lib; {
  dontCargoInstall = true;

  makeFlags = [
    "prefix=${placeholder "out"}"
    "CARGO_TARGET_DIR=target/${stdenv.hostPlatform.rust.cargoShortTarget}"
  ];

  passthru.updateScript = nix-update-script {
    extraArgs = [
      "--version"
      "unstable"
      "--version-regex"
      "epoch-(.*)"
    ];
  };

  meta = {
    homepage = "https://github.com/pop-os/xdg-desktop-portal-cosmic";
    description = "XDG Desktop Portal for the COSMIC Desktop Environment";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ nyabinary ];
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [
      nyabinary
      HeitorAugustoLN
    ];
    mainProgram = "xdg-desktop-portal-cosmic";
    platforms = platforms.linux;
    platforms = lib.platforms.linux;
  };
}
})