idiosyn/overlay.nix
2024-07-27 13:28:05 +02:00

92 lines
2.3 KiB
Nix

{ nixpkgs, ... }: final: prev:
let
inherit (final)
lib
hostPlatform
callPackage
addAttrsToDerivation;
inherit (lib)
optionalAttrs
toList;
pkgs = import nixpkgs {
localSystem = final.buildPlatform;
crossSystem = final.hostPlatform;
config = removeAttrs final.config [
"replaceStdenv"
"replaceCrossStdenv"
];
};
idiosyn = import ./stdenv.nix pkgs;
attrs = pkg: fun: pkg.overrideAttrs (base: builtins.trace "overrideAttrs applied to ${pkg.pname}"
optionalAttrs (!base ? idiosynApplied) (fun base // {
idiosynApplied = null;
}));
patch = pkg: patches: attrs pkg (base: {
patches = base.patches or [ ]
++ patches;
});
gentoo-patches = final.fetchgit {
url = "https://anongit.gentoo.org/git/repo/gentoo.git";
rev = "fa77d52a7ff39464c50707ca024725deab08b534";
sparseCheckout = [ "*.patch" ];
nonConeMode = true;
hash = "sha256-ZTrPeo8TjKSDAUyeJyWq1C8O9EXd9uhClHlphPsFXCA=";
};
in optionalAttrs (!prev ? idiosyn) {
inherit idiosyn;
buildPackages = prev.buildPackages // {
stdenv = final.stdenv;
};
busybox = prev.busybox.override {
stdenv = final.gccStdenv;
};
efivar = attrs prev.efivar (base: {
buildFlags = base.buildFlags or [ ]
++ [ "CC=$(CC)" ];
});
icu = attrs prev.icu (base: {
configureFlags = base.configureFlags or [ ]
++ [ "ac_cv_c_bigendian=${if hostPlatform.isBigEndian then "yes" else "no"}" ];
});
keyutils = attrs prev.keyutils (base: {
LDFLAGS = base.LDFLAGS or [ ]
++ [ "-Wl,--undefined-version" ];
});
kexec-tools = prev.kexec-tools.override {
stdenv = final.gccStdenv;
};
libgcrypt = attrs prev.libgcrypt (base: {
configureFlags = base.configureFlags or [ ]
++ [ "--disable-jent-support" ];
});
libxcrypt = patch prev.libxcrypt
[ ./patches/libxcrypt-4.4.36-symbol-map.patch ];
mbrola = prev.mbrola.override {
stdenv = addAttrsToDerivation (base: {
env = base.env or { } // {
NIX_CFLAGS_COMPILE = toString (toList base.env.NIX_CFLAGS_COMPILE or [ ]
++ [ "-Wno-error=implicit-function-declaration" ]);
};
}) final.stdenv;
};
musl = attrs prev.musl (base: {
LDFLAGS = base.LDFLAGS or [ ]
++ [ "-Wl,-u,__dls2" ];
});
}