Unverified Commit 18c956d3 authored by Donovan Glover's avatar Donovan Glover Committed by GitHub
Browse files

cosmic-store: refactor (#385376)

parents 784d9197 4cd8b583
Loading
Loading
Loading
Loading
+20 −65
Original line number Diff line number Diff line
@@ -2,25 +2,14 @@
  lib,
  stdenv,
  fetchFromGitHub,
  nix-update-script,
  rustPlatform,
  appstream,
  makeBinaryWrapper,
  cosmic-icons,
  glib,
  just,
  libcosmicAppHook,
  pkg-config,
  libglvnd,
  libxkbcommon,
  libinput,
  fontconfig,
  just,
  glib,
  flatpak,
  freetype,
  openssl,
  wayland,
  xorg,
  vulkan-loader,
  vulkan-validation-layers,
  nix-update-script,
}:

rustPlatform.buildRustPackage rec {
@@ -32,38 +21,25 @@ rustPlatform.buildRustPackage rec {
    repo = "cosmic-store";
    tag = "epoch-${version}";
    hash = "sha256-ce7PaHBhRFUoujAS6j10XWbD2PxzK6XXIk/ENclT1iY=";
    fetchSubmodules = true;
  };

  useFetchCargoVendor = true;
  cargoHash = "sha256-kPCE6F8/UsTJOmIjwxBLISk/Jhfljwa666WhXuKkkDE=";

  postPatch = ''
    substituteInPlace justfile --replace '#!/usr/bin/env' "#!$(command -v env)"
  '';

  nativeBuildInputs = [
    just
    pkg-config
    makeBinaryWrapper
    libcosmicAppHook
  ];

  buildInputs = [
    appstream
    glib
    libxkbcommon
    libinput
    libglvnd
    fontconfig
    flatpak
    freetype
    openssl
    xorg.libX11
    wayland
    vulkan-loader
    vulkan-validation-layers
  ];

  dontUseJustBuild = true;
  dontUseJustCheck = true;

  justFlags = [
    "--set"
@@ -74,47 +50,26 @@ rustPlatform.buildRustPackage rec {
    "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-store"
  ];

  # 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"
  ];

  # LD_LIBRARY_PATH can be removed once tiny-xlib is bumped above 0.2.2
  postInstall = ''
    wrapProgram "$out/bin/cosmic-store" \
      --suffix XDG_DATA_DIRS : "${cosmic-icons}/share" \
      --prefix LD_LIBRARY_PATH : ${
        lib.makeLibraryPath [
          xorg.libX11
          xorg.libXcursor
          xorg.libXi
          xorg.libXrandr
          libxkbcommon
          vulkan-loader
        ]
      }
  '';

  env.VERGEN_GIT_COMMIT_DATE = "2025-02-21";
  env.VERGEN_GIT_SHA = src.rev;

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

  meta = with lib; {
  meta = {
    homepage = "https://github.com/pop-os/cosmic-store";
    description = "App Store for the COSMIC Desktop Environment";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [
      ahoneybun
      nyabinary
      HeitorAugustoLN
    ];
    platforms = platforms.linux;
    platforms = lib.platforms.linux;
  };
}