Skip to content

libe-book: fix cross-compilation#419393

Merged
7c6f434c merged 1 commit intoNixOS:masterfrom
synalice-forks:libe-book-fix-cross-comp
Jun 25, 2025
Merged

libe-book: fix cross-compilation#419393
7c6f434c merged 1 commit intoNixOS:masterfrom
synalice-forks:libe-book-fix-cross-comp

Conversation

@synalice
Copy link
Contributor

@synalice synalice commented Jun 23, 2025

Closes #419355.

Fix broken cross-compilation.

What's been tested:

nix-build -I nixpkgs=channel:nixos-unstable -E 'let pkgs = import <nixpkgs> { }; in pkgs.callPackage ./pkgs/by-name/li/libe-book/package.nix { }'
nix-build -I nixpkgs=channel:nixos-unstable -E 'let pkgs = import <nixpkgs> { crossSystem = { config = "aarch64-unknown-linux-gnu"; }; }; in pkgs.callPackage ./pkgs/by-name/li/libe-book/package.nix { }'
nom-build -I nixpkgs=channel:nixos-unstable -E 'let pkgs = import <nixpkgs> { crossSystem = { config = "riscv64-linux"; }; }; in pkgs.callPackage ./pkgs/by-name/li/libe-book/package.nix { }'

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Nixpkgs 25.11 Release Notes (or backporting 24.11 and 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 24.11 and 25.05 NixOS Release notes)
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other contributing documentation in corresponding paths.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Jun 23, 2025
@github-actions github-actions bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. labels Jun 23, 2025
@nix-owners nix-owners bot requested a review from 7c6f434c June 23, 2025 22:01
@synalice synalice force-pushed the libe-book-fix-cross-comp branch from b2428e4 to c1a72c4 Compare June 23, 2025 22:24
What's been tested:

```
nix-build -I nixpkgs=channel:nixos-unstable -E 'let pkgs = import <nixpkgs> { }; in pkgs.callPackage ./pkgs/by-name/li/libe-book/package.nix { }'
```
```
nix-build -I nixpkgs=channel:nixos-unstable -E 'let pkgs = import <nixpkgs> { crossSystem = { config = "aarch64-unknown-linux-gnu"; }; }; in pkgs.callPackage ./pkgs/by-name/li/libe-book/package.nix { }'
```
```
nom-build -I nixpkgs=channel:nixos-unstable -E 'let pkgs = import <nixpkgs> { crossSystem = { config = "riscv64-linux"; }; }; in pkgs.callPackage ./pkgs/by-name/li/libe-book/package.nix { }'
```
@synalice synalice force-pushed the libe-book-fix-cross-comp branch from c1a72c4 to cd3c21e Compare June 23, 2025 22:26
Copy link
Member

@SFrijters SFrijters left a comment

Choose a reason for hiding this comment

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

This fixes nix-build -A pkgsCross.aarch64-multiplatform.libe-book for me.

Maybe consider adding strictDeps = true; to prevent regressions.

@synalice
Copy link
Contributor Author

nix-build -A pkgsCross.aarch64-multiplatform.libe-book

Don't tell me all this time I could have just used this short command instead of -I and -E 💀

Maybe consider adding strictDeps = true; to prevent regressions.

Am I tripping or is there nothing about this attribute in the Nixpkgs Manual? Where can I read more about this attribute?

@SFrijters
Copy link
Member

nix-build -A pkgsCross.aarch64-multiplatform.libe-book

Don't tell me all this time I could have just used this short command instead of -I and -E 💀

Haha, maybe, I'm not sure if there are subtle differences to what you did.

Maybe consider adding strictDeps = true; to prevent regressions.

Am I tripping or is there nothing about this attribute in the Nixpkgs Manual? Where can I read more about this attribute?

Hm, yeah, it seems to be one of those things. I guess #178468 is something you could check out?

In broad strokes and as far as I understand it, buildInputs and nativeBuildInputs are used together for native compilation and only used separately for cross-compilation. Until and unless strictDepsByDefault is enabled, setting strictDeps = true; for an individual derivation makes sure that native compilation also treats buildInputs and nativeBuildInputs separately for that derivation.

So, if you put strictDeps = true; in the current libe-book derivation, without your fix, you can observe that even nix-build -A libe-book will fail and in that way it will help prevent future issues since a build failure is more easily detected.

@7c6f434c
Copy link
Member

7c6f434c commented Jun 24, 2025

Don't tell me all this time I could have just used this short command instead of -I and -E 💀

I assume that needs NIX_PATH pointing to a Nixpkgs checkout as the main Nixpkgs copy, and then the branches, шncluding the channel-tracking branches if wanted, can be switched as needed.

ETA: this also allows to test fixes to mltiple packages at once.

@7c6f434c
Copy link
Member

I guess it is fine to merge as is then later add strictDeps in multiple places

@7c6f434c 7c6f434c merged commit 6c075ca into NixOS:master Jun 25, 2025
26 of 27 checks passed
@synalice synalice deleted the libe-book-fix-cross-comp branch June 28, 2025 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build failure: libe-book (cross-compilation)

3 participants