From 6bd35bf4d5f24b8e91d8afa589ea3088796b2baa Mon Sep 17 00:00:00 2001 From: Jake Hamilton Date: Sat, 15 Jun 2024 04:18:05 -0700 Subject: [PATCH] feat: rich platform information --- tidepool/src/builders/basic.nix | 2 +- tidepool/src/lib/packages.nix | 2 +- tidepool/src/lib/systems.nix | 4 ++-- tidepool/src/lib/types.nix | 30 +++++++++++++++++++++--- tidepool/src/packages/aux/foundation.nix | 2 +- tidepool/src/packages/default.nix | 1 + 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/tidepool/src/builders/basic.nix b/tidepool/src/builders/basic.nix index 0a939ba..ba2b042 100644 --- a/tidepool/src/builders/basic.nix +++ b/tidepool/src/builders/basic.nix @@ -25,7 +25,7 @@ in { ) sorted.result; - system = package.platform.build; + system = package.platform.build.double; in builtins.derivation ( package.env diff --git a/tidepool/src/lib/packages.nix b/tidepool/src/lib/packages.nix index ca677f2..a2a9959 100644 --- a/tidepool/src/lib/packages.nix +++ b/tidepool/src/lib/packages.nix @@ -34,7 +34,7 @@ platform = { build = system; host = cross; - target = cross; + target = lib.modules.override 150 cross; }; deps = { diff --git a/tidepool/src/lib/systems.nix b/tidepool/src/lib/systems.nix index cc12b17..7f2ae97 100644 --- a/tidepool/src/lib/systems.nix +++ b/tidepool/src/lib/systems.nix @@ -1460,8 +1460,8 @@ in { lib.strings.when (kernel.name == "netbsd" && netbsdExec != kernel.exec) kernel.exec.name; - abi = lib.strings.when (abi != types.abis.unknown) "-${abi.name}"; - in "${cpu.name}-${vendor.name}-${kernelName}${exec}${abi}"; + abi' = lib.strings.when (abi != types.abis.unknown) "-${abi.name}"; + in "${cpu.name}-${vendor.name}-${kernelName}${exec}${abi'}"; }; create = components: diff --git a/tidepool/src/lib/types.nix b/tidepool/src/lib/types.nix index bb3d00a..8945019 100644 --- a/tidepool/src/lib/types.nix +++ b/tidepool/src/lib/types.nix @@ -169,19 +169,43 @@ build = lib.options.create { description = "The build platform for the package."; type = lib.types.string; - default.value = "unknown"; + default.value = "x86_64-linux"; + apply = raw: let + system = lib'.systems.from.string raw; + in { + inherit raw system; + + double = lib'.systems.into.double system; + triple = lib'.systems.into.triple system; + }; }; host = lib.options.create { description = "The host platform for the package."; type = lib.types.string; - default.value = "unknown"; + default.value = "x86_64-linux"; + apply = raw: let + system = lib'.systems.from.string raw; + in { + inherit raw system; + + double = lib'.systems.into.double system; + triple = lib'.systems.into.triple system; + }; }; target = lib.options.create { description = "The target platform for the package."; type = lib.types.string; - default.value = "unknown"; + default.value = "x86_64-linux"; + apply = raw: let + system = lib'.systems.from.string raw; + in { + inherit raw system; + + double = lib'.systems.into.double system; + triple = lib'.systems.into.triple system; + }; }; }; diff --git a/tidepool/src/packages/aux/foundation.nix b/tidepool/src/packages/aux/foundation.nix index d61a3d1..2d769e7 100644 --- a/tidepool/src/packages/aux/foundation.nix +++ b/tidepool/src/packages/aux/foundation.nix @@ -24,7 +24,7 @@ in { phases = { build = '' - make --build ${config.platform.build} --host ${config.platform.host} + make --build ${config.platform.build.double} --host ${config.platform.host.double} ''; install = lib.dag.entry.after ["build"] '' diff --git a/tidepool/src/packages/default.nix b/tidepool/src/packages/default.nix index 49bafa4..555922c 100644 --- a/tidepool/src/packages/default.nix +++ b/tidepool/src/packages/default.nix @@ -51,6 +51,7 @@ in { config = { platform = { host = lib.modules.overrides.force system; + target = lib.modules.overrides.default system; }; deps = {