2023-02-07 09:46:13 +00:00
# cross compiling
# - for edge-casey things (e.g. `mesonEmulatorHook`, `depsBuildBuild`), see in nixpkgs:
# `git show da9a9a440415b236f22f57ba67a24ab3fb53f595`
2023-02-08 22:30:27 +00:00
#
# build a particular package as evaluated here with:
# - toplevel: `nix build '.#host-pkgs.moby-cross.xdg-utils'`
# - scoped: `nix build '.#host-pkgs.moby-cross.gnome.mutter'`
# - python: `nix build '.#host-pkgs.moby-cross.python310Packages.pandas'`
# - perl: `nix build '.#host-pkgs.moby-cross.perl536Packages.ModuleBuild'`
# - qt: `nix build '.#host-pkgs.moby-cross.libsForQt5.qtbase'`
# most of these can be built in a nixpkgs source root like:
# - `nix build '.#pkgsCross.aarch64-multiplatform.xdg-utils'`
#
# tracking issues, PRs:
# - libuv tests fail: <https://github.com/NixOS/nixpkgs/issues/190807>
# - last checked: 2023-02-07
# - opened: 2022-09-11
# - perl Module Build broken: <https://github.com/NixOS/nixpkgs/issues/66741>
# - last checked: 2023-02-07
# - opened: 2019-08
# - perl536Packages.Testutf8 fails to cross: <https://github.com/NixOS/nixpkgs/issues/198548>
# - last checked: 2023-02-07
# - opened: 2022-10
# - python310Packages.psycopg2: <https://github.com/NixOS/nixpkgs/issues/210265>
# - last checked: 2023-02-06
# - i have a potential fix:
# """
# i was able to just add `postgresql` to the `buildInputs` (so that it's in both `buildInputs` and `nativeBuildInputs`):
# it fixed the build for `pkgsCross.aarch64-multiplatform.python310Packages.psycopg2` but not for `armv7l-hf-multiplatform` that this issue description calls out.
#
# also i haven't deployed it yet to make sure this doesn't cause anything funky at runtime though.
# """
2023-02-07 09:46:13 +00:00
2023-02-06 22:41:32 +00:00
{ config , lib , pkgs , . . . }:
2023-01-11 08:56:06 +00:00
2023-01-13 04:39:20 +00:00
let
2023-02-05 19:36:42 +00:00
# these are the overlays which we *also* pass through to the cross and emulated package sets.
# TODO: refactor to not specify same overlay in multiple places (here and flake.nix).
overlays = [
( import ./../../overlays/pkgs.nix )
( import ./../../overlays/pins.nix )
] ;
mkCrossFrom = localSystem : pkgs :
import pkgs . path {
inherit localSystem ; # localSystem is equivalent to buildPlatform
crossSystem = pkgs . stdenv . hostPlatform . system ;
inherit ( config . nixpkgs ) config ;
inherit overlays ;
} ;
mkEmulated = pkgs :
import pkgs . path {
localSystem = pkgs . stdenv . hostPlatform . system ;
inherit ( config . nixpkgs ) config ;
inherit overlays ;
} ;
2023-01-13 04:39:20 +00:00
in
2023-01-11 08:56:06 +00:00
{
2023-02-06 22:41:32 +00:00
# options = {
# perlPackageOverrides = lib.mkOption {
# };
# };
2023-02-05 19:36:42 +00:00
2023-02-06 22:41:32 +00:00
config = {
# the configuration of which specific package set `pkgs.cross` refers to happens elsewhere;
# here we just define them all.
nixpkgs . overlays = [
( next : prev : rec {
# non-emulated packages build *from* local *for* target.
# for large packages like the linux kernel which are expensive to build under emulation,
# the config can explicitly pull such packages from `pkgs.cross` to do more efficient cross-compilation.
crossFrom . " x 8 6 _ 6 4 - l i n u x " = mkCrossFrom " x 8 6 _ 6 4 - l i n u x " prev ;
crossFrom . " a a r c h 6 4 - l i n u x " = mkCrossFrom " a a r c h 6 4 - l i n u x " prev ;
emulated = mkEmulated prev ;
} )
( next : prev :
let
emulated = prev . emulated ;
in {
# packages which don't cross compile
inherit ( emulated )
# adwaita-qt # psqlodbc
2023-02-07 03:23:18 +00:00
apacheHttpd # TODO: not properly patched (we only need mod_dnssd?)
2023-02-06 22:41:32 +00:00
appstream
blueman
brltty
cantarell-fonts # python3.10-skia-pathops
2023-02-07 03:23:18 +00:00
cdrtools
2023-02-06 22:41:32 +00:00
colord
2023-02-07 09:46:13 +00:00
# duplicity # python3.10-s3transfer
2023-02-06 22:41:32 +00:00
evince
flakpak
fuzzel
2023-02-08 22:30:27 +00:00
fwupd-efi # efi/meson.build:162:0: ERROR: Program or command 'gcc' not found or not executable
fwupd # "Run-time dependency libgcab-1.0 found: NO (tried pkgconfig and cmake)"
2023-02-07 09:46:13 +00:00
gcr_4 # meson ERROR: Program 'gpg2 gpg' not found or not executable
2023-02-06 22:41:32 +00:00
gmime
# gnome-keyring
# gnome-remote-desktop
2023-02-07 09:46:13 +00:00
# gnome-tour
gnustep # (gnustep.base is used by unar; can't override individual members)
2023-02-06 22:41:32 +00:00
gocryptfs # gocryptfs-2.3-go-modules
# grpc
gst_all_1 # gst_all_1.gst-editing-services
gupnp
gupnp_1_6
2023-02-08 22:30:27 +00:00
gvfs # meson.build:312:2: ERROR: Assert failed: http required but libxml-2.0 not found
2023-02-06 22:41:32 +00:00
flatpak
2023-02-07 09:46:13 +00:00
hdf5 # configure: error: cannot run test program while cross compiling
2023-02-06 22:41:32 +00:00
http2
ibus
kitty
iio-sensor-proxy
libgweather
2023-02-08 22:30:27 +00:00
libHX
libjcat # data/tests/meson.build:10:0: ERROR: Program 'gnutls-certtool certtool' not found or not executable
2023-02-06 22:41:32 +00:00
librest
librest_1_0
2023-02-08 22:30:27 +00:00
libsForQt5 # qtbase # make: g++: No such file or directory
# libuv
2023-02-06 22:41:32 +00:00
mod_dnssd
ncftp
2023-02-08 22:30:27 +00:00
networkmanager-fortisslvpn # /nix/store/0wk6nr1mryvylf5g5frckjam7g7p9gpi-bash-5.2-p15/bin/bash: line 2: gdbus-codegen: command not found
networkmanager-iodine # configure.ac:58: error: possibly undefined macro: AM_GLIB_GNU_GETTEXT
networkmanager-l2tp # /nix/store/0wk6nr1mryvylf5g5frckjam7g7p9gpi-bash-5.2-p15/bin/bash: line 2: gdbus-codegen: command not found
networkmanager-openconnect # /nix/store/0wk6nr1mryvylf5g5frckjam7g7p9gpi-bash-5.2-p15/bin/bash: line 1: properties/gresource.xml: Permission denied
networkmanager-openvpn # /nix/store/0wk6nr1mryvylf5g5frckjam7g7p9gpi-bash-5.2-p15/bin/bash: line 1: properties/gresource.xml: Permission denied
networkmanager-sstp # /nix/store/0wk6nr1mryvylf5g5frckjam7g7p9gpi-bash-5.2-p15/bin/bash: line 2: gdbus-codegen: command not found
networkmanager-vpnc # /nix/store/0wk6nr1mryvylf5g5frckjam7g7p9gpi-bash-5.2-p15/bin/bash: line 1: properties/gresource.xml: Permission denied
2023-02-06 22:41:32 +00:00
obex_data_server
openfortivpn
ostree
pam_mount
2023-02-08 22:30:27 +00:00
perlInterpreters # perl5.36.0-Module-Build perl5.36.0-Test-utf8 (see tracking issues ^)
phoc # Program wayland-scanner found: NO
2023-02-07 09:46:13 +00:00
# pipewire
2023-02-08 22:30:27 +00:00
# psqlodbc
pulseaudio # FAILED: meson-internal__test
2023-02-06 22:41:32 +00:00
# qgnomeplatform
# qtbase
qt6 # psqlodbc
2023-02-08 22:30:27 +00:00
re2 # FAILED: CMakeFiles/test.util
2023-02-06 22:41:32 +00:00
rmlint
sequoia
# splatmoji
2023-02-08 22:30:27 +00:00
squeekboard # meson.build:1:0: ERROR: 'rust' compiler binary not defined in cross or native file
2023-02-06 22:41:32 +00:00
sysprof
2023-02-08 22:30:27 +00:00
tpm2-abrmd # configure: error: *** gdbus-codegen is required to build tpm2-abrmd; No package 'gio-unix-2.0' found
2023-02-06 22:41:32 +00:00
tracker-miners # it just can't run tests
2023-02-08 22:30:27 +00:00
twitter-color-emoji # /nix/store/0wk6nr1mryvylf5g5frckjam7g7p9gpi-bash-5.2-p15/bin/bash: line 1: pkg-config: command not found
2023-02-07 09:46:13 +00:00
unar # meson.build:52:2: ERROR: Program 'gpg2 gpg' not found or not executable
visidata # python3.10-psycopg2 python3.10-pandas python3.10-h5py
2023-02-06 22:41:32 +00:00
vpnc
webp-pixbuf-loader
2023-02-08 22:30:27 +00:00
# webkitgtk_4_1 # requires nativeBuildInputs = perl.pkgs.FileCopyRecursive => perl5.36.0-Test-utf8
xdg-desktop-portal-gtk # No package 'xdg-desktop-portal' found
xdg-desktop-portal-gnome # data/meson.build:33:5: ERROR: Program 'msgfmt' not found or not executable
# xdg-utils # perl5.36.0-File-BaseDir / perl5.36.0-Module-Build
2023-02-06 22:41:32 +00:00
;
2023-02-08 22:30:27 +00:00
# fwupd = prev.fwupd.overrideAttrs (orig: {
# # solves (meson) "Run-time dependency libgcab-1.0 found: NO (tried pkgconfig and cmake)", and others.
# # some of these are kinda sus. maybe upstream fwupd buildscript is iffy
# buildInputs = orig.buildInputs ++ [ next.gcab next.gi-docgen next.gnutls next.pkg-config ];
# });
libuv = prev . libuv . overrideAttrs ( orig : {
# 2 tests fail:
# - not ok 261 - tcp_bind6_error_addrinuse
# - not ok 267 - tcp_bind_error_addrinuse_listen
doCheck = false ;
} ) ;
# gvfs = prev.gvfs.overrideAttrs (orig: {
# # meson.build:312:2: ERROR: Assert failed: http required but libxml-2.0 not found
# # nativeBuildInputs = orig.nativeBuildInputs ++ [ prev.libxml2 prev.mesonEmulatorHook ];
# # TODO: gvfs 1.50.2 -> 1.50.3 upgrade is upstreamed, and fixed cross compilation
# version = "1.50.3";
# src = next.fetchurl {
# url = "mirror://gnome/sources/gvfs/1.50/gvfs-1.50.3.tar.xz";
# sha256 = "aJcRnpe7FgKdJ3jhpaVKamWSYx+LLzoqHepO8rAYA/0=";
# };
# patches = [
# # Hardcode the ssh path again.
# # https://gitlab.gnome.org/GNOME/gvfs/-/issues/465
# (next.fetchpatch2 {
# url = "https://gitlab.gnome.org/GNOME/gvfs/-/commit/8327383e262e1e7f32750a8a2d3dd708195b0f53.patch";
# hash = "sha256-ReD7qkezGeiJHyo9jTqEQNBjECqGhV9nSD+dYYGZWJ8=";
# revert = true;
# })
# ];
# });
2023-02-07 09:46:13 +00:00
pipewire = prev . pipewire . overrideAttrs ( orig : {
# fix `spa/plugins/bluez5/meson.build:41:0: ERROR: Program 'gdbus-codegen' not found or not executable`
nativeBuildInputs = orig . nativeBuildInputs ++ [ prev . glib ] ;
} ) ;
pythonPackagesExtensions = prev . pythonPackagesExtensions ++ [
( py-next : py-prev : {
defcon = py-prev . defcon . overridePythonAttrs ( orig : {
# TODO: diagnose and upstream
nativeBuildInputs = orig . nativeBuildInputs ++ orig . nativeCheckInputs ;
} ) ;
executing = py-prev . executing . overridePythonAttrs ( orig : {
# TODO: confirm & upstream
# test has an assertion that < 1s of CPU time elapsed => flakey
disabledTestPaths = orig . disabledTestPaths or [ ] ++ [
# "tests/test_main.py::TestStuff::test_many_source_for_filename_calls"
" t e s t s / t e s t _ m a i n . p y "
] ;
} ) ;
# h5py = py-prev.h5py.overridePythonAttrs (orig: {
# # XXX: can't upstream until its dependency, hdf5, is fixed. that looks TRICKY.
# # - the `setup_configure.py` in h5py tries to dlopen (and call into) the hdf5 lib to query the version and detect features like MPI
# # - it could be patched with ~10 LoC in the HDF5LibWrapper class.
# #
# # expose numpy and hdf5 as available at build time
# nativeBuildInputs = orig.nativeBuildInputs ++ orig.propagatedBuildInputs ++ orig.buildInputs;
# buildInputs = [];
# # HDF5_DIR = "${hdf5}";
# });
mutatormath = py-prev . mutatormath . overridePythonAttrs ( orig : {
# TODO: diagnose and upstream
nativeBuildInputs = orig . nativeBuildInputs or [ ] ++ orig . nativeCheckInputs ;
} ) ;
pandas = py-prev . pandas . overridePythonAttrs ( orig : {
# TODO: upstream
# XXX: we only actually need numpy when building in ~/nixpkgs repo: not sure why we need all the propagatedBuildInputs here.
# nativeBuildInputs = orig.nativeBuildInputs ++ [ py-next.numpy ];
nativeBuildInputs = orig . nativeBuildInputs ++ orig . propagatedBuildInputs ;
} ) ;
psycopg2 = py-prev . psycopg2 . overridePythonAttrs ( orig : {
2023-02-08 22:30:27 +00:00
# TODO: upstream (see tracking issue)
2023-02-07 09:46:13 +00:00
#
# psycopg2 *links* against libpg, so we need the host postgres available at build time!
# present-day nixpkgs only includes it in nativeBuildInputs
buildInputs = orig . buildInputs ++ [ next . postgresql ] ;
} ) ;
s3transfer = py-prev . s3transfer . overridePythonAttrs ( orig : {
2023-02-08 22:30:27 +00:00
# tests explicitly expect host CPU == build CPU
2023-02-07 09:46:13 +00:00
# Bail out! ERROR:../plugins/core.c:221:qemu_plugin_vcpu_init_hook: assertion failed: (success)
# Bail out! ERROR:../accel/tcg/cpu-exec.c:954:cpu_exec: assertion failed: (cpu == current_cpu)
disabledTestPaths = orig . disabledTestPaths ++ [
# "tests/functional/test_processpool.py::TestProcessPoolDownloader::test_cleans_up_tempfile_on_failure"
" t e s t s / f u n c t i o n a l / t e s t _ p r o c e s s p o o l . p y "
# "tests/unit/test_compat.py::TestBaseManager::test_can_provide_signal_handler_initializers_to_start"
" t e s t s / u n i t / t e s t _ c o m p a t . p y "
] ;
} ) ;
# skia-pathops
# it tries to call `cc` during the build, but can't find it.
} )
] ;
2023-02-06 22:41:32 +00:00
gnome = prev . gnome . overrideScope' ( self : super : {
inherit ( emulated . gnome )
2023-02-08 22:30:27 +00:00
evolution-data-server # 'nix log /nix/store/ghlsq1jl5js5jiy24b4p1k67k4sgrnv7-libuv-1.44.2.drv'
2023-02-06 22:41:32 +00:00
gnome-color-manager
2023-02-08 22:30:27 +00:00
gnome-control-center # subprojects/gvc/meson.build:30:0: ERROR: Program 'glib-mkenums mkenums' not found or not executable
2023-02-06 22:41:32 +00:00
gnome-keyring
2023-02-08 22:30:27 +00:00
# TODO: remove gnome-remote-desktop (wanted by gnome-control-center)
gnome-remote-desktop # Program gdbus-codegen found: NO
2023-02-07 09:46:13 +00:00
gnome-settings-daemon # subprojects/gvc/meson.build:30:0: ERROR: Program 'glib-mkenums mkenums' not found or not executable
2023-02-06 22:41:32 +00:00
gnome-user-share
2023-02-08 22:30:27 +00:00
mutter # meson.build:237:2: ERROR: Dependency "gbm" not found, tried pkgconfig (it's provided by mesa)
2023-02-06 22:41:32 +00:00
;
} ) ;
# gst_all_1.gst-editing-services = emulated.gst_all_1.gst-editing-services;
# gst_all_1 = prev.gst_all_1.overrideScope' (self: super: {
# inherit (emulated.gst_all_1)
# gst-editing-services
# ;
# });
# libsForQt5 = prev.libsForQt5.overrideScope' (self: super: {
# inherit (emulated.libsForQt5)
# qtbase
# ;
# });
# apacheHttpdPackagesFor = apacheHttpd: self:
# let
# prevHttpdPkgs = lib.fix (emulated.apacheHttpdPackagesFor apacheHttpd);
# in
# (prev.apacheHttpdPackagesFor apacheHttpd self) // {
# # inherit (prevHttpdPkgs) mod_dnssd;
# mod_dnssd = prevHttpdPkgs.mod_dnssd.override {
# inherit (self) apacheHttpd;
# };
# };
} )
] ;
# perlPackageOverrides = _perl: {
# inherit (pkgs.emulated.perl.pkgs)
# Testutf8
# ;
# };
} ;
2023-01-11 08:56:06 +00:00
}