overlays/cross: remove old emulated package set and buildInQemu, etc

This commit is contained in:
Colin 2024-05-31 06:59:32 +00:00
parent a2dfd8f08e
commit e8f8866032

View File

@ -40,16 +40,6 @@
final: prev:
let
inherit (prev) lib;
mkEmulated = final': pkgs:
import pkgs.path {
# system = pkgs.stdenv.hostPlatform.system;
localSystem = pkgs.stdenv.hostPlatform.system;
# inherit (config.nixpkgs) config;
inherit (final'.config.nixpkgs or { config = {}; }) config;
# config = builtins.removeAttrs config.nixpkgs.config [ "replaceStdenv" ];
# overlays = [(import ./all.nix)];
inherit (final') overlays;
};
## package override helpers
addInputs = { buildInputs ? [], nativeBuildInputs ? [], depsBuildBuild ? [] }: pkg: pkg.overrideAttrs (upstream: {
buildInputs = upstream.buildInputs or [] ++ buildInputs;
@ -88,248 +78,7 @@ let
'').overrideAttrs {
inherit (cargo) meta;
};
emulated = mkEmulated final prev;
linuxMinimal = final.linux.override {
# customize stock linux to compile using fewer resources.
# on desko, takes 24 min v.s. 35~40 min for linux-megous
# default config is in:
# - <pkgs/os-specific/linux/kernel/common-config.nix>
# documentation per config option is found with, for example:
# - `fd Kconfig . | xargs rg 'config SUNRPC_DEBUG'`
structuredExtraConfig = with lib.kernel; {
# recommended by: <https://nixos.wiki/wiki/Linux_kernel#Too_high_ram_usage>
DEBUG_INFO_BTF = lib.mkForce no;
# other debug-related things i can probably disable
CC_OPTIMIZE_FOR_SIZE = lib.mkForce yes;
DEBUG_INFO = lib.mkForce no;
DEBUG_KERNEL = lib.mkForce no;
GDB_SCRIPTS = lib.mkForce no;
SCHED_DEBUG = lib.mkForce no;
SUNRPC_DEBUG = lib.mkForce no;
# disable un-needed features
BT = no;
CAN = no;
DRM = no; # uses a lot of space when compiling
FPGA = no;
GNSS = no;
IIO = no; # 500 MB
INPUT_TOUCHSCREEN = no;
MEDIA_SDR_SUPPORT = no;
NFC = no;
SND = no; # also uses a lot of disk space when compiling
SOUND = no;
WAN = no; # X.25 protocol support
WIRELESS = no; # 1.4 GB (drivers/net/wireless), doesn't actually disable this
WWAN = no; # Wireless WAN
# disable features nixos explicitly enables, which we still don't need
FONTS = lib.mkForce no;
FB = lib.mkForce no;
# INET = no; # TCP/IP. `INET` means "IP network" (even when used on a LAN), not "Internet"
MEMTEST = lib.mkForce no;
# # NET = lib.mkForce no; # we need net (9pnet_virtio; unix) for sharing fs with the build machine
MEDIA_ANALOG_TV_SUPPORT = lib.mkForce no;
MEDIA_CAMERA_SUPPORT = lib.mkForce no;
MEDIA_DIGITAL_TV_SUPPORT = lib.mkForce no; # 150 MB disk space when compiling
MICROCODE = lib.mkForce no;
STAGING = lib.mkForce no; # 450 MB disk space when compiling
};
};
# given a package that's defined for build == host,
# build it from the native build machine by emulating the builder.
emulateBuilderQemu = pkg: let
inherit (final) vmTools;
# vmTools = final.vmTools.override {
# kernel = final.linux-megous or final.linux; #< HACK: guess at whatever deployed linux we're using, to avoid building two kernels
# };
# fix up the nixpkgs command that runs a Linux OS inside QEMU:
# qemu_kvm doesn't support x86_64 -> aarch64; but full qemu package does.
qemu = final.buildPackages.qemu.override {
# disable a bunch of unneeded features, particularly graphics.
# this avoids a mesa build failure (2023/10/26).
smartcardSupport = false;
spiceSupport = false;
openGLSupport = false;
virglSupport = false;
vncSupport = false;
gtkSupport = false;
sdlSupport = false;
pulseSupport = false;
pipewireSupport = false;
smbdSupport = false;
seccompSupport = false;
enableDocs = false;
};
# qemuCommandLinux = lib.replaceStrings
# [ "${final.buildPackages.qemu_kvm}" ]
# [ "${qemu}" ]
# vmTools.qemuCommandLinux;
# this qemuCommandLinux is effectively an inline substitution of the above, to avoid taking an unnecessary dep on `buildPackages.qemu_kvm`
qemuCommandLinux = ''
${vmTools.qemu-common.qemuBinary qemu} \
-nographic -no-reboot \
-device virtio-rng-pci \
-virtfs local,path=${builtins.storeDir},security_model=none,mount_tag=store \
-virtfs local,path=$TMPDIR/xchg,security_model=none,mount_tag=xchg \
''${diskImage:+-drive file=$diskImage,if=virtio,cache=unsafe,werror=report} \
-kernel ${final.linux}/${final.stdenv.hostPlatform.linux-kernel.target} \
-initrd ${vmTools.initrd}/initrd \
-append "console=${vmTools.qemu-common.qemuSerialDevice} panic=1 command=${vmTools.stage2Init} out=$out mountDisk=$mountDisk loglevel=4" \
$QEMU_OPTS
'';
vmRunCommand = final.buildPackages.vmTools.vmRunCommand qemuCommandLinux;
in
# without binfmt emulation, leverage the `vmTools.runInLinuxVM` infrastructure:
# final.buildPackages.vmTools.runInLinuxVM pkg
#
# except `runInLinuxVM` doesn't quite work OOTB (see above),
# so hack its components into something which *does* work.
lib.overrideDerivation pkg ({ builder, args, ... }: {
builder = "${final.buildPackages.bash}/bin/sh";
args = [ "-e" vmRunCommand ];
# orig{Builder,Args} gets used by the vmRunCommand script:
origBuilder = builder;
origArgs = args;
QEMU_OPTS = "-m 16384"; # MiB of RAM
enableParallelBuilding = true;
# finally, let nix know that this package should be built by the build system
system = final.stdenv.buildPlatform.system;
}) // {
override = attrs: emulateBuilderQemu (pkg.override attrs);
overrideAttrs = mergeFn: emulateBuilderQemu (pkg.overrideAttrs mergeFn);
}
;
# given a package that's defined for build == host,
# build it from a "proot": a chroot-like environment where `exec` is hooked to invoke qemu instead.
# this is like binfmt, but configured to run *only* the emulated host and not the build machine
# see: <https://proot-me.github.io/>
# hinted at by: <https://www.tweag.io/blog/2022-03-31-running-wasm-native-hybrid-code/>
#
# this doesn't quite work:
# - proot'd aarch64 shell will launch child processes in qemu
# - but those children won't launch their children in qemu
# need to somehow recursively proot...
# emulateBuilderProot = pkg:
# lib.overrideDerivation pkg ({ builder, args, ... }: {
# builder = "${final.buildPackages.bash}/bin/sh";
# args = [ "-e" prootBuilder ];
# origBuilder = builder;
# origArgs = args;
# enableParallelBuilding = true; # TODO: inherit from `pkg`?
# NIX_DEBUG = "6";
# # finally, let nix know that this package should be built by the build system
# system = final.stdenv.buildPlatform.system;
# }) // {
# override = attrs: emulateBuilderProot (pkg.override attrs);
# overrideAttrs = mergeFn: emulateBuilderProot (pkg.overrideAttrs mergeFn);
# };
# prootBuilder = let
# proot = "${final.buildPackages.proot}/bin/proot";
# # prootFlags = "-r / -b /:/";
# prootFlags = "-b /nix:/nix -b /tmp:/tmp";
# # prootFlags = "-b /:/ -b ${final.bash}/bin/sh:/bin/sh"; # --mixed-mode false
# qemu = "${final.buildPackages.qemu}/bin/qemu-aarch64";
# in
# final.pkgs.writeText "proot-run" ''
# echo "proot: ${proot} -q ${qemu} ${prootFlags} $origBuilder $origArgs"
# ${proot} -q ${qemu} ${prootFlags} $origBuilder $origArgs
# echo "exited proot"
# '';
# given a package defined for build != host, transform it to build on the host.
# i.e. build using the host's stdenv.
buildOnHost = { overrides ? { inherit (emulated) stdenv; } }: pkg:
let
# patch packages which don't expect to be moved to a different platform
preFixPkg = p:
if p.name or null == "make-shell-wrapper-hook" then
p.overrideAttrs (_: {
# unconditionally use the outermost targetPackages shell
shell = final.runtimeShell;
})
# final.makeBinaryWrapper
# else if p.name or null == "make-binary-wrapper-hook" then
# p.override { DNE = "not-yet-implemented"; }
else if p.pname or null == "pkg-config-wrapper" then
p.override {
# default pkg-config.__spliced.hostTarget still wants to run on the build machine.
# overriding buildPackages fixes that, and overriding stdenvNoCC makes it be just `pkg-config`, unmangled.
stdenvNoCC = emulated.stdenvNoCC;
buildPackages = final.hostPackages; # TODO: just `final`?
}
else if p.name or null == "npm-install-hook" then
p.overrideAttrs (base: {
propagatedNativeBuildInputs = base.propagatedBuildInputs;
propagatedBuildInputs = [];
})
# else if p.pname == final.python3.pname then
# p // {
# pythonForBuild = p;
# }
# else if p.pname == "wrap-gapps-hook" then
# # avoid faulty propagated gtk3/gtk4
# final.wrapGAppsNoGuiHook
else
p
;
unsplicePkg = p: p.__spliced.hostTarget or p;
# unsplicePkg = p: p.__spliced.hostHost or p;
unsplicePkgs = ps: map (p: unsplicePkg (preFixPkg p)) ps;
in
(pkg.override overrides).overrideAttrs (upstream: {
# for this purpose, the naming in `depsAB` is "inputs build for A, used to create packages in B" (i think).
# when cross compiling x86_64 -> aarch64, most packages are
# - build: x86_64
# - target: aarch64
# - host: aarch64
# so, we only need to replace the build packages with alternates.
depsBuildBuild = unsplicePkgs (upstream.depsBuildBuild or []);
nativeBuildInputs = unsplicePkgs (upstream.nativeBuildInputs or []);
depsBuildTarget = unsplicePkgs (upstream.depsBuildTarget or []);
depsBuildBuildPropagated = unsplicePkgs (upstream.depsBuildBuildPropagated or []);
propagatedNativeBuildInputs = unsplicePkgs (upstream.propagatedNativeBuildInputs or []);
depsBuildTargetPropagated = unsplicePkgs (upstream.depsBuildTargetPropagated or []);
nativeCheckInputs = unsplicePkgs (upstream.nativeCheckInputs or []);
nativeInstallCheckInputs = unsplicePkgs (upstream.nativeInstallCheckInputs or []);
});
# TODO: may be able to use qemu-system instead of booting a full linux?
# - <https://github.com/NixOS/nixpkgs/issues/119885#issuecomment-858491472>
buildInQemu = overrides: pkg: emulateBuilderQemu (buildOnHost overrides pkg);
# buildInProot = pkg: emulateBuilderProot (buildOnHost pkg);
in with final; {
inherit emulated;
# pkgsi686Linux = prev.pkgsi686Linux.extend (i686Self: i686Super: {
# # fixes eval-time error: "Unsupported cross architecture"
# # it happens even on a x86_64 -> x86_64 build:
# # - defining `config.nixpkgs.buildPlatform` to the non-default causes that setting to be inherited by pkgsi686.
# # - hence, `pkgsi686` on a non-cross build is ordinarily *emulated*:
# # defining a cross build causes it to also be cross (but to the right hostPlatform)
# # this has no inputs other than stdenv, and fetchurl, so emulating it is fine.
# tbb = prev.emulated.pkgsi686Linux.tbb;
# # tbb = i686Super.tbb.overrideAttrs (orig: (with i686Self; {
# # makeFlags = lib.optionals stdenv.cc.isClang [
# # "compiler=clang"
# # ] ++ (lib.optional (stdenv.buildPlatform != stdenv.hostPlatform)
# # (if stdenv.hostPlatform.isAarch64 then "arch=arm64"
# # else if stdenv.hostPlatform.isx86_64 then "arch=intel64"
# # else throw "Unsupported cross architecture: ${stdenv.buildPlatform.system} -> ${stdenv.hostPlatform.system}"));
# # }));
# });
# adwaita-qt6 = prev.adwaita-qt6.override {
# # adwaita-qt6 still uses the qt5 version of these libs by default?
@ -368,28 +117,11 @@ in with final; {
# '';
# });
# apacheHttpd_2_4 = (prev.apacheHttpd_2_4.override {
# # fixes `configure: error: Size of "void *" is less than size of "long"`
# inherit (emulated) stdenv;
# }).overrideAttrs (upstream: {
# # nativeBuildInputs = upstream.nativeBuildInputs ++ [ bintools ];
# nativeBuildInputs = upstream.nativeBuildInputs ++ [
# buildPackages.stdenv.cc # fixes: "/nix/store/czvaa9y9ch56z53c0b0f5bsjlgh14ra6-apr-aarch64-unknown-linux-gnu-1.7.0-dev/share/build/libtool: line 1890: aarch64-unknown-linux-gnu-ar: command not found"
# ];
# # now can't find -lz for zlib.
# # this is because nixpkgs zlib.dev has only include/ + a .pc file linking to zlib, which has the lib/ folder
# # but httpd expects --with-zlib=prefix/ to hold both include/ and lib/
# # TODO: we could link farm, or we could skip straight to cross compilation and not emulate stdenv
# });
# apacheHttpdPackagesFor = apacheHttpd: self:
# let
# prevHttpdPkgs = prev.apacheHttpdPackagesFor apacheHttpd self;
# in prevHttpdPkgs // {
# # fixes "configure: error: *** Sorry, could not find apxs ***"
# # mod_dnssd = prevHttpdPkgs.mod_dnssd.override {
# # inherit (emulated) stdenv;
# # };
# # N.B.: the below apxs doesn't have a valid shebang (#!/replace/with/...).
# # we can't replace it at the origin?
# mod_dnssd = prevHttpdPkgs.mod_dnssd.overrideAttrs (upstream: {
@ -423,8 +155,8 @@ in with final; {
# shell = runtimeShell;
# };
# 2023/10/23: upstreaming blocked by gvfs, webkitgtk 4.1
# fixes: "error: Package <foo> not found in specified Vala API directories or GObject-Introspection GIR directories"
# 2024/05/31: upstreaming blocked by appstream, qtsvg
# fixes: "Exec format error: './calls-scan'"
calls = prev.calls.overrideAttrs (upstream: {
# TODO: try building with mesonEmulatorHook when i upstream this
# nativeBuildInputs = upstream.nativeBuildInputs ++ lib.optionals (!prev.stdenv.buildPlatform.canExecute prev.stdenv.hostPlatform) [
@ -435,10 +167,6 @@ in with final; {
});
# 2024/02/27: upstreaming is unblocked
# cdrtools = prev.cdrtools.override {
# # "configure: error: installation or configuration problem: C compiler cc not found."
# inherit (emulated) stdenv;
# };
# cdrtools = prev.cdrtools.overrideAttrs (upstream: {
# # can't get it to actually use our CC, even when specifying these explicitly
# # CC = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
@ -447,18 +175,6 @@ in with final; {
# ];
# });
# cinny = buildInQemu { overrides = {
# buildNpmPackage = buildNpmPackage.override {
# inherit (emulated) stdenv;
# buildPackages = final.pkgsHostHost;
# };
# }; } (prev.cinny.overrideAttrs (upstream: {
# postPatch = ''
# mkdir $TMP
# '';
# NIX_DEBUG = "6";
# }));
# 2024/02/27: upstreaming is blocked on appstream, qtsvg
# clapper = prev.clapper.overrideAttrs (upstream: {
# # use the host gjs (meson's find_program expects it to be executable)
@ -468,12 +184,6 @@ in with final; {
# '';
# });
# conky = ((useEmulatedStdenv prev.conky).override {
# # docbook2x dependency doesn't cross compile
# docsSupport = prev.stdenv.buildPlatform.canExecute prev.stdenv.hostPlatform;
# }).overrideAttrs (upstream: {
# nativeBuildInputs = upstream.nativeBuildInputs ++ [ git ];
# });
# conky = (prev.conky.override {
# # docbook2x dependency doesn't cross compile
# docsSupport = prev.stdenv.buildPlatform.canExecute prev.stdenv.hostPlatform;
@ -532,47 +242,12 @@ in with final; {
# binutils = binutils-unwrapped;
# };
# emacs = prev.emacs.override {
# # fixes "configure: error: cannot run test program while cross compiling"
# inherit (emulated) stdenv;
# };
# emacs = prev.emacs.override {
# nativeComp = false; # will be renamed to `withNativeCompilation` in future
# # future: we can specify 'action-if-cross-compiling' to actually invoke the test programs:
# # <https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/Runtime.html>
# };
# firefox-extensions = prev.firefox-extensions.overrideScope (self: super: {
# unwrapped = super.unwrapped // {
# browserpass-extension = super.unwrapped.browserpass-extension.override {
# mkYarnModules = args: buildInQemu {
# override = { stdenv }: (
# (yarn2nix-moretea.override {
# pkgs = pkgs.__splicedPackages // { inherit stdenv; };
# }).mkYarnModules args
# ).overrideAttrs (upstream: {
# # i guess the VM creates the output directory for the derivation? not sure.
# # and `mv` across the VM boundary breaks, too?
# # original errors:
# # - "mv: cannot create directory <$out>: File exists"
# # - "mv: failed to preserve ownership for"
# buildPhase = lib.replaceStrings
# [
# "mkdir $out"
# "mv "
# ]
# [
# "mkdir $out || true ; chmod +w deps/browserpass-extension-modules/package.json"
# "cp -Rv "
# ]
# upstream.buildPhase
# ;
# });
# };
# };
# };
# });
# 2024/02/27: upstreaming is unblocked
# firejail = prev.firejail.overrideAttrs (upstream: {
# # firejail executes its build outputs to produce the default filter list.
@ -587,10 +262,6 @@ in with final; {
# '');
# });
# flare-signal = prev.flare-signal.override {
# # fixes "cargo:warning=aarch64-unknown-linux-gnu-gcc: error: unrecognized command-line option -m64"
# inherit (emulated) cargo meson rustc rustPlatform stdenv;
# };
flare-signal = prev.flare-signal.overrideAttrs (upstream: {
# blueprint-compiler runs on the build machine, but tries to load gobject-introspection types meant for the host.
postPatch = (upstream.postPatch or "") + ''
@ -660,15 +331,6 @@ in with final; {
});
# 2024/02/27: upstreaming is unblocked -- if i can rework to not use emulation
# fwupd-efi = prev.fwupd-efi.override {
# # fwupd-efi queries meson host_machine to decide what arch to build for.
# # for some reason, this gives x86_64 unless meson itself is emulated.
# # maybe meson's use of "host_machine" actually mirrors nix's "build machine"?
# inherit (emulated)
# stdenv # fixes: "efi/meson.build:162:0: ERROR: Program or command 'gcc' not found or not executable"
# meson # fixes: "efi/meson.build:33:2: ERROR: Problem encountered: gnu-efi support requested, but headers were not found"
# ;
# };
# fwupd-efi = prev.fwupd-efi.overrideAttrs (upstream: {
# # does not fix: "efi/meson.build:162:0: ERROR: Program or command 'gcc' not found or not executable"
# makeFlags = upstream.makeFlags or [] ++ [ "CC=${prev.stdenv.cc.targetPrefix}cc" ];
@ -724,12 +386,7 @@ in with final; {
# gnustep = prev.gnustep.overrideScope (self: super: {
# # gnustep is going to need a *lot* of work/domain-specific knowledge to truly cross-compile,
# # base = emulated.gnustep.base;
# base = (super.base.override {
# # fixes: "configure: error: Your compiler does not appear to implement the -fconstant-string-class option needed for support of strings."
# # emulating gsmake amounts to emulating stdenv.
# inherit (emulated.gnustep) gsmakeDerivation;
# }).overrideAttrs (upstream: {
# base = super.base.overrideAttrs (upstream: {
# # fixes: "checking FFI library usage... ./configure: line 11028: pkg-config: command not found"
# # nixpkgs has this in nativeBuildInputs... but that's failing when we partially emulate things.
# buildInputs = (upstream.buildInputs or []) ++ [ prev.pkg-config ];
@ -919,16 +576,12 @@ in with final; {
# # (mvToNativeInputs [ python3 ] super.GConf);
# # );
# # avoid gconf. last release was 2013: it's dead.
# GConf = super.GConf.override {
# inherit (emulated) stdenv;
# };
# # gnome_vfs = (
# # # fixes: "configure: error: gconftool-2 executable not found in your path - should be installed with GConf"
# # # new error: "configure: error: cannot run test program while cross compiling"
# # mvToNativeInputs [ self.GConf ] super.gnome_vfs
# # );
# gnome_vfs = useEmulatedStdenv super.gnome_vfs;
# });
# out for PR: <https://github.com/NixOS/nixpkgs/pull/263182>
@ -951,13 +604,7 @@ in with final; {
# i2p = mvToNativeInputs [ ant gettext ] prev.i2p;
# 2024/02/27: upstreaming is unblocked (see `pkgs/patched/ibus`)
# ibus = (prev.ibus.override {
# inherit (emulated)
# stdenv # fixes: "configure: error: cannot run test program while cross compiling"
# gobject-introspection # "cannot open shared object ..."
# ;
# });
# .overrideAttrs (upstream: {
# ibus = prev.ibus.overrideAttrs (upstream: {
# nativeBuildInputs = upstream.nativeBuildInputs or [] ++ [
# glib # fixes: ImportError: /nix/store/fi1rsalr11xg00dqwgzbf91jpl3zwygi-gobject-introspection-aarch64-unknown-linux-gnu-1.74.0/lib/gobject-introspection/giscanner/_giscanner.cpython-310-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory
# buildPackages.gobject-introspection # fixes "_giscanner.cpython-310-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory"
@ -966,10 +613,6 @@ in with final; {
# vala # fixes: "Package `ibus-1.0' not found in specified Vala API directories or GObject-Introspection GIR directories"
# ];
# });
# ibus = buildInQemu (prev.ibus.override {
# # not enough: still tries to execute build machine perl
# buildPackages.gtk-doc = gtk-doc;
# });
# 2023/12/08: upstreaming is blocked on qtsvg
iotas = prev.iotas.overrideAttrs (_: {
@ -982,31 +625,20 @@ in with final; {
'';
});
# fixes: "make: gcc: No such file or directory"
# java-service-wrapper = useEmulatedStdenv prev.java-service-wrapper;
# javaPackages = prev.javaPackages // {
# compiler = prev.javaPackages.compiler // {
# adoptopenjdk-8 = prev.javaPackages.compiler.adoptopenjdk-8 // {
# # fixes "error: auto-patchelf could not satisfy dependency libgcc_s.so.1 wanted by /nix/store/fvln9pahd3c4ys8xv5c0w91xm2347cvq-adoptopenjdk-hotspot-bin-aarch64-unknown-linux-gnu-8.0.322/jre/lib/aarch64/libsunec.so"
# jdk-hotspot = useEmulatedStdenv prev.javaPackages.compiler.adoptopenjdk-8.jdk-hotspot;
# };
# openjdk8-bootstrap = useEmulatedStdenv prev.javaPackages.compiler.openjdk8-bootstrap;
# # fixes "configure: error: Could not find required tool for WHICH"
# openjdk8 = useEmulatedStdenv prev.javaPackages.compiler.openjdk8;
# # openjdk19 = (
# # # fixes "configure: error: Could not find required tool for ZIPEXE"
# # # new failure: "checking for cc... [not found]"
# # (mvToNativeInputs
# # [ zip ]
# # (useEmulatedStdenv prev.javaPackages.compiler.openjdk19)
# # prev.javaPackages.compiler.openjdk19
# # ).overrideAttrs (_upstream: {
# # # avoid building `support/demos`, which segfaults
# # buildFlags = [ "product-images" ];
# # doCheck = false; # pre-emptive
# # })
# # );
# openjdk19 = emulated.javaPackages.compiler.openjdk19;
# };
# };
@ -1026,10 +658,6 @@ in with final; {
# depsHostHost = upstream.depsHostHost or [] ++ [ qt6.wrapQtAppsHook ];
# nativeBuildInputs = lib.remove [ qt6.wrapQtAppsHook ] upstream.nativeBuildInputs;
# });
# jellyfin-web = prev.jellyfin-web.override {
# # in node-dependencies-jellyfin-web: "node: command not found"
# inherit (emulated) stdenv;
# };
# 2023/12/08: upstreaming is blocked by qtsvg (pipewire)
komikku = prev.komikku.overrideAttrs (upstream: {
@ -1049,13 +677,7 @@ in with final; {
'';
});
# koreader = (prev.koreader.override {
# # fixes runtime error: luajit: ./ffi/util.lua:757: attempt to call field 'pack' (a nil value)
# # inherit (emulated) luajit;
# luajit = buildInQemu (luajit.override {
# buildPackages.stdenv = emulated.stdenv; # it uses buildPackages.stdenv for HOST_CC
# });
# }).overrideAttrs (upstream: {
# koreader = prev.koreader.overrideAttrs (upstream: {
# nativeBuildInputs = upstream.nativeBuildInputs ++ [
# autoPatchelfHook
# ];
@ -1233,164 +855,6 @@ in with final; {
zigBuildFlags = [ "-Dtarget=aarch64-linux-gnu" ];
});
# mepo = emulateBuildMachine (prev.mepo.override {
# zig = (buildPackages.zig.overrideAttrs (upstream: {
# cmakeFlags = (upstream.cmakeFlags or []) ++ [
# "-DZIG_EXECUTABLE=${buildPackages.zig}/bin/zig"
# "-DZIG_TARGET_TRIPLE=aarch64-linux-gnu"
# # "-DZIG_MCPU=${targetPlatform.gcc.cpu}"
# ];
# # makeFlags = (upstream.makeFlags or []) ++ [
# # # stop at the second stage.
# # # the third stage would be a self-hosted compiler (i.e. build the compiler using what you just built),
# # # but that only works on native builds
# # "zig2"
# # ];
# }));
# });
# mepo = prev.mepo.overrideAttrs (upstream: {
# installPhase = lib.replaceStrings [ "zig " ] [ "zig -Dtarget=aarch64-linux "] upstream.installPhase;
# doCheck = false;
# });
# mepo =
# # let
# # zig = zig.override {
# # inherit (emulated) stdenv;
# # };
# # # makeWrapper = makeWrapper.override {
# # # inherit (emulated) stdenv;
# # # };
# # # makeWrapper = emulated.stdenv.mkDerivation makeWrapper;
# # in
# # (prev.mepo.overrideAttrs (upstream: {
# # checkPhase = lib.replaceStrings [ "zig" ] [ "${zig}/bin/zig" ] upstream.checkPhase;
# # installPhase = lib.replaceStrings [ "zig" ] [ "${zig}/bin/zig" ] upstream.installPhase;
# # })).override {
# # inherit (emulated) stdenv;
# # inherit zig;
# # };
# let
# mepoDefn = {
# stdenv
# , upstreamMepo
# , makeWrapper
# , pkg-config
# , zig
# # buildInputs
# , curl
# , SDL2
# , SDL2_gfx
# , SDL2_image
# , SDL2_ttf
# , jq
# , ncurses
# }: stdenv.mkDerivation {
# inherit (upstreamMepo)
# pname
# version
# src
# # buildInputs
# preBuild
# doCheck
# postInstall
# meta
# ;
# # moves pkg-config to buildInputs where zig can see it, and uses the host build of zig.
# nativeBuildInputs = [ makeWrapper ];
# buildInputs = [
# curl SDL2 SDL2_gfx SDL2_image SDL2_ttf jq ncurses pkg-config
# ];
# checkPhase = lib.replaceStrings [ "zig" ] [ "${zig}/bin/zig" ] upstreamMepo.checkPhase;
# installPhase = lib.replaceStrings [ "zig" ] [ "${zig}/bin/zig" ] upstreamMepo.installPhase;
# };
# in
# emulateBuildMachine (callPackage mepoDefn {
# upstreamMepo = prev.mepo;
# zig = zig.overrideAttrs (upstream: {
# # TODO: for zig1 we can actually set ZIG_EXECUTABLE and use the build zig.
# # zig2 doesn't support that.
# postPatch = (upstream.postPatch or "") + ''
# substituteInPlace CMakeLists.txt \
# --replace "COMMAND zig1 " "COMMAND ${stdenv.hostPlatform.emulator buildPackages} $PWD/build/zig1 " \
# --replace "COMMAND zig2 " "COMMAND ${stdenv.hostPlatform.emulator buildPackages} $PWD/build/zig2 "
# '';
# });
# # zig = emulateBuildMachine (zig.overrideAttrs (upstream: {
# # # speed up the emulated build by skipping docs and tests
# # outputs = [ "out" ];
# # postBuild = ""; # don't build docs
# # doInstallCheck = false;
# # doCheck = false;
# # }));
# });
# # (prev.mepo.override {
# # # emulate zig and stdenv to fix:
# # # - "/build/source/src/sdlshim.zig:1:20: error: C import failed"
# # # emulate makeWrapper to fix:
# # # - "error: makeWrapper/makeShellWrapper must be in nativeBuildInputs"
# # # inherit (emulated) makeWrapper stdenv;
# # inherit (emulated) stdenv;
# # inherit zig;
# # # inherit makeWrapper;
# # }).overrideAttrs (upstream: {
# # # nativeBuildInputs = [ pkg-config makeWrapper ];
# # # nativeBuildInputs = [ pkg-config emulated.makeWrapper ];
# # # ref to zig by full path because otherwise it doesn't end up on the path...
# # #checkPhase = lib.replaceStrings [ "zig" ] [ "${zig}/bin/zig" ] upstream.checkPhase;
# # #installPhase = lib.replaceStrings [ "zig" ] [ "${zig}/bin/zig" ] upstream.installPhase;
# # });
# mepo = (prev.mepo.override {
# # emulate zig and stdenv to fix:
# # - "/build/source/src/sdlshim.zig:1:20: error: C import failed"
# # emulate makeWrapper to fix:
# # - "error: makeWrapper/makeShellWrapper must be in nativeBuildInputs"
# inherit (emulated) makeWrapper stdenv zig;
# }).overrideAttrs (upstream: {
# nativeBuildInputs = [ pkg-config emulated.makeWrapper ];
# # ref to zig by full path because otherwise it doesn't end up on the path...
# checkPhase = lib.replaceStrings [ "zig" ] [ "${emulated.zig}/bin/zig" ] upstream.checkPhase;
# installPhase = lib.replaceStrings [ "zig" ] [ "${emulated.zig}/bin/zig" ] upstream.installPhase;
# });
# mepo = (prev.mepo.override {
# inherit (emulated) stdenv;
# }).overrideAttrs (upstream: {
# nativeBuildInputs = [ pkg-config emulated.makeWrapper ];
# buildInputs = [
# curl SDL2 SDL2_gfx SDL2_image SDL2_ttf jq ncurses
# emulated.zig
# ];
# });
# mepo = mvToBuildInputs [ emulated.zig ] (prev.mepo.override {
# inherit (emulated) makeWrapper stdenv zig;
# });
# mepo = (prev.mepo.override {
# inherit (emulated)
# stdenv
# SDL2
# SDL2_gfx
# SDL2_image
# SDL2_ttf
# zig
# ;
# }).overrideAttrs (_upstream: {
# doCheck = false;
# # dontConfigure = true;
# # dontBuild = true;
# # preInstall = ''
# # export HOME=$TMPDIR
# # '';
# # installPhase = ''
# # runHook preInstall
# # zig build -Drelease-safe=true -Dtarget=aarch64-linux-gnu -Dcpu=baseline --prefix $out
# # install -d $out/share/man/man1
# # $out/bin/mepo -docman > $out/share/man/man1/mepo.1
# # runHook postInstall
# # '';
# });
# fixes: "ar: command not found"
# `ar` is provided by bintools
# 2023/07/27: upstreaming is unblocked by deps; but turns out to not be this simple
@ -1402,10 +866,6 @@ in with final; {
# # fails to fix "configure.ac:58: error: possibly undefined macro: AM_GLIB_GNU_GETTEXT"
# nativeBuildInputs = orig.nativeBuildInputs ++ [ gettext ];
# });
# networkmanager-iodine = prev.networkmanager-iodine.override {
# # fixes "configure.ac:58: error: possibly undefined macro: AM_GLIB_GNU_GETTEXT"
# inherit (emulated) stdenv;
# };
# networkmanager-iodine = addNativeInputs [ gettext ] prev.networkmanager-iodine;
# networkmanager-iodine = prev.networkmanager-iodine.overrideAttrs (upstream: {
# # buildInputs = upstream.buildInputs ++ [ intltool gettext ];
@ -1508,11 +968,6 @@ in with final; {
# # buildInputs = lib.remove gnupg upstream.buildInputs;
# });
# openfortivpn = prev.openfortivpn.override {
# # fixes "checking for /proc/net/route... configure: error: cannot check for file existence when cross compiling"
# inherit (emulated) stdenv;
# };
# fixes (meson) "Program 'glib-mkenums mkenums' not found or not executable"
# 2023/07/27: upstreaming is blocked on p11-kit, argyllcms, libavif cross compilation
# phoc = mvToNativeInputs [ wayland-scanner glib ] prev.phoc;
@ -1546,11 +1001,6 @@ in with final; {
# ffadoSupport = false;
# };
# psqlodbc = prev.psqlodbc.override {
# # fixes "configure: error: odbc_config not found (required for unixODBC build)"
# inherit (emulated) stdenv;
# };
# 2023/12/13: upstreaming is blocked by qtsvg (via pipewire)
pwvucontrol = prev.pwvucontrol.overrideAttrs (upstream:
let
@ -1571,125 +1021,12 @@ in with final; {
'';
});
# qt5 = let
# emulatedQt5 = prev.qt5.override {
# # emulate qt5base and all qtModules.
# # because qt5 doesn't place this `stdenv` argument into its scope, `libsForQt5` doesn't inherit
# # this stdenv. so anything using `libsForQt5.callPackage` builds w/o emulation.
# stdenv = stdenv // {
# mkDerivation = args: buildInQemu {
# override = { stdenv }: stdenv.mkDerivation args;
# };
# };
# };
# in prev.qt5.overrideScope (self: super: {
# inherit (emulatedQt5)
# qtbase
# # without emulation these all fail with "Project ERROR: Cannot run compiler 'g++'."
# qtdeclarative
# qtgraphicaleffects
# qtimageformats
# qtmultimedia
# qtquickcontrols
# qtquickcontrols2
# qtsvg
# qttools
# qtwayland
# ;
# });
# qt5 = prev.qt5.overrideScope (self: super: {
# # emulate all qt5 modules
# # this is a good idea, because qt is touchy about mixing "versions",
# # but idk if it's necessary -- i haven't tried selective emulation.
# #
# # qt5's `callPackage` doesn't use the final `qtModule`, but the non-overriden one.
# # so to modify `qtModule` we have to go through callPackage.
# callPackage = self.newScope {
# inherit (self) qtCompatVersion srcs stdenv;
# qtModule = args: buildInQemu {
# # clunky buildInQemu API, when not used via `callPackage`
# override = _attrs: super.qtModule args;
# };
# };
# # emulate qtbase (which doesn't go through qtModule)
# qtbase = buildInQemu super.qtbase;
# });
# qt5 = prev.qt5.overrideScope (self: super:
# let
# emulateQtModule = pkg: buildInQemu {
# # qtModule never gets `stdenv`
# override = _stdenv: pkg;
# };
# in {
# qtbase = buildInQemu super.qtbase;
# qtdeclarative = emulateQtModule super.qtdeclarative;
# qtgraphicaleffects = emulateQtModule super.qtgraphicaleffects;
# qtimageformats = emulateQtModule super.qtimageformats;
# qtkeychain = emulateQtModule super.qtkeychain; #< doesn't exist?
# qtmultimedia = emulateQtModule super.qtmultimedia;
# qtquickcontrols = emulateQtModule super.qtquickcontrols;
# qtquickcontrols2 = emulateQtModule super.qtquickcontrols2;
# qtsvg = emulateQtModule super.qtsvg;
# qttools = emulateQtModule super.qttools;
# qtwayland = emulateQtModule super.qtwayland;
# });
# qt5 = prev.qt5.overrideScope (self: super: {
# # stdenv.mkDerivation is used by qtModule, so this emulates all the qt modules
# stdenv = stdenv // {
# mkDerivation = args: buildInQemu {
# override = { stdenv }: stdenv.mkDerivation args;
# };
# };
# # callPackage/mkDerivation is used by libsForQt5, so we avoid emulating qt consumers.
# # mkDerivation = stdenv.mkDerivation;
# # callPackage = self.newScope {
# # inherit (self) qtCompatVersion qtModule srcs;
# # inherit stdenv;
# # };
# # qtbase = buildInQemu super.qtbase;
# });
# libsForQt5 = prev.libsForQt5.overrideScope (self: super: {
# inherit stdenv;
# inherit (self.stdenv) mkderivation;
# });
# qt5 = (prev.qt5.override {
# # qt5 modules see this stdenv; they don't pick up the scope's qtModule or stdenv
# stdenv = emulated.stdenv // {
# # mkDerivation = args: buildInQemu (stdenv.mkDerivation args);
# mkDerivation = args: buildInQemu {
# # clunky buildInQemu API, when not used via `callPackage`
# override = _attrs: stdenv.mkDerivation args;
# };
# };
# }).overrideScope (self: super: {
# # but for anything using `libsForQt5.callPackage`, don't emulate.
# # note: alternative approach is to only `libsForQt5` (it's a separate scope),.
# # it inherits so much from the `qt5` scope, so not a clear improvement.
# mkDerivation = self.mkDerivationWith stdenv.mkDerivation;
# callPackage = self.newScope { inherit (self) qtCompatVersion qtModule srcs; inherit stdenv; };
# # except, still emulate qtbase.
# # all other modules build with qtModule (which emulates), except for qtbase which is behind a `callPackage` and uses `stdenv.mkDerivation`.
# # therefore we need to re-emulate it when make callPackage not emulate here.
# qtbase = buildInQemu super.qtbase;
# # qtbase = super.qtbase.override {
# # # qtbase is the only thing in `qt5` scope that references `[stdenv.]mkDerivation`.
# # # to emulate it, we emulate stdenv; all the other qt5 members are emulated via `qt5.qtModule`
# # inherit (emulated) stdenv;
# # };
# });
# qt5 = emulated.qt5.overrideScope (self: super: {
# # emulate all the qt5 packages, but rework `libsForQt5.callPackage` and `mkDerivation`
# # to use non-emulated stdenv by default.
# mkDerivation = self.mkDerivationWith stdenv.mkDerivation;
# callPackage = self.newScope { inherit (self) qtCompatVersion qtModule srcs; inherit stdenv; };
# });
# qt6 = prev.qt6.overrideScope (self: super: {
# # # inherit (emulated.qt6) qtModule;
# # qtbase = super.qtbase.overrideAttrs (upstream: {
# # # cmakeFlags = upstream.cmakeFlags ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
# # cmakeFlags = upstream.cmakeFlags ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
@ -1711,10 +1048,6 @@ in with final; {
# # # qtwayland = super.qtwayland.override {
# # # inherit (self) qtbase;
# # # };
# # # qtbase = super.qtbase.override {
# # # # fixes: "You need to set QT_HOST_PATH to cross compile Qt."
# # # inherit (emulated) stdenv;
# # # };
# qtwebengine = super.qtwebengine.overrideAttrs (upstream: {
# # depsBuildBuild = upstream.depsBuildBuild or [] ++ [ pkg-config ];
@ -1783,11 +1116,6 @@ in with final; {
# });
# });
# rmlint = prev.rmlint.override {
# # fixes "Checking whether the C compiler works... no"
# # rmlint is scons; it reads the CC environment variable, though, so *may* be cross compilable
# inherit (emulated) stdenv;
# };
# 2023/07/30: upstreaming requires some changes, as configure tries to invoke our `python`
# implemented (broken) on servo cross-staging-2023-07-30 branch
# rpm = prev.rpm.overrideAttrs (upstream: {
@ -1809,10 +1137,6 @@ in with final; {
# '';
# });
# sequoia = prev.sequoia.override {
# # fails to fix original error
# inherit (emulated) stdenv;
# };
snapshot = prev.snapshot.overrideAttrs (upstream: {
# fixes "error: linker `cc` not found"