feat: rich platform information

This commit is contained in:
Jake Hamilton 2024-06-15 04:18:05 -07:00
parent 1c67c40213
commit 6bd35bf4d5
Signed by untrusted user: jakehamilton
GPG key ID: 9762169A1B35EA68
6 changed files with 33 additions and 8 deletions

View file

@ -25,7 +25,7 @@ in {
) )
sorted.result; sorted.result;
system = package.platform.build; system = package.platform.build.double;
in in
builtins.derivation ( builtins.derivation (
package.env package.env

View file

@ -34,7 +34,7 @@
platform = { platform = {
build = system; build = system;
host = cross; host = cross;
target = cross; target = lib.modules.override 150 cross;
}; };
deps = { deps = {

View file

@ -1460,8 +1460,8 @@ in {
lib.strings.when lib.strings.when
(kernel.name == "netbsd" && netbsdExec != kernel.exec) (kernel.name == "netbsd" && netbsdExec != kernel.exec)
kernel.exec.name; kernel.exec.name;
abi = lib.strings.when (abi != types.abis.unknown) "-${abi.name}"; abi' = lib.strings.when (abi != types.abis.unknown) "-${abi.name}";
in "${cpu.name}-${vendor.name}-${kernelName}${exec}${abi}"; in "${cpu.name}-${vendor.name}-${kernelName}${exec}${abi'}";
}; };
create = components: create = components:

View file

@ -169,19 +169,43 @@
build = lib.options.create { build = lib.options.create {
description = "The build platform for the package."; description = "The build platform for the package.";
type = lib.types.string; 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 { host = lib.options.create {
description = "The host platform for the package."; description = "The host platform for the package.";
type = lib.types.string; 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 { target = lib.options.create {
description = "The target platform for the package."; description = "The target platform for the package.";
type = lib.types.string; 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;
};
}; };
}; };

View file

@ -24,7 +24,7 @@ in {
phases = { phases = {
build = '' 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"] '' install = lib.dag.entry.after ["build"] ''

View file

@ -51,6 +51,7 @@ in {
config = { config = {
platform = { platform = {
host = lib.modules.overrides.force system; host = lib.modules.overrides.force system;
target = lib.modules.overrides.default system;
}; };
deps = { deps = {