nixos-configuration/pkgs/overlays/unstable-from-source.nix
Wroclaw ec91266fcd pkgs/overlays/unstable-latest: init
this reuses code that was removed in 77ef7434f2
2025-02-09 08:23:49 +01:00

37 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"
];
unstablePkgsForNixpkgs = nixpkgs: import unstableSource {
# localSystem -> pkgs.stdenv.buildPlatform
localSystem = sanitizePlatform nixpkgs.stdenv.buildPlatform;
# 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.
crossSystem = sanitizePlatform nixpkgs.stdenv.hostPlatform;
});
in
{
"${attributeName}" = if useUnstable then unstablePkgsForNixpkgs self else self;
}