2024-09-14 19:47:41 +02:00
|
|
|
{
|
|
|
|
unstableSource,
|
|
|
|
}:
|
|
|
|
|
|
|
|
self: super:
|
|
|
|
|
|
|
|
let
|
|
|
|
useUnstable = self.config.useUnstable or true;
|
2024-09-14 19:49:32 +02:00
|
|
|
sanitizePlatform = platformConfig: self.lib.removeAttrs platformConfig [
|
|
|
|
"emulator"
|
|
|
|
"emulatorAvailable"
|
|
|
|
];
|
2024-09-14 19:47:41 +02:00
|
|
|
|
|
|
|
unstablePkgsForNixpkgs = nixpkgs: import unstableSource {
|
|
|
|
# localSystem -> pkgs.stdenv.buildPlatform
|
2024-09-14 19:49:32 +02:00
|
|
|
localSystem = sanitizePlatform nixpkgs.stdenv.buildPlatform;
|
2024-09-14 19:47:41 +02:00
|
|
|
# crossSystem -> pkgs.stdenv.hostPlatform or pkgs.stdenv.targetPlatform ??
|
|
|
|
# passing below
|
|
|
|
# config -> pkgs.config
|
|
|
|
config = nixpkgs.config;
|
|
|
|
# overlays -> partial of pkgs.overlays
|
|
|
|
overlays = nixpkgs.overlays;
|
|
|
|
# crossOverlays -> partial of pkgs.overlays
|
|
|
|
# crossOverlays are merged to overlays, not sure what issues that might raise.
|
|
|
|
# ignoring.
|
|
|
|
} // (if nixpkgs.stdenv.buildPlatform == nixpkgs.stdenv.hostPlatform then {} else {
|
|
|
|
# workaround for some odd structured packages that changes behaviour
|
|
|
|
# when crossSystem is passed.
|
2024-09-14 19:49:32 +02:00
|
|
|
crossSystem = sanitizePlatform nixpkgs.stdenv.hostPlatform;
|
2024-09-14 19:47:41 +02:00
|
|
|
});
|
|
|
|
in
|
|
|
|
{
|
|
|
|
unstable = if useUnstable then unstablePkgsForNixpkgs self else self;
|
|
|
|
}
|