From c5fdfbff1be9c5347eaf2ed711f18ff2f4db2733 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sun, 9 Apr 2023 18:37:54 -0700 Subject: [PATCH] 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. --- src/default.nix | 3 ++- src/platform/am1i/default.nix | 3 --- src/platform/common/amd64.nix | 4 ++++ src/platform/common/arm64.nix | 4 ++++ src/platform/kevin/default.nix | 2 -- src/platform/kgpe/default.nix | 3 --- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/default.nix b/src/default.nix index e7e61e3..de173fe 100644 --- a/src/default.nix +++ b/src/default.nix @@ -1,11 +1,12 @@ { lib ? import , pkgsFun ? import +, hostPlatform ? null # if left `null` this will be set based on the ./platform/ }: let nixpkgsArgs = { config.allowNonSource = false; }; nixpkgsOnBuildForBuild = pkgsFun nixpkgsArgs; - ownerboot = { hostPlatform?null, overlays }: let + ownerboot = { overlays }: let base = final: prev: { inherit hostPlatform; nixpkgsOnBuildForHost = pkgsFun diff --git a/src/platform/am1i/default.nix b/src/platform/am1i/default.nix index 4414608..8e444b7 100644 --- a/src/platform/am1i/default.nix +++ b/src/platform/am1i/default.nix @@ -1,10 +1,7 @@ { lib ? import -, hostPlatform ? lib.systems.examples.gnu64 , common_amd64 }: { - inherit hostPlatform; - overlays = common_amd64.overlays ++ [(final: prev: { platform_name = "am1i"; diff --git a/src/platform/common/amd64.nix b/src/platform/common/amd64.nix index a6fac26..859685f 100644 --- a/src/platform/common/amd64.nix +++ b/src/platform/common/amd64.nix @@ -3,5 +3,9 @@ { overlays = [( final: prev: { + hostPlatform = + if prev.hostPlatform != null + then prev.hostPlatform + else lib.systems.examples.gnu64; })]; } diff --git a/src/platform/common/arm64.nix b/src/platform/common/arm64.nix index c512951..1653ea0 100644 --- a/src/platform/common/arm64.nix +++ b/src/platform/common/arm64.nix @@ -3,5 +3,9 @@ { overlays = [(final: prev: { + hostPlatform = + if prev.hostPlatform != null + then prev.hostPlatform + else lib.systems.examples.aarch64-multiplatform; })]; } diff --git a/src/platform/kevin/default.nix b/src/platform/kevin/default.nix index 76ad720..6729a03 100644 --- a/src/platform/kevin/default.nix +++ b/src/platform/kevin/default.nix @@ -1,5 +1,4 @@ { lib ? import -, hostPlatform ? lib.systems.examples.aarch64-multiplatform , common_arm64 }: let @@ -35,7 +34,6 @@ let "drivers/net/wireless/marvell/mwifiex/mwifiex.ko" ]; in { - inherit hostPlatform; overlays = common_arm64.overlays ++ [(final: prev: { nixpkgsOnBuildForHost = prev.nixpkgsOnBuildForBuild.pkgsCross.aarch64-multiplatform; diff --git a/src/platform/kgpe/default.nix b/src/platform/kgpe/default.nix index 1184c87..20a3094 100644 --- a/src/platform/kgpe/default.nix +++ b/src/platform/kgpe/default.nix @@ -1,11 +1,8 @@ { lib ? import -, hostPlatform ? lib.systems.examples.gnu64 , common_amd64 }: { - inherit hostPlatform; - overlays = common_amd64.overlays ++ [(final: prev: { platform_name = "kgpe";