src/platform/*: move hostPlatform into the packageset

This commit makes `hostPlatform` part of the packageset for more
consistent handling.  A top-level `hostPlatform` argument is exposed
to the caller, in case they want to customize the `hostPlatform`
(compiler flags, etc).

The `hostPlatform` argument is inherited into the ownerboot package
set, where it will be overridden by `src/platform/*.nix` if it has
not been set explicitly.

Making `hostPlatform` part of the package set allows for more
sophisticated overriding schemes, for example adding additional
compiler flags or sanity-checking the flags that the user has
provided.
master
Adam Joseph 2 years ago
parent 197e82f050
commit c5fdfbff1b

@ -1,11 +1,12 @@
{ lib ? import <nixpkgs/lib> { lib ? import <nixpkgs/lib>
, pkgsFun ? import <nixpkgs> , pkgsFun ? import <nixpkgs>
, hostPlatform ? null # if left `null` this will be set based on the ./platform/
}: }:
let let
nixpkgsArgs = { config.allowNonSource = false; }; nixpkgsArgs = { config.allowNonSource = false; };
nixpkgsOnBuildForBuild = pkgsFun nixpkgsArgs; nixpkgsOnBuildForBuild = pkgsFun nixpkgsArgs;
ownerboot = { hostPlatform?null, overlays }: let ownerboot = { overlays }: let
base = final: prev: { base = final: prev: {
inherit hostPlatform; inherit hostPlatform;
nixpkgsOnBuildForHost = pkgsFun nixpkgsOnBuildForHost = pkgsFun

@ -1,10 +1,7 @@
{ lib ? import <nixpkgs/lib> { lib ? import <nixpkgs/lib>
, hostPlatform ? lib.systems.examples.gnu64
, common_amd64 , common_amd64
}: }:
{ {
inherit hostPlatform;
overlays = common_amd64.overlays ++ [(final: prev: { overlays = common_amd64.overlays ++ [(final: prev: {
platform_name = "am1i"; platform_name = "am1i";

@ -3,5 +3,9 @@
{ {
overlays = [( final: prev: { overlays = [( final: prev: {
hostPlatform =
if prev.hostPlatform != null
then prev.hostPlatform
else lib.systems.examples.gnu64;
})]; })];
} }

@ -3,5 +3,9 @@
{ {
overlays = [(final: prev: { overlays = [(final: prev: {
hostPlatform =
if prev.hostPlatform != null
then prev.hostPlatform
else lib.systems.examples.aarch64-multiplatform;
})]; })];
} }

@ -1,5 +1,4 @@
{ lib ? import <nixpkgs/lib> { lib ? import <nixpkgs/lib>
, hostPlatform ? lib.systems.examples.aarch64-multiplatform
, common_arm64 , common_arm64
}: }:
let let
@ -35,7 +34,6 @@ let
"drivers/net/wireless/marvell/mwifiex/mwifiex.ko" "drivers/net/wireless/marvell/mwifiex/mwifiex.ko"
]; ];
in { in {
inherit hostPlatform;
overlays = common_arm64.overlays ++ [(final: prev: { overlays = common_arm64.overlays ++ [(final: prev: {
nixpkgsOnBuildForHost = prev.nixpkgsOnBuildForBuild.pkgsCross.aarch64-multiplatform; nixpkgsOnBuildForHost = prev.nixpkgsOnBuildForBuild.pkgsCross.aarch64-multiplatform;

@ -1,11 +1,8 @@
{ lib ? import <nixpkgs/lib> { lib ? import <nixpkgs/lib>
, hostPlatform ? lib.systems.examples.gnu64
, common_amd64 , common_amd64
}: }:
{ {
inherit hostPlatform;
overlays = common_amd64.overlays ++ [(final: prev: { overlays = common_amd64.overlays ++ [(final: prev: {
platform_name = "kgpe"; platform_name = "kgpe";

Loading…
Cancel
Save