diff --git a/pkgs/by-name/co/cosmic-bg/package.nix b/pkgs/by-name/co/cosmic-bg/package.nix index 5b6098a42f5f..61fe82b61528 100644 --- a/pkgs/by-name/co/cosmic-bg/package.nix +++ b/pkgs/by-name/co/cosmic-bg/package.nix @@ -1,65 +1,72 @@ { lib, stdenv, + stdenvAdapters, fetchFromGitHub, rustPlatform, + libcosmicAppHook, just, - pkg-config, - makeBinaryWrapper, - libxkbcommon, - wayland, + nasm, + nix-update-script, + + withMoldLinker ? stdenv.targetPlatform.isLinux, }: -rustPlatform.buildRustPackage rec { - pname = "cosmic-bg"; - version = "1.0.0-alpha.6"; +rustPlatform.buildRustPackage.override + { stdenv = if withMoldLinker then stdenvAdapters.useMoldLinker stdenv else stdenv; } + (finalAttrs: { + pname = "cosmic-bg"; + version = "1.0.0-alpha.6"; - src = fetchFromGitHub { - owner = "pop-os"; - repo = pname; - rev = "epoch-${version}"; - hash = "sha256-4b4laUXTnAbdngLVh8/dD144m9QrGReSEjRZoNR6Iks="; - }; + src = fetchFromGitHub { + owner = "pop-os"; + repo = "cosmic-bg"; + tag = "epoch-${finalAttrs.version}"; + hash = "sha256-4b4laUXTnAbdngLVh8/dD144m9QrGReSEjRZoNR6Iks="; + }; - useFetchCargoVendor = true; - cargoHash = "sha256-GLXooTjcGq4MsBNnlpHBBUJGNs5UjKMQJGJuj9UO2wk="; + useFetchCargoVendor = true; + cargoHash = "sha256-GLXooTjcGq4MsBNnlpHBBUJGNs5UjKMQJGJuj9UO2wk="; - postPatch = '' - substituteInPlace justfile --replace-fail '#!/usr/bin/env' "#!$(command -v env)" - ''; + nativeBuildInputs = [ + just + libcosmicAppHook + nasm + ]; - nativeBuildInputs = [ - just - pkg-config - makeBinaryWrapper - ]; - buildInputs = [ - libxkbcommon - wayland - ]; + dontUseJustBuild = true; + dontUseJustCheck = true; - dontUseJustBuild = true; + justFlags = [ + "--set" + "prefix" + (placeholder "out") + "--set" + "bin-src" + "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-bg" + ]; - justFlags = [ - "--set" - "prefix" - (placeholder "out") - "--set" - "bin-src" - "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-bg" - ]; + env."CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_RUSTFLAGS" = + lib.optionalString withMoldLinker "-C link-arg=-fuse-ld=mold"; - postInstall = '' - wrapProgram $out/bin/cosmic-bg \ - --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ wayland ]}" - ''; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version" + "unstable" + "--version-regex" + "epoch-(.*)" + ]; + }; - meta = with lib; { - homepage = "https://github.com/pop-os/cosmic-bg"; - description = "Applies Background for the COSMIC Desktop Environment"; - license = licenses.mpl20; - maintainers = with maintainers; [ nyabinary ]; - platforms = platforms.linux; - mainProgram = "cosmic-bg"; - }; -} + meta = { + homepage = "https://github.com/pop-os/cosmic-bg"; + description = "Applies Background for the COSMIC Desktop Environment"; + license = lib.licenses.mpl20; + maintainers = with lib.maintainers; [ + nyabinary + HeitorAugustoLN + ]; + platforms = lib.platforms.linux; + mainProgram = "cosmic-bg"; + }; + }) diff --git a/pkgs/by-name/co/cosmic-launcher/package.nix b/pkgs/by-name/co/cosmic-launcher/package.nix index 3db03c2d7c51..fba267328761 100644 --- a/pkgs/by-name/co/cosmic-launcher/package.nix +++ b/pkgs/by-name/co/cosmic-launcher/package.nix @@ -1,68 +1,70 @@ { lib, stdenv, + stdenvAdapters, fetchFromGitHub, rustPlatform, just, libcosmicAppHook, nix-update-script, + + withMoldLinker ? stdenv.targetPlatform.isLinux, }: -rustPlatform.buildRustPackage rec { - pname = "cosmic-launcher"; - version = "1.0.0-alpha.6"; +rustPlatform.buildRustPackage.override + { stdenv = if withMoldLinker then stdenvAdapters.useMoldLinker stdenv else stdenv; } + (finalAttrs: { + pname = "cosmic-launcher"; + version = "1.0.0-alpha.6"; - src = fetchFromGitHub { - owner = "pop-os"; - repo = "cosmic-launcher"; - tag = "epoch-${version}"; - hash = "sha256-BtYnL+qkM/aw+Air5yOKH098V+TQByM5mh1DX7v+v+s="; - }; + src = fetchFromGitHub { + owner = "pop-os"; + repo = "cosmic-launcher"; + tag = "epoch-${finalAttrs.version}"; + hash = "sha256-BtYnL+qkM/aw+Air5yOKH098V+TQByM5mh1DX7v+v+s="; + }; - useFetchCargoVendor = true; - cargoHash = "sha256-g7Qr3C8jQg65KehXAhftdXCpEukag0w12ClvZFkxfqs="; + useFetchCargoVendor = true; + cargoHash = "sha256-g7Qr3C8jQg65KehXAhftdXCpEukag0w12ClvZFkxfqs="; - nativeBuildInputs = [ - just - libcosmicAppHook - ]; - - dontUseJustBuild = true; - dontUseJustCheck = true; - - justFlags = [ - "--set" - "prefix" - (placeholder "out") - "--set" - "bin-src" - "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"; - - passthru.updateScript = nix-update-script { - extraArgs = [ - "--version" - "unstable" - "--version-regex" - "epoch-(.*)" + nativeBuildInputs = [ + just + libcosmicAppHook ]; - }; - meta = { - homepage = "https://github.com/pop-os/cosmic-launcher"; - description = "Launcher for the COSMIC Desktop Environment"; - mainProgram = "cosmic-launcher"; - license = lib.licenses.gpl3Only; - maintainers = with lib.maintainers; [ - nyabinary - HeitorAugustoLN + dontUseJustBuild = true; + dontUseJustCheck = true; + + justFlags = [ + "--set" + "prefix" + (placeholder "out") + "--set" + "bin-src" + "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-launcher" ]; - platforms = lib.platforms.linux; - }; -} + + 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 = [ + "--version" + "unstable" + "--version-regex" + "epoch-(.*)" + ]; + }; + + meta = { + homepage = "https://github.com/pop-os/cosmic-launcher"; + description = "Launcher for the COSMIC Desktop Environment"; + mainProgram = "cosmic-launcher"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ + nyabinary + HeitorAugustoLN + ]; + platforms = lib.platforms.linux; + }; + }) diff --git a/pkgs/by-name/co/cosmic-randr/package.nix b/pkgs/by-name/co/cosmic-randr/package.nix index 92e96e25c270..e8115fad0f15 100644 --- a/pkgs/by-name/co/cosmic-randr/package.nix +++ b/pkgs/by-name/co/cosmic-randr/package.nix @@ -1,65 +1,73 @@ { lib, stdenv, + stdenvAdapters, fetchFromGitHub, rustPlatform, just, pkg-config, wayland, nix-update-script, + + withMoldLinker ? stdenv.targetPlatform.isLinux, }: -rustPlatform.buildRustPackage rec { - pname = "cosmic-randr"; - version = "1.0.0-alpha.6"; +rustPlatform.buildRustPackage.override + { stdenv = if withMoldLinker then stdenvAdapters.useMoldLinker stdenv else stdenv; } + (finalAttrs: { + pname = "cosmic-randr"; + version = "1.0.0-alpha.6"; - src = fetchFromGitHub { - owner = "pop-os"; - repo = "cosmic-randr"; - tag = "epoch-${version}"; - hash = "sha256-Sqxe+vKonsK9MmJGtbrZHE7frfrjkHXysm0WQt7WSU4="; - }; + src = fetchFromGitHub { + owner = "pop-os"; + repo = "cosmic-randr"; + tag = "epoch-${finalAttrs.version}"; + hash = "sha256-Sqxe+vKonsK9MmJGtbrZHE7frfrjkHXysm0WQt7WSU4="; + }; - useFetchCargoVendor = true; - cargoHash = "sha256-UQ/fhjUiniVeHRQYulYko4OxcWB6UhFuxH1dVAfAzIY="; + useFetchCargoVendor = true; + cargoHash = "sha256-UQ/fhjUiniVeHRQYulYko4OxcWB6UhFuxH1dVAfAzIY="; - nativeBuildInputs = [ - just - pkg-config - ]; - - buildInputs = [ wayland ]; - - dontUseJustBuild = true; - dontUseJustCheck = true; - - justFlags = [ - "--set" - "prefix" - (placeholder "out") - "--set" - "bin-src" - "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-randr" - ]; - - passthru.updateScript = nix-update-script { - extraArgs = [ - "--version" - "unstable" - "--version-regex" - "epoch-(.*)" + nativeBuildInputs = [ + just + pkg-config ]; - }; - meta = { - homepage = "https://github.com/pop-os/cosmic-randr"; - description = "Library and utility for displaying and configuring Wayland outputs"; - license = lib.licenses.mpl20; - maintainers = with lib.maintainers; [ - nyabinary - HeitorAugustoLN + buildInputs = [ wayland ]; + + dontUseJustBuild = true; + dontUseJustCheck = true; + + justFlags = [ + "--set" + "prefix" + (placeholder "out") + "--set" + "bin-src" + "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-randr" ]; - platforms = lib.platforms.linux; - mainProgram = "cosmic-randr"; - }; -} + + env."CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_RUSTFLAGS" = + lib.optionalString withMoldLinker "-C link-arg=-fuse-ld=mold"; + + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version" + "unstable" + "--version-regex" + "epoch-(.*)" + ]; + }; + + meta = { + homepage = "https://github.com/pop-os/cosmic-randr"; + description = "Library and utility for displaying and configuring Wayland outputs"; + license = lib.licenses.mpl20; + maintainers = with lib.maintainers; [ + nyabinary + HeitorAugustoLN + ]; + platforms = lib.platforms.linux; + mainProgram = "cosmic-randr"; + }; + })