Skip to content

libcosmicAppHook: use RUSTFLAGS instead of platform specific flags#464981

Merged
Aleksanaa merged 1 commit intoNixOS:masterfrom
Aleksanaa:cosmic-app-fix
Nov 26, 2025
Merged

libcosmicAppHook: use RUSTFLAGS instead of platform specific flags#464981
Aleksanaa merged 1 commit intoNixOS:masterfrom
Aleksanaa:cosmic-app-fix

Conversation

@Aleksanaa
Copy link
Copy Markdown
Member

This ensures these flags are picked up correctly, after latest rust update. We can revert this if we solve the root cause later.

See #464392

Temporary fix? But a fix, anyway. Tested cosmic-settings and cosmic-edit, the rpath and NEEDED libraries for libEGL.so.1 and others are added correctly.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

This ensures these flags are picked up correctly, after latest rust
update. We can revert this if we solve the root cause later.

See NixOS#464392
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". 6.topic: COSMIC COSMIC is a software platform for designing beautiful user experiences labels Nov 25, 2025

# Temporarily use this simpler solution, it should work for simple cross compilation
# https://github.com/NixOS/nixpkgs/issues/464392
local flags="RUSTFLAGS"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it will? It'll cause build scripts to try to link a bunch of libraries that won't be present for the build platform.

We need to understand what's actually changed here and why.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the --target flag (or build.target) is used, then the flags will only be passed to the compiler for the target. Things being built for the host, such as build scripts or proc macros, will not receive the args. Without --target, the flags will be passed to all compiler invocations (including build scripts and proc macros) because dependencies are shared. If you have args that you do not want to pass to build scripts or proc macros and are building for the host, pass --target with the host triple.

Okay, so we just end up with extra linkage on build scripts and proc macros. That would still be best avoided, and so we should still be using the target-specific variables across the board once we figure out how to make them work again, but it's not urgent.

@thefossguy
Copy link
Copy Markdown
Member

@ofborg test cosmic

@Pandapip1 Pandapip1 added the backport release-25.11 Backport PR automatically label Nov 25, 2025
@Pandapip1
Copy link
Copy Markdown
Member

If this does fix the issue it should be backported

@Pandapip1
Copy link
Copy Markdown
Member

I can confirm that nixosTests.cosmic passes with this PR

@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Nov 25, 2025
@Aleksanaa Aleksanaa added this pull request to the merge queue Nov 26, 2025
@Aleksanaa Aleksanaa removed this pull request from the merge queue due to a manual request Nov 26, 2025
@Aleksanaa Aleksanaa added this pull request to the merge queue Nov 26, 2025
Merged via the queue into NixOS:master with commit 2fdc81f Nov 26, 2025
40 of 44 checks passed
@Aleksanaa Aleksanaa deleted the cosmic-app-fix branch November 26, 2025 01:25
@nixpkgs-ci
Copy link
Copy Markdown
Contributor

nixpkgs-ci bot commented Nov 26, 2025

Successfully created backport PR for release-25.11:

@github-actions github-actions bot added the 8.has: port to stable This PR already has a backport to the stable release. label Nov 26, 2025
@brianmcgillion brianmcgillion mentioned this pull request Dec 1, 2025
13 tasks
brianmcgillion added a commit to tiiuae/nixpkgs that referenced this pull request Dec 3, 2025
…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>
@brianmcgillion brianmcgillion mentioned this pull request Dec 5, 2025
13 tasks
brianmcgillion added a commit to tiiuae/nixpkgs that referenced this pull request Dec 7, 2025
…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>
brianmcgillion added a commit to tiiuae/nixpkgs that referenced this pull request Dec 11, 2025
…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>
@brianmcgillion brianmcgillion mentioned this pull request Dec 11, 2025
13 tasks
brianmcgillion added a commit to tiiuae/nixpkgs that referenced this pull request Dec 13, 2025
…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>
brianmcgillion added a commit to tiiuae/nixpkgs that referenced this pull request Dec 16, 2025
…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>
brianmcgillion added a commit to tiiuae/nixpkgs that referenced this pull request Dec 31, 2025
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". 6.topic: COSMIC COSMIC is a software platform for designing beautiful user experiences 8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. backport release-25.11 Backport PR automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants