40 lines
1.2 KiB
Nix
40 lines
1.2 KiB
Nix
{
|
|
unstableSource,
|
|
attributeName ? "unstable",
|
|
}:
|
|
|
|
self: super:
|
|
|
|
let
|
|
useUnstable = self.config.useUnstable or true;
|
|
sanitizePlatform = platformConfig: self.lib.removeAttrs platformConfig [
|
|
"emulator"
|
|
"emulatorAvailable"
|
|
"darwinSdkVersion"
|
|
"darwinMinVersion"
|
|
"parsed"
|
|
];
|
|
|
|
unstablePkgs = import unstableSource {
|
|
# localSystem -> pkgs.stdenv.buildPlatform
|
|
localSystem = sanitizePlatform self.stdenv.buildPlatform;
|
|
# crossSystem -> pkgs.stdenv.hostPlatform or pkgs.stdenv.targetPlatform ??
|
|
# passing below
|
|
# config -> pkgs.config
|
|
config = self.config;
|
|
# overlays -> partial of pkgs.overlays
|
|
overlays = self.overlays;
|
|
# crossOverlays -> partial of pkgs.overlays
|
|
# crossOverlays are merged to overlays, not sure what issues that might raise.
|
|
# ignoring.
|
|
} // self.lib.optionalAttrs (
|
|
self.lib.systems.equals self.stdenv.buildPlatform self.stdenv.hostPlatform
|
|
) {
|
|
# workaround for some odd structured packages that changes behaviour
|
|
# when crossSystem is passed.
|
|
crossSystem = sanitizePlatform self.stdenv.hostPlatform;
|
|
};
|
|
in
|
|
{
|
|
"${attributeName}" = if useUnstable then unstablePkgs else self;
|
|
}
|