Unverified Commit a1b73116 authored by Heitor Augusto's avatar Heitor Augusto
Browse files

cosmic-comp: use libcosmicAppHook

parent c9247310
Loading
Loading
Loading
Loading
+10 −41
Original line number Diff line number Diff line
@@ -3,20 +3,17 @@
  stdenv,
  rustPlatform,
  fetchFromGitHub,
  makeBinaryWrapper,
  pixman,
  libcosmicAppHook,
  pkg-config,
  libinput,
  libglvnd,
  libxkbcommon,
  libgbm,
  libinput,
  pixman,
  seatd,
  udev,
  xwayland,
  wayland,
  xorg,
  useXWayland ? true,
  systemd,

  useXWayland ? true,
  useSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
}:

@@ -37,34 +34,21 @@ rustPlatform.buildRustPackage (finalAttrs: {
  separateDebugInfo = true;

  nativeBuildInputs = [
    makeBinaryWrapper
    libcosmicAppHook
    pkg-config
  ];

  buildInputs = [
    libglvnd
    libinput
    libxkbcommon
    libgbm
    libinput
    pixman
    seatd
    udev
    wayland
  ] ++ lib.optional useSystemd systemd;

  # Only default feature is systemd
  buildNoDefaultFeatures = !useSystemd;

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

  makeFlags = [
    "prefix=${placeholder "out"}"
    "CARGO_TARGET_DIR=target/${stdenv.hostPlatform.rust.cargoShortTarget}"
@@ -72,23 +56,8 @@ rustPlatform.buildRustPackage (finalAttrs: {

  dontCargoInstall = true;

  # These libraries are only used by the X11 backend, which will not
  # be the common case, so just make them available, don't link them.
  postInstall =
    ''
      wrapProgramArgs=(--prefix LD_LIBRARY_PATH : ${
        lib.makeLibraryPath [
          xorg.libX11
          xorg.libXcursor
          xorg.libXi
        ]
      })
    ''
    + lib.optionalString useXWayland ''
      wrapProgramArgs+=(--prefix PATH : ${lib.makeBinPath [ xwayland ]})
    ''
    + ''
      wrapProgram $out/bin/cosmic-comp "''${wrapProgramArgs[@]}"
  preFixup = lib.optionalString useXWayland ''
    libcosmicAppWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ xwayland ]})
  '';

  meta = {