1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-14 18:21:41 +03:00
mobile-nixos/modules/cross-workarounds.nix
Samuel Dionne-Riel b07dc19062 cross-workarounds: Don't apply overlay on pkgsBuildBuild
As described near the change, this would cause qemu to become an overly
costly build.
2021-03-07 17:52:04 -05:00

45 lines
1.6 KiB
Nix

{ config, lib, pkgs, ... }:
# 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;
AArch32Overlay = final: super:
# Ensure pkgsBuildBuild ends up unmodified, otherwise the canary test will
# get super expensive to build.
if super.stdenv.buildPlatform == super.stdenv.hostPlatform then {} else {
# Works around libselinux failure with python on armv7l.
# LONG_BIT definition appears wrong for platform
libselinux = (super.libselinux
.override({
enablePython = false;
}))
.overrideAttrs (_: {
preInstall = ":";
})
;
};
in
lib.mkIf isCross
{
# building '/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-fc-cache.drv'...
# [...]-fontconfig-2.10.2-aarch64-unknown-linux-gnu-bin/bin/fc-cache: cannot execute binary file: Exec format error
fonts.fontconfig.enable = false;
# building '/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-mesa-19.3.3-aarch64-unknown-linux-gnu.drv'...
# meson.build:1537:2: ERROR: Dependency "wayland-scanner" not found, tried pkgconfig
security.polkit.enable = false;
# udisks fails due to gobject-introspection being not cross-compilation friendly.
services.udisks2.enable = false;
nixpkgs.overlays = lib.mkMerge [
(lib.mkIf config.nixpkgs.crossSystem.isAarch32 [ AArch32Overlay ])
];
}