src/default.nix: use a list of overlays rather than a single overlay

This commit changes from using a single overlay to using a
nixpkgs-like list of overlays chained together by
`lib.composeExtensions`.
master
Adam Joseph 2 years ago
parent 66fecd2adf
commit 3bdb75a387

@ -5,25 +5,31 @@ let
nixpkgsArgs = { config.allowNonSource = false; }; nixpkgsArgs = { config.allowNonSource = false; };
nixpkgsOnBuildForBuild = pkgsFun nixpkgsArgs; nixpkgsOnBuildForBuild = pkgsFun nixpkgsArgs;
ownerboot = { hostPlatform?null, overlay }: ownerboot = { hostPlatform?null, overlays }: let
(lib.makeScope lib.callPackageWith (self: { base = final: prev: {
inherit lib nixpkgsOnBuildForBuild; inherit hostPlatform;
nixpkgsOnBuildForHost = pkgsFun
(nixpkgsArgs
// (lib.optionalAttrs (final.hostPlatform!=null) {
crossSystem = final.hostPlatform;
}));
nixpkgsOnBuildForHost = pkgsFun coreboot-toolchain = final.callPackage ./coreboot-toolchain { };
(nixpkgsArgs // (lib.optionalAttrs (hostPlatform!=null) {
crossSystem = hostPlatform; }));
coreboot-toolchain = self.callPackage ./coreboot-toolchain { }; iasl_20180531 = final.nixpkgsOnBuildForBuild.callPackage ./coreboot/iasl_20180531 { };
coreboot = final.callPackage ./coreboot {
iasl_20180531 = self.nixpkgsOnBuildForBuild.callPackage ./coreboot/iasl_20180531 { }; initramfs_image = final.initramfs;
coreboot = self.callPackage ./coreboot {
initramfs_image = self.initramfs;
}; };
kernel = self.callPackage ./kernel { }; kernel = final.callPackage ./kernel { };
userspace = self.callPackage ./userspace { }; userspace = final.callPackage ./userspace { };
initramfs = self.callPackage ./initramfs { }; initramfs = final.callPackage ./initramfs { };
})) };
.overrideScope' overlay; in
(lib.makeScope
lib.callPackageWith
(self: { inherit lib nixpkgsOnBuildForBuild; })).overrideScope'
(lib.foldl' lib.composeExtensions (_: prev: prev) ([base] ++ overlays));
in { in {
# one entry for each supported platform # one entry for each supported platform
kevin = ownerboot (import ./platform/kevin { inherit lib; }); kevin = ownerboot (import ./platform/kevin { inherit lib; });

@ -4,7 +4,7 @@
{ {
inherit hostPlatform; inherit hostPlatform;
overlay = (final: prev: { overlays = [(final: prev: {
platform_name = "am1i"; platform_name = "am1i";
@ -35,6 +35,6 @@
cp src/mainboard/asus/am1i-a/cmos.layout $out/ cp src/mainboard/asus/am1i-a/cmos.layout $out/
''; '';
}); });
}); })];
} }

@ -36,7 +36,7 @@ let
in { in {
inherit hostPlatform; inherit hostPlatform;
overlay = (final: prev: { overlays = [(final: prev: {
nixpkgsOnBuildForHost = prev.nixpkgsOnBuildForBuild.pkgsCross.aarch64-multiplatform; nixpkgsOnBuildForHost = prev.nixpkgsOnBuildForBuild.pkgsCross.aarch64-multiplatform;
platform_name = "kevin"; platform_name = "kevin";
@ -107,5 +107,5 @@ in {
}; };
ectool = final.nixpkgsOnBuildForHost.callPackage (import ../../util/ectool { boardName = "kevin"; }) { }; ectool = final.nixpkgsOnBuildForHost.callPackage (import ../../util/ectool { boardName = "kevin"; }) { };
}); })];
} }

@ -5,7 +5,7 @@
{ {
inherit hostPlatform; inherit hostPlatform;
overlay = (final: prev: { overlays = [(final: prev: {
platform_name = "kgpe"; platform_name = "kgpe";
@ -70,5 +70,5 @@
cp src/mainboard/asus/kgpe-d16/cmos.default $out/ cp src/mainboard/asus/kgpe-d16/cmos.default $out/
''; '';
}); });
}); })];
} }

Loading…
Cancel
Save