2021-01-02 10:00:04 +03:00
|
|
|
{ config, lib, pkgs, ... }:
|
2020-03-14 05:29:43 +03:00
|
|
|
|
|
|
|
# This module adds system-level workarounds when cross-compiling.
|
|
|
|
# These workarounds are only expected to be implemented for the *basic* build.
|
|
|
|
# That is `nix-build ./default.nix`, without additional configuration.
|
|
|
|
let
|
|
|
|
isCross =
|
|
|
|
config.nixpkgs.crossSystem != null &&
|
|
|
|
config.nixpkgs.localSystem.system != null &&
|
|
|
|
config.nixpkgs.crossSystem.system != config.nixpkgs.localSystem.system;
|
2022-09-27 06:42:22 +03:00
|
|
|
nullPackage = pkgs.runCommand "null" {} ''
|
2022-05-24 00:36:58 +03:00
|
|
|
mkdir -p $out
|
|
|
|
'';
|
2020-03-14 05:29:43 +03:00
|
|
|
in
|
2022-05-24 00:36:19 +03:00
|
|
|
lib.mkIf isCross (lib.mkMerge [
|
|
|
|
|
|
|
|
# All cross-compilation
|
2020-03-14 05:29:43 +03:00
|
|
|
{
|
2022-10-10 10:55:52 +03:00
|
|
|
|
|
|
|
# Some Network Manager plugins are kinda problematic...
|
|
|
|
# Let's ignore them for now.
|
|
|
|
# Cross-compilation of Mobile NixOS for the time being is not fully-featured.
|
|
|
|
# If those plugins are needed, do a native build.
|
|
|
|
networking.networkmanager.plugins = lib.mkForce [];
|
2022-05-24 00:36:19 +03:00
|
|
|
}
|
2021-01-02 10:00:04 +03:00
|
|
|
|
2022-05-24 00:36:19 +03:00
|
|
|
# 32 bit ARM
|
|
|
|
(lib.mkIf config.nixpkgs.crossSystem.isAarch32 {
|
|
|
|
nixpkgs.overlays = [
|
|
|
|
(final: super:
|
|
|
|
# Ensure pkgsBuildBuild ends up unmodified, otherwise the canary test will
|
|
|
|
# get super expensive to build.
|
2022-05-24 01:26:14 +03:00
|
|
|
if super.stdenv.buildPlatform == super.stdenv.hostPlatform
|
|
|
|
then {}
|
|
|
|
else {
|
|
|
|
# btrfs-progs-armv7l-unknown-linux-gnueabihf-5.17.drv
|
|
|
|
# /nix/store/wnrc4daqbd6v5ifqlxsj75ky8556zy0p-python3-3.9.12/include/python3.9/pyport.h:741:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
|
|
|
|
btrfs-progs = lib.warn "btrfs-progs neutered due to broken build with cross armv7l" nullPackage;
|
|
|
|
}
|
|
|
|
)
|
2021-01-02 10:00:04 +03:00
|
|
|
];
|
2022-05-24 00:36:19 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
])
|