Unverified Commit 63a365d8 authored by Heitor Augusto's avatar Heitor Augusto
Browse files

cosmic-launcher: use mold linker

parent ad42512f
Loading
Loading
Loading
Loading
+52 −50
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  stdenvAdapters,
  fetchFromGitHub,
  rustPlatform,
  just,
  libcosmicAppHook,
  nix-update-script,

  withMoldLinker ? stdenv.targetPlatform.isLinux,
}:

rustPlatform.buildRustPackage rec {
rustPlatform.buildRustPackage.override
  { stdenv = if withMoldLinker then stdenvAdapters.useMoldLinker stdenv else stdenv; }
  rec {
    pname = "cosmic-launcher";
    version = "1.0.0-alpha.6";

@@ -39,11 +44,8 @@ rustPlatform.buildRustPackage rec {
      "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-launcher"
    ];

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

  env."CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_RUSTFLAGS" = "--cfg tokio_unstable";
    env."CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_RUSTFLAGS" =
      "--cfg tokio_unstable${lib.optionalString withMoldLinker " -C link-arg=-fuse-ld=mold"}";

    passthru.updateScript = nix-update-script {
      extraArgs = [