Skip to content

Commit f55d8d3

Browse files
Revert "libcosmicAppHook: use RUSTFLAGS instead of platform specific flags (NixOS#464981)"
This reverts commit d2c6221. PR NixOS#464981 changed libcosmicAppHook to use the global RUSTFLAGS instead of target-specific CARGO_TARGET_*_RUSTFLAGS as a workaround for issue PR NixOS#464392. However, this broke cross-compilation for packages using the crabtime procedural macro (like cosmic-initial-setup). The root cause was that buildRustPackage was always setting env.RUSTFLAGS, which shadowed the target-specific flags. This has been fixed in commit PR NixOS#464707, which only sets RUSTFLAGS when explicitly needed. Fixes cross-compilation of cosmic-initial-setup and other cosmic packages that use crabtime proc macros. Signed-off-by: Brian McGillion <bmg.avoin@gmail.com>
1 parent 40097c2 commit f55d8d3

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

pkgs/by-name/li/libcosmicAppHook/libcosmic-app-hook.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ libcosmicAppVergenHook() {
1515

1616
libcosmicAppLinkerArgsHook() {
1717
# Force linking to certain libraries like libEGL, which are always dlopen()ed
18-
# local flags="CARGO_TARGET_@cargoLinkerVar@_RUSTFLAGS"
19-
20-
# Temporarily use this simpler solution, it should work for simple cross compilation
21-
# https://github.com/NixOS/nixpkgs/issues/464392
22-
local flags="RUSTFLAGS"
18+
local flags="CARGO_TARGET_@cargoLinkerVar@_RUSTFLAGS"
2319

2420
export "$flags"="${!flags-} -C link-arg=-Wl,--push-state,--no-as-needed"
2521
# shellcheck disable=SC2043

pkgs/by-name/li/libcosmicAppHook/package.nix

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ makeSetupHook {
5757
lib.makeSearchPath "share" (
5858
lib.optionals includeSettings [ fallbackThemes ] ++ [ targetPackages.cosmic-icons or cosmic-icons ]
5959
);
60-
# Temporarily using RUSTFLAGS: https://github.com/NixOS/nixpkgs/issues/464392
61-
# See ./libcosmic-app-hook.sh
62-
# cargoLinkerVar = targetPackages.stdenv.hostPlatform.rust.cargoEnvVarTarget;
63-
60+
cargoLinkerVar = targetPackages.stdenv.hostPlatform.rust.cargoEnvVarTarget;
6461
# force linking for all libraries that may be dlopen'd by libcosmic/iced apps
6562
cargoLinkLibs = lib.escapeShellArgs (
6663
[

0 commit comments

Comments
 (0)