-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
Closed
Labels
0.kind: bugSomething is brokenSomething is broken6.topic: cross-compilationBuilding packages on a different platform than they will be used onBuilding packages on a different platform than they will be used on6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOSIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS
Description
Describe the bug
Derivations defined with pkgs are not compatible with cross compilation as defined in Nixpkgs manual.
This is the case for all derivation defined in NixOS modules.
Steps To Reproduce
Following derivation fails to build, since pkgs is used:
with (import <nixpkgs> { crossSystem.system = "aarch64-linux"; });
runCommand "bad" { nativeBuildInputs = [ jq ]; } "jq > $out"Following dervation builds, since __splicedPackages is used:
with (import <nixpkgs> { crossSystem.system = "aarch64-linux"; }).__splicedPackages;
runCommand "good" { nativeBuildInputs = [ jq ]; } "jq > $out"The NixOS module system uses not __splicedPackages and therefor all derivations defined with pkgs which depends on nativeBuildInputs will fail to cross compile.
Workaround
Select the package by hand and do not use stdenv cross compilation automatism:
with (import <nixpkgs> { crossSystem.system = "aarch64-linux"; });
runCommand "workaround" { } "${pkgsBuildBuild.jq}/bin/jq > $out"Expected behavior
Derivations defined in NixOS modules can be cross compiled.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
0.kind: bugSomething is brokenSomething is broken6.topic: cross-compilationBuilding packages on a different platform than they will be used onBuilding packages on a different platform than they will be used on6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOSIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS