overlay: handle cross-only overrides consistently
This commit is contained in:
parent
528afae8b1
commit
985df8792d
134
overlay.nix
134
overlay.nix
@ -1,5 +1,7 @@
|
|||||||
final: prev:
|
final: prev:
|
||||||
let
|
let
|
||||||
|
isCross = final.stdenv.buildPlatform != final.stdenv.hostPlatform;
|
||||||
|
crossOnly = pkg : amendFn : if isCross then (amendFn pkg) else pkg;
|
||||||
extraPkgs = import ./pkgs/default.nix {
|
extraPkgs = import ./pkgs/default.nix {
|
||||||
inherit (final) lib callPackage;
|
inherit (final) lib callPackage;
|
||||||
};
|
};
|
||||||
@ -52,10 +54,12 @@ extraPkgs // {
|
|||||||
|
|
||||||
# keep these alphabetical
|
# keep these alphabetical
|
||||||
|
|
||||||
btrfs-progs = prev.btrfs-progs.override {
|
btrfs-progs = crossOnly prev.btrfs-progs (
|
||||||
udevSupport = false;
|
d: d.override {
|
||||||
udev = null;
|
udevSupport = false;
|
||||||
};
|
udev = null;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
chrony =
|
chrony =
|
||||||
let chrony' = prev.chrony.overrideAttrs(o: {
|
let chrony' = prev.chrony.overrideAttrs(o: {
|
||||||
@ -82,17 +86,13 @@ extraPkgs // {
|
|||||||
# but https://github.com/NixOS/nixpkgs/issues/284734
|
# but https://github.com/NixOS/nixpkgs/issues/284734
|
||||||
# so we do surgery on the cmake derivation until that's fixed
|
# so we do surgery on the cmake derivation until that's fixed
|
||||||
|
|
||||||
cmake = prev.cmake.overrideAttrs(o:
|
cmake = crossOnly prev.cmake
|
||||||
# don't override the build cmake or we'll have to rebuild
|
(d: d.overrideAttrs(o: {
|
||||||
# half the known universe to no useful benefit
|
|
||||||
if final.stdenv.buildPlatform != final.stdenv.hostPlatform
|
|
||||||
then {
|
|
||||||
preConfigure =
|
preConfigure =
|
||||||
builtins.replaceStrings
|
builtins.replaceStrings
|
||||||
["$configureFlags"] ["$configureFlags $cmakeFlags"] o.preConfigure;
|
["$configureFlags"] ["$configureFlags $cmakeFlags"] o.preConfigure;
|
||||||
}
|
}
|
||||||
else {}
|
));
|
||||||
);
|
|
||||||
|
|
||||||
dnsmasq =
|
dnsmasq =
|
||||||
let d = prev.dnsmasq.overrideAttrs(o: {
|
let d = prev.dnsmasq.overrideAttrs(o: {
|
||||||
@ -114,20 +114,15 @@ extraPkgs // {
|
|||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
|
|
||||||
elfutils =
|
elfutils = crossOnly prev.elfutils
|
||||||
let native = (with final.stdenv; (buildPlatform == hostPlatform));
|
(d: let e = d.overrideAttrs(o: {
|
||||||
in if native
|
configureFlags = o.configureFlags ++[
|
||||||
then prev.elfutils
|
"ac_cv_has_stdatomic=no"
|
||||||
else
|
];
|
||||||
let
|
});
|
||||||
e = prev.elfutils.overrideAttrs(o: {
|
in e.override {
|
||||||
configureFlags = o.configureFlags ++[
|
enableDebuginfod = false;
|
||||||
"ac_cv_has_stdatomic=no"
|
});
|
||||||
];
|
|
||||||
});
|
|
||||||
in e.override {
|
|
||||||
enableDebuginfod = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
hostapd =
|
hostapd =
|
||||||
let
|
let
|
||||||
@ -159,7 +154,7 @@ extraPkgs // {
|
|||||||
|
|
||||||
# berlekey db needs libatomic which we haven't figured out yet.
|
# berlekey db needs libatomic which we haven't figured out yet.
|
||||||
# disabling it means we don't have arpd
|
# disabling it means we don't have arpd
|
||||||
iproute2 = prev.iproute2.override { db = null; };
|
iproute2 = crossOnly prev.iproute2 (d: d.override { db = null; });
|
||||||
|
|
||||||
kexec-tools-static = prev.kexec-tools.overrideAttrs(o: {
|
kexec-tools-static = prev.kexec-tools.overrideAttrs(o: {
|
||||||
# For kexecboot we copy kexec into a ramdisk on the system being
|
# For kexecboot we copy kexec into a ramdisk on the system being
|
||||||
@ -197,41 +192,54 @@ extraPkgs // {
|
|||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
openssl = prev.openssl.overrideAttrs (o:
|
openssl = crossOnly prev.openssl
|
||||||
with final;
|
(d: d.overrideAttrs (o:
|
||||||
let cross = stdenv.buildPlatform != stdenv.hostPlatform;
|
with final; {
|
||||||
in
|
# we want to apply
|
||||||
{
|
# https://patch-diff.githubusercontent.com/raw/openssl/openssl/pull/20273.patch";
|
||||||
# we want to apply
|
# which disables overriding the -march cflags to the wrong values,
|
||||||
# https://patch-diff.githubusercontent.com/raw/openssl/openssl/pull/20273.patch";
|
# but openssl is used for bootstrapping so that's easier said than
|
||||||
# which disables overriding the -march cflags to the wrong values,
|
# done. Do it the ugly way..
|
||||||
# but openssl is used for bootstrapping so that's easier said than
|
postPatch =
|
||||||
# done. Do it the ugly way..
|
o.postPatch
|
||||||
postPatch =
|
+ ''
|
||||||
o.postPatch
|
sed -i.bak 's/linux.*-mips/linux-mops/' Configure
|
||||||
+ (
|
'';
|
||||||
lib.optionalString cross ''
|
# openssl with threads requires stdatomic which drags in libgcc
|
||||||
sed -i.bak 's/linux.*-mips/linux-mops/' Configure
|
# as a dependency
|
||||||
''
|
configureFlags = ["no-threads"] ++ o.configureFlags;
|
||||||
);
|
|
||||||
# openssl with threads requires stdatomic which drags in libgcc
|
|
||||||
# as a dependency
|
|
||||||
configureFlags = []
|
|
||||||
++ (lib.optional cross "no-threads")
|
|
||||||
++ o.configureFlags;
|
|
||||||
|
|
||||||
# don't need or want this bash script
|
# don't need or want this bash script
|
||||||
postInstall = o.postInstall +
|
postInstall = o.postInstall + "rm $bin/bin/c_rehash\n";
|
||||||
(lib.optionalString cross "rm $bin/bin/c_rehash\n");
|
}
|
||||||
});
|
));
|
||||||
|
|
||||||
pppBuild = prev.ppp;
|
pppBuild = prev.ppp;
|
||||||
|
|
||||||
qemuLim = let q = prev.qemu.overrideAttrs (o: {
|
qemuLim = let q = prev.qemu.overrideAttrs (o: {
|
||||||
patches = o.patches ++ [
|
patches = o.patches ++ [
|
||||||
./pkgs/qemu/arm-image-friendly-load-addr.patch
|
./pkgs/qemu/arm-image-friendly-load-addr.patch
|
||||||
|
(final.fetchpatch {
|
||||||
|
url = "https://lore.kernel.org/qemu-devel/20220322154658.1687620-1-raj.khem@gmail.com/raw";
|
||||||
|
hash = "sha256-jOsGka7xLkJznb9M90v5TsJraXXTAj84lcphcSxjYLU=";
|
||||||
|
})
|
||||||
];
|
];
|
||||||
}); in q.override { nixosTestRunner = true; sdlSupport = false; };
|
}); in q.override {
|
||||||
|
nixosTestRunner = true;
|
||||||
|
hostCpuTargets = map (f: "${f}-softmmu") [
|
||||||
|
"arm" "aarch64" "mips" "mipsel"
|
||||||
|
];
|
||||||
|
sdlSupport = false;
|
||||||
|
numaSupport = false;
|
||||||
|
seccompSupport = false;
|
||||||
|
usbredirSupport = false;
|
||||||
|
libiscsiSupport = false;
|
||||||
|
tpmSupport = false;
|
||||||
|
uringSupport = false;
|
||||||
|
capstoneSupport = false;
|
||||||
|
|
||||||
|
texinfo = null;
|
||||||
|
};
|
||||||
|
|
||||||
rsyncSmall =
|
rsyncSmall =
|
||||||
let
|
let
|
||||||
@ -304,16 +312,16 @@ extraPkgs // {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
libusb1 =
|
libusb1 = crossOnly prev.libusb1 (
|
||||||
let u = prev.libusb1.overrideAttrs(o: {
|
d: let u = d.overrideAttrs(o: {
|
||||||
# don't use gcc libatomic because it vastly increases the
|
# don't use gcc libatomic because it vastly increases the
|
||||||
# closure size
|
# closure size
|
||||||
preConfigure = "sed -i.bak /__atomic_fetch_add_4/c\: configure.ac";
|
preConfigure = "sed -i.bak /__atomic_fetch_add_4/c\: configure.ac";
|
||||||
});
|
});
|
||||||
in u.override {
|
in u.override {
|
||||||
enableUdev = final.stdenv.buildPlatform == final.stdenv.hostPlatform;
|
enableUdev = false;
|
||||||
withDocs = false;
|
withDocs = false;
|
||||||
};
|
});
|
||||||
|
|
||||||
util-linux-small = prev.util-linux.override {
|
util-linux-small = prev.util-linux.override {
|
||||||
ncursesSupport = false;
|
ncursesSupport = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user