Compare commits
No commits in common. "0a63667459ceba51b867106c6985b06bbdf71603" and "8233d4aedf655019192538ee3e8a81e663673d30" have entirely different histories.
0a63667459
...
8233d4aedf
|
@ -3,10 +3,10 @@
|
||||||
"lib": {
|
"lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"dirtyRev": "2be3111b2c0911f40b47fe0a1fb22b5f5188cf59-dirty",
|
"dirtyRev": "9850da8aa9dc9be22e237c9b424a18e801e53ecb-dirty",
|
||||||
"dirtyShortRev": "2be3111-dirty",
|
"dirtyShortRev": "9850da8-dirty",
|
||||||
"lastModified": 1719251485,
|
"lastModified": 1718529861,
|
||||||
"narHash": "sha256-63NvfFVeTDITfNu60rmCUlaZtAeZUnvrIaOLSk9ScC8=",
|
"narHash": "sha256-tv/0C7ixH+9Ij+r+5nua48OlXXXnbdEsnenxX4eG/Sk=",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../?dir=lib"
|
"url": "file:../?dir=lib"
|
||||||
},
|
},
|
||||||
|
|
|
@ -43,7 +43,7 @@ lib: {
|
||||||
resolve =
|
resolve =
|
||||||
definition:
|
definition:
|
||||||
let
|
let
|
||||||
properties = builtins.addErrorContext "while evaluating definitions from `${definition.__file__ or "<unknown>"}`:" (
|
properties = builtins.addErrorContext "while evaluating definitions from `${definition.__file__}`:" (
|
||||||
lib.modules.apply.properties definition.value
|
lib.modules.apply.properties definition.value
|
||||||
);
|
);
|
||||||
normalize = value: {
|
normalize = value: {
|
||||||
|
|
|
@ -1100,43 +1100,6 @@ lib: {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
## Create a type that allows a value which is either the final type or is transformable
|
|
||||||
## to the final type.
|
|
||||||
##
|
|
||||||
## @type Attrs -> (Any -> Any) -> Attrs -> Attrs
|
|
||||||
coerceWithLocation =
|
|
||||||
initial: transform: final:
|
|
||||||
let
|
|
||||||
in
|
|
||||||
if initial.getSubModules != null then
|
|
||||||
builtins.throw "lib.types.coerceWithLocation's first argument may not have submodules, but got ${initial.description}"
|
|
||||||
else
|
|
||||||
lib.types.create {
|
|
||||||
name = "Coerce";
|
|
||||||
description = "${initial.description} that is transformed to ${final.description}";
|
|
||||||
fallback = final.fallback;
|
|
||||||
check = value: final.check value || (initial.check value && final.check (transform [ ] value));
|
|
||||||
merge =
|
|
||||||
location: definitions:
|
|
||||||
let
|
|
||||||
process = value: if initial.check value then transform location value else value;
|
|
||||||
normalize = definition: definition // { value = process definition.value; };
|
|
||||||
normalized = builtins.map normalize definitions;
|
|
||||||
in
|
|
||||||
final.merge location normalized;
|
|
||||||
getSubOptions = final.getSubOptions;
|
|
||||||
getSubModules = final.getSubModules;
|
|
||||||
withSubModules =
|
|
||||||
modules: lib.types.coerceWithLocation initial transform (final.withSubModules modules);
|
|
||||||
mergeType = x: y: null;
|
|
||||||
functor = lib.types.functor "coerceWithLocation" // {
|
|
||||||
wrapped = final;
|
|
||||||
};
|
|
||||||
children = {
|
|
||||||
inherit initial final;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
dag = {
|
dag = {
|
||||||
## Create a type that allows a DAG (Directed Acyclic Graph) of a given type.
|
## Create a type that allows a DAG (Directed Acyclic Graph) of a given type.
|
||||||
##
|
##
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "foundation",
|
"dir": "foundation",
|
||||||
"dirtyRev": "2be3111b2c0911f40b47fe0a1fb22b5f5188cf59-dirty",
|
"dirtyRev": "9850da8aa9dc9be22e237c9b424a18e801e53ecb-dirty",
|
||||||
"dirtyShortRev": "2be3111-dirty",
|
"dirtyShortRev": "9850da8-dirty",
|
||||||
"lastModified": 1719251485,
|
"lastModified": 1718529861,
|
||||||
"narHash": "sha256-9G1TPBdlQNXCZf6A66bCT9m2vhodkSF+rDtqOVuFteY=",
|
"narHash": "sha256-X1Wd6mDz8GTaoxt1ylkvZfrJOcZtspJrEjXMtJ2ZyG0=",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../?dir=foundation"
|
"url": "file:../?dir=foundation"
|
||||||
},
|
},
|
||||||
|
@ -24,10 +24,10 @@
|
||||||
"lib": {
|
"lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"dirtyRev": "2be3111b2c0911f40b47fe0a1fb22b5f5188cf59-dirty",
|
"dirtyRev": "9850da8aa9dc9be22e237c9b424a18e801e53ecb-dirty",
|
||||||
"dirtyShortRev": "2be3111-dirty",
|
"dirtyShortRev": "9850da8-dirty",
|
||||||
"lastModified": 1719251485,
|
"lastModified": 1718529861,
|
||||||
"narHash": "sha256-9G1TPBdlQNXCZf6A66bCT9m2vhodkSF+rDtqOVuFteY=",
|
"narHash": "sha256-X1Wd6mDz8GTaoxt1ylkvZfrJOcZtspJrEjXMtJ2ZyG0=",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../?dir=lib"
|
"url": "file:../?dir=lib"
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,18 +14,8 @@ in
|
||||||
build =
|
build =
|
||||||
package:
|
package:
|
||||||
let
|
let
|
||||||
phases = lib.dag.apply.defaults package.phases {
|
phases = package.phases;
|
||||||
unpack = lib.dag.entry.before [ "patch" ] "";
|
sorted = lib.dag.sort.topological phases;
|
||||||
|
|
||||||
patch = lib.dag.entry.between [ "configure" ] [ "unpack" ] "";
|
|
||||||
|
|
||||||
configure = lib.dag.entry.between [ "build" ] [ "patch" ] "";
|
|
||||||
|
|
||||||
build = lib.dag.entry.between [ "install" ] [ "configure" ] "";
|
|
||||||
|
|
||||||
install = lib.dag.entry.after [ "build" ] "";
|
|
||||||
};
|
|
||||||
sorted = lib.dag.sort.topographic phases;
|
|
||||||
|
|
||||||
script = lib.strings.concatMapSep "\n" (
|
script = lib.strings.concatMapSep "\n" (
|
||||||
entry: if builtins.isFunction entry.value then entry.value package else entry.value
|
entry: if builtins.isFunction entry.value then entry.value package else entry.value
|
||||||
|
@ -80,13 +70,7 @@ in
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
built
|
built // { inherit (package) meta; };
|
||||||
// {
|
|
||||||
inherit (package) meta;
|
|
||||||
extras = {
|
|
||||||
inherit package;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
# This file handles creating all of the exports for this project and is not
|
# This file handles creating all of the exports for this project and is not
|
||||||
# exported itself.
|
# exported itself.
|
||||||
{ config }:
|
{ lib, config }:
|
||||||
let
|
let
|
||||||
inherit (config) lib;
|
lib' = config.lib;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# freeform = lib.types.any;
|
freeform = lib.types.any;
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
exports = {
|
exports = {
|
||||||
inherit lib;
|
lib = config.lib;
|
||||||
modules = import ./modules.nix;
|
modules = import ./modules.nix;
|
||||||
|
|
||||||
packages = {
|
packages = {
|
||||||
aux-a = config.packages.aux.a;
|
|
||||||
|
|
||||||
# foundation-gcc-x86_64 =
|
# foundation-gcc-x86_64 =
|
||||||
# (config.packages.foundation.gcc.versions."13.2.0".extend (args: {
|
# (config.packages.foundation.gcc.versions."13.2.0".extend (args: {
|
||||||
# config = {
|
# config = {
|
||||||
|
@ -26,13 +24,11 @@ in
|
||||||
# .config;
|
# .config;
|
||||||
foundation-gcc = config.packages.foundation.gcc;
|
foundation-gcc = config.packages.foundation.gcc;
|
||||||
foundation-binutils = config.packages.foundation.binutils;
|
foundation-binutils = config.packages.foundation.binutils;
|
||||||
foundation-linux-headers = config.packages.foundation.linux-headers;
|
foundation-linux-headers = config.packages.foundation.linux-headers.versions.latest.extend {
|
||||||
# foundation-linux-headers = config.packages.foundation.linux-headers.versions.latest.extend {
|
platform.host = lib.modules.overrides.force "x86_64-linux";
|
||||||
# platform.host = lib.modules.overrides.force "x86_64-linux";
|
};
|
||||||
# };
|
|
||||||
# example-x = config.packages.example.x;
|
# example-x = config.packages.example.x;
|
||||||
cross-aux-a-x86_64-linux = config.packages.cross.x86_64-linux.aux.a;
|
# cross-example-x-x86_64-linux = config.packages.cross.x86_64-linux.example.x;
|
||||||
cross-foundation-gcc-x86_64-linux = config.packages.cross.x86_64-linux.foundation.gcc;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ in
|
||||||
config = {
|
config = {
|
||||||
lib.options = {
|
lib.options = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
type = config.lib.types.package.base;
|
type = config.lib.types.package;
|
||||||
description = "A package definition.";
|
description = "A package definition.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{ lib, config }:
|
{
|
||||||
let
|
lib,
|
||||||
lib' = config.lib;
|
lib',
|
||||||
in
|
config,
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
config = {
|
config = {
|
||||||
lib.packages = {
|
lib.packages = {
|
||||||
|
@ -14,10 +15,6 @@ in
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
builtins.map (dependency: dependency.package) available;
|
builtins.map (dependency: dependency.package) available;
|
||||||
|
|
||||||
build =
|
|
||||||
build': host': target':
|
|
||||||
builtins.mapAttrs (name: dep: lib'.packages.build dep build' host' target');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
getLatest =
|
getLatest =
|
||||||
|
@ -28,89 +25,54 @@ in
|
||||||
in
|
in
|
||||||
builtins.head sorted;
|
builtins.head sorted;
|
||||||
|
|
||||||
resolve =
|
|
||||||
alias:
|
|
||||||
if alias ? versions then
|
|
||||||
alias.versions.${config.preferences.packages.version}
|
|
||||||
or (alias.versions.${lib'.packages.getLatest alias})
|
|
||||||
else
|
|
||||||
alias;
|
|
||||||
|
|
||||||
build =
|
build =
|
||||||
alias: build: host: target:
|
package: build: host: target:
|
||||||
let
|
let
|
||||||
package = lib'.packages.resolve alias;
|
resolved =
|
||||||
|
if package ? versions then
|
||||||
|
package.versions.${config.preferences.packages.version}
|
||||||
|
or (package.versions.${lib'.packages.getLatest package})
|
||||||
|
else
|
||||||
|
package;
|
||||||
|
|
||||||
buildDependencies =
|
buildDependencies =
|
||||||
build': host': target':
|
build': host': target':
|
||||||
builtins.mapAttrs (name: dep: lib'.packages.build dep build' host' target');
|
builtins.mapAttrs (name: dep: lib'.packages.build dep build' host' target');
|
||||||
|
|
||||||
platform = {
|
result = resolved.extend (
|
||||||
build = lib.modules.overrides.force build;
|
|
||||||
host = lib.modules.overrides.force host;
|
|
||||||
target = lib.modules.overrides.force target;
|
|
||||||
};
|
|
||||||
|
|
||||||
withPlatform = lib.modules.run {
|
|
||||||
modules = package.__modules__ ++ [
|
|
||||||
lib'.types.package.children.submodule
|
|
||||||
(
|
|
||||||
{ config }:
|
{ config }:
|
||||||
{
|
{
|
||||||
config = {
|
config = {
|
||||||
__modules__ = package.__modules__;
|
platform = {
|
||||||
|
build = build;
|
||||||
inherit platform;
|
host = host;
|
||||||
};
|
target = lib.modules.override 150 target;
|
||||||
}
|
|
||||||
)
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Not all platform information can be effectively handled via submodules. To handle
|
|
||||||
# the case where a user copies the resolved config over we need to ensure that
|
|
||||||
# dependencies are appropriately updated.
|
|
||||||
withDeps = withPlatform.config // {
|
|
||||||
deps = {
|
deps = {
|
||||||
build = {
|
build = {
|
||||||
only = buildDependencies build build build withPlatform.config.deps.build.only;
|
only = buildDependencies build build build resolved.deps.build.only;
|
||||||
build = buildDependencies build build target withPlatform.config.deps.build.build;
|
build = buildDependencies build build target resolved.deps.build.build;
|
||||||
host = buildDependencies build host target withPlatform.config.deps.build.host;
|
host = buildDependencies build host target resolved.deps.build.host;
|
||||||
target = buildDependencies build target target withPlatform.config.deps.build.target;
|
target = buildDependencies build target target resolved.deps.build.target;
|
||||||
};
|
};
|
||||||
host = {
|
host = {
|
||||||
only = buildDependencies host host host withPlatform.config.deps.host.only;
|
only = buildDependencies host host host resolved.deps.host.only;
|
||||||
host = buildDependencies host host target withPlatform.config.deps.host.host;
|
host = buildDependencies host host target resolved.deps.host.host;
|
||||||
target = buildDependencies host target target withPlatform.config.deps.host.target;
|
target = buildDependencies host target target resolved.deps.host.target;
|
||||||
};
|
};
|
||||||
target = {
|
target = {
|
||||||
only = buildDependencies target target target withPlatform.config.deps.target.only;
|
only = buildDependencies target target target resolved.deps.target.only;
|
||||||
target = buildDependencies target target target withPlatform.config.deps.target.target;
|
target = buildDependencies target target target resolved.deps.target.target;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
withPackage = lib.modules.run {
|
package = config.builder.build config;
|
||||||
modules = package.__modules__ ++ [
|
|
||||||
lib'.types.package.children.submodule
|
|
||||||
(
|
|
||||||
{ config }:
|
|
||||||
{
|
|
||||||
config = {
|
|
||||||
__modules__ = package.__modules__;
|
|
||||||
|
|
||||||
inherit platform;
|
|
||||||
|
|
||||||
deps = lib.modules.overrides.force withDeps.deps;
|
|
||||||
|
|
||||||
package = lib.modules.overrides.force (withDeps.builder.build withDeps);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
];
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
withPackage.config;
|
result;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1220,7 +1220,6 @@ in
|
||||||
vendor,
|
vendor,
|
||||||
kernel,
|
kernel,
|
||||||
abi,
|
abi,
|
||||||
...
|
|
||||||
}:
|
}:
|
||||||
types.cpu.check cpu
|
types.cpu.check cpu
|
||||||
&& types.vendor.check vendor
|
&& types.vendor.check vendor
|
||||||
|
@ -1228,17 +1227,6 @@ in
|
||||||
&& types.abi.check abi;
|
&& types.abi.check abi;
|
||||||
};
|
};
|
||||||
|
|
||||||
platformWithBuildInfo = lib.types.create {
|
|
||||||
name = "systemWithBuildInfo";
|
|
||||||
description = "fully parsed representation of llvm- or nix-style platform tuple with build information";
|
|
||||||
merge = lib.options.merge.one;
|
|
||||||
check =
|
|
||||||
value:
|
|
||||||
lib.types.is "systemWithBuildInfo" value
|
|
||||||
&& value ? system
|
|
||||||
&& lib'.systems.types.platform.check value.system;
|
|
||||||
};
|
|
||||||
|
|
||||||
endian = lib.types.enum (builtins.attrValues types.endians);
|
endian = lib.types.enum (builtins.attrValues types.endians);
|
||||||
|
|
||||||
endians = setTypes types.generic.endian {
|
endians = setTypes types.generic.endian {
|
||||||
|
@ -2804,7 +2792,7 @@ in
|
||||||
assert resolved.useAndroidPrebuilt -> resolved.isAndroid;
|
assert resolved.useAndroidPrebuilt -> resolved.isAndroid;
|
||||||
assert assertions;
|
assert assertions;
|
||||||
# And finally, return the generated system info.
|
# And finally, return the generated system info.
|
||||||
lib.types.set "systemWithBuildInfo" resolved;
|
resolved;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
{ lib, config }:
|
{
|
||||||
let
|
lib,
|
||||||
inherit (config) preferences builders;
|
lib',
|
||||||
|
config,
|
||||||
lib' = config.lib;
|
}:
|
||||||
in
|
|
||||||
{
|
{
|
||||||
config = {
|
config = {
|
||||||
lib.types = {
|
lib.types = {
|
||||||
|
@ -56,10 +55,6 @@ in
|
||||||
in
|
in
|
||||||
lib.types.either type (lib.types.list.of type);
|
lib.types.either type (lib.types.list.of type);
|
||||||
|
|
||||||
platform =
|
|
||||||
lib.types.coerce lib.types.string lib'.systems.withBuildInfo
|
|
||||||
lib'.systems.types.platformWithBuildInfo;
|
|
||||||
|
|
||||||
builder = lib.types.submodule {
|
builder = lib.types.submodule {
|
||||||
freeform = lib.types.any;
|
freeform = lib.types.any;
|
||||||
|
|
||||||
|
@ -71,163 +66,60 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = lib.types.attrs.of (lib.types.attrs.of lib'.types.alias);
|
packages = lib.types.attrs.of (lib'.types.alias);
|
||||||
|
|
||||||
dependencies =
|
alias = lib.types.attrs.of (
|
||||||
build: host: target:
|
lib.types.submodule {
|
||||||
let
|
|
||||||
initial = lib.types.raw;
|
|
||||||
|
|
||||||
transform =
|
|
||||||
value:
|
|
||||||
let
|
|
||||||
package = lib'.packages.resolve value;
|
|
||||||
in
|
|
||||||
lib'.packages.build package build host target;
|
|
||||||
in
|
|
||||||
lib.types.attrs.of (lib.types.coerce initial transform lib'.types.package);
|
|
||||||
|
|
||||||
alias = lib.types.submodule {
|
|
||||||
options = {
|
options = {
|
||||||
stable = lib.options.create {
|
|
||||||
description = "The stable version of the package.";
|
|
||||||
type = lib.types.nullish lib'.types.package;
|
|
||||||
};
|
|
||||||
|
|
||||||
latest = lib.options.create {
|
|
||||||
description = "The latest version of the package.";
|
|
||||||
type = lib'.types.package;
|
|
||||||
};
|
|
||||||
|
|
||||||
versions = lib.options.create {
|
versions = lib.options.create {
|
||||||
description = "Available versions of the package.";
|
description = "All available package versions.";
|
||||||
type = lib.types.attrs.of lib'.types.package;
|
type = lib.types.attrs.of lib'.types.package;
|
||||||
default.value = { };
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
package =
|
dependencies = lib.types.attrs.of (
|
||||||
let
|
lib.types.nullish (lib.types.either lib'.types.alias lib'.types.package)
|
||||||
normalize =
|
);
|
||||||
|
|
||||||
|
package = lib.types.submodule (
|
||||||
|
{ config, meta }:
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
extend = lib.options.create {
|
||||||
|
description = "Extend the package's submodules with additional configuration.";
|
||||||
|
type = lib.types.function lib.types.raw;
|
||||||
|
default.value =
|
||||||
value:
|
value:
|
||||||
if builtins.isFunction value || builtins.isList value then
|
|
||||||
value
|
|
||||||
else if value ? __modules__ then
|
|
||||||
value.__modules__
|
|
||||||
else
|
|
||||||
{ config = value; };
|
|
||||||
|
|
||||||
initial = lib.types.create {
|
|
||||||
name = "PackageConfig";
|
|
||||||
description = "configuration for a package";
|
|
||||||
check = value: builtins.isFunction value || builtins.isAttrs value || builtins.isList value;
|
|
||||||
merge =
|
|
||||||
location: definitions:
|
|
||||||
let
|
let
|
||||||
normalized = builtins.map (definition: lib.lists.from.any (normalize definition.value)) definitions;
|
result = meta.extend {
|
||||||
in
|
modules = if builtins.isAttrs value then [ { config = value; } ] else lib.lists.from.any value;
|
||||||
builtins.concatLists normalized;
|
|
||||||
};
|
|
||||||
|
|
||||||
transform =
|
|
||||||
location: value:
|
|
||||||
let
|
|
||||||
modules = lib.lists.from.any (normalize value);
|
|
||||||
|
|
||||||
result = lib.modules.run {
|
|
||||||
prefix = location;
|
|
||||||
modules = modules ++ [
|
|
||||||
submodule
|
|
||||||
{ config.__modules__ = modules; }
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
result.config;
|
result.config;
|
||||||
|
|
||||||
final = lib.types.raw;
|
|
||||||
|
|
||||||
deps =
|
|
||||||
build: host: target:
|
|
||||||
lib.types.submodule {
|
|
||||||
options = {
|
|
||||||
build = {
|
|
||||||
only = lib.options.create {
|
|
||||||
description = "Dependencies which are only used in the build environment.";
|
|
||||||
type = lib'.types.dependencies build build build;
|
|
||||||
default.value = { };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
build = lib.options.create {
|
name = lib.options.create {
|
||||||
description = "Dependencies which are created in the build environment and are executed in the build environment.";
|
description = "The name of the package.";
|
||||||
type = lib'.types.dependencies build build target;
|
type = lib.types.string;
|
||||||
default.value = { };
|
default = {
|
||||||
};
|
text = "\${config.pname}-\${config.version}";
|
||||||
|
value =
|
||||||
host = lib.options.create {
|
if config.pname != null && config.version != null then "${config.pname}-${config.version}" else "";
|
||||||
description = "Dependencies which are created in the build environment and are executed in the host environment.";
|
|
||||||
type = lib'.types.dependencies build host target;
|
|
||||||
default.value = { };
|
|
||||||
};
|
|
||||||
|
|
||||||
target = lib.options.create {
|
|
||||||
description = "Dependencies which are created in the build environment and are executed in the target environment.";
|
|
||||||
type = lib'.types.dependencies build target target;
|
|
||||||
default.value = { };
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
host = {
|
pname = lib.options.create {
|
||||||
only = lib.options.create {
|
description = "The program name for the package";
|
||||||
description = "Dependencies which are only used in the host environment.";
|
type = lib.types.nullish lib.types.string;
|
||||||
type = lib'.types.dependencies host host host;
|
default.value = null;
|
||||||
default.value = { };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
host = lib.options.create {
|
version = lib.options.create {
|
||||||
description = "Dependencies which are executed in the host environment.";
|
description = "The version for the package.";
|
||||||
type = lib'.types.dependencies host host target;
|
type = lib.types.nullish lib.types.version;
|
||||||
default.value = { };
|
default.value = null;
|
||||||
};
|
|
||||||
|
|
||||||
target = lib.options.create {
|
|
||||||
description = "Dependencies which are executed in the host environment which produces code for the target environment.";
|
|
||||||
type = lib'.types.dependencies host target target;
|
|
||||||
default.value = { };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
target = {
|
|
||||||
only = lib.options.create {
|
|
||||||
description = "Dependencies which are only used in the target environment.";
|
|
||||||
type = lib'.types.dependencies target target target;
|
|
||||||
default.value = { };
|
|
||||||
};
|
|
||||||
|
|
||||||
target = lib.options.create {
|
|
||||||
description = "Dependencies which are executed in the target environment.";
|
|
||||||
type = lib'.types.dependencies target target target;
|
|
||||||
default.value = { };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
submodule =
|
|
||||||
{ config }:
|
|
||||||
let
|
|
||||||
build = config.platform.build;
|
|
||||||
host = config.platform.host;
|
|
||||||
target = config.platform.target;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
__modules__ = lib.options.create {
|
|
||||||
description = "User specified modules for the package definition.";
|
|
||||||
type = lib.types.list.of (initial // { merge = lib.options.merge.one; });
|
|
||||||
# writable = false;
|
|
||||||
internal = true;
|
|
||||||
default.value = [ ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -283,53 +175,63 @@ in
|
||||||
platform = {
|
platform = {
|
||||||
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.platform;
|
type = lib.types.string;
|
||||||
default.value = lib'.systems.withBuildInfo "x86_64-linux";
|
default.value = "x86_64-linux";
|
||||||
|
apply =
|
||||||
|
raw:
|
||||||
|
let
|
||||||
|
system = lib'.systems.from.string raw;
|
||||||
|
x = lib'.systems.withBuildInfo raw;
|
||||||
|
in
|
||||||
|
x;
|
||||||
};
|
};
|
||||||
|
|
||||||
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.platform;
|
type = lib.types.string;
|
||||||
default.value = lib'.systems.withBuildInfo "x86_64-linux";
|
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;
|
||||||
|
# };
|
||||||
|
apply =
|
||||||
|
raw:
|
||||||
|
let
|
||||||
|
system = lib'.systems.from.string raw;
|
||||||
|
x = lib'.systems.withBuildInfo raw;
|
||||||
|
in
|
||||||
|
x;
|
||||||
};
|
};
|
||||||
|
|
||||||
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.platform;
|
|
||||||
default.value = lib'.systems.withBuildInfo "x86_64-linux";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
name = lib.options.create {
|
|
||||||
description = "The name of the package.";
|
|
||||||
type = lib.types.string;
|
type = lib.types.string;
|
||||||
default = {
|
default.value = "x86_64-linux";
|
||||||
text = "\${config.pname}-\${config.version}";
|
# apply = raw: let
|
||||||
value =
|
# system = lib'.systems.from.string raw;
|
||||||
if config.pname != null && config.version != null then "${config.pname}-${config.version}" else "";
|
# in {
|
||||||
};
|
# inherit raw system;
|
||||||
};
|
|
||||||
|
|
||||||
pname = lib.options.create {
|
# double = lib'.systems.into.double system;
|
||||||
description = "The program name for the package";
|
# triple = lib'.systems.into.triple system;
|
||||||
type = lib.types.nullish lib.types.string;
|
# };
|
||||||
default.value = null;
|
apply =
|
||||||
|
raw:
|
||||||
|
let
|
||||||
|
system = lib'.systems.from.string raw;
|
||||||
|
x = lib'.systems.withBuildInfo raw;
|
||||||
|
in
|
||||||
|
x;
|
||||||
};
|
};
|
||||||
|
|
||||||
version = lib.options.create {
|
|
||||||
description = "The version for the package.";
|
|
||||||
type = lib.types.nullish lib.types.version;
|
|
||||||
default.value = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
builder = lib.options.create {
|
|
||||||
description = "The builder for the package.";
|
|
||||||
type = lib'.types.builder;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
phases = lib.options.create {
|
phases = lib.options.create {
|
||||||
description = "The phases for the package.";
|
description = "The phases for the package.";
|
||||||
type = lib.types.dag.of lib.types.string;
|
type = lib.types.dag.of (lib.types.either lib.types.string (lib.types.function lib.types.string));
|
||||||
default.value = { };
|
default.value = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -339,48 +241,81 @@ in
|
||||||
default.value = { };
|
default.value = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
builder = lib.options.create {
|
||||||
|
description = "The builder for the package.";
|
||||||
|
type = lib'.types.builder;
|
||||||
|
};
|
||||||
|
|
||||||
|
deps = {
|
||||||
|
build = {
|
||||||
|
only = lib.options.create {
|
||||||
|
description = "Dependencies which are only used in the build environment.";
|
||||||
|
type = lib'.types.dependencies;
|
||||||
|
default.value = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
build = lib.options.create {
|
||||||
|
description = "Dependencies which are created in the build environment and are executed in the build environment.";
|
||||||
|
type = lib'.types.dependencies;
|
||||||
|
default.value = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
host = lib.options.create {
|
||||||
|
description = "Dependencies which are created in the build environment and are executed in the host environment.";
|
||||||
|
type = lib'.types.dependencies;
|
||||||
|
default.value = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
target = lib.options.create {
|
||||||
|
description = "Dependencies which are created in the build environment and are executed in the target environment.";
|
||||||
|
type = lib'.types.dependencies;
|
||||||
|
default.value = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
host = {
|
||||||
|
only = lib.options.create {
|
||||||
|
description = "Dependencies which are only used in the host environment.";
|
||||||
|
type = lib'.types.dependencies;
|
||||||
|
default.value = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
host = lib.options.create {
|
||||||
|
description = "Dependencies which are executed in the host environment.";
|
||||||
|
type = lib'.types.dependencies;
|
||||||
|
default.value = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
target = lib.options.create {
|
||||||
|
description = "Dependencies which are executed in the host environment which produces code for the target environment.";
|
||||||
|
type = lib'.types.dependencies;
|
||||||
|
default.value = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
target = {
|
||||||
|
only = lib.options.create {
|
||||||
|
description = "Dependencies which are only used in the target environment.";
|
||||||
|
type = lib'.types.dependencies;
|
||||||
|
default.value = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
target = lib.options.create {
|
||||||
|
description = "Dependencies which are executed in the target environment.";
|
||||||
|
type = lib'.types.dependencies;
|
||||||
|
default.value = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
description = "The built derivation.";
|
description = "The built derivation.";
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
default.value = config.builder.build config;
|
default.value = config.builder.build config;
|
||||||
};
|
};
|
||||||
|
|
||||||
deps = lib.options.create {
|
|
||||||
description = "The dependencies for the package.";
|
|
||||||
type = deps build host target;
|
|
||||||
default.value = { };
|
|
||||||
apply = value: {
|
|
||||||
build = {
|
|
||||||
only = lib'.packages.dependencies.build build build build value.build.only;
|
|
||||||
build = lib'.packages.dependencies.build build build target value.build.build;
|
|
||||||
host = lib'.packages.dependencies.build build host target value.build.host;
|
|
||||||
target = lib'.packages.dependencies.build build target target value.build.target;
|
|
||||||
};
|
|
||||||
host = {
|
|
||||||
only = lib'.packages.dependencies.build host host host value.host.only;
|
|
||||||
host = lib'.packages.dependencies.build host host target value.host.host;
|
|
||||||
target = lib'.packages.dependencies.build host target target value.host.target;
|
|
||||||
};
|
|
||||||
target = {
|
|
||||||
only = lib'.packages.dependencies.build target target target value.target.only;
|
|
||||||
target = lib'.packages.dependencies.build target target target value.target.target;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
type = (lib.types.coerceWithLocation initial transform final) // {
|
|
||||||
name = "Package";
|
|
||||||
description = "a package definition";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
type
|
|
||||||
// {
|
|
||||||
children = type.children // {
|
|
||||||
inherit submodule;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
{ lib', config }:
|
|
||||||
let
|
|
||||||
inherit (config) builders packages;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
config.packages.aux.a = {
|
|
||||||
versions = {
|
|
||||||
"latest" =
|
|
||||||
{ config }:
|
|
||||||
{
|
|
||||||
config = {
|
|
||||||
meta = {
|
|
||||||
platforms = [ "i686-linux" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
name = "${config.pname}-${config.version}";
|
|
||||||
|
|
||||||
pname = "a";
|
|
||||||
version = "1.0.0";
|
|
||||||
|
|
||||||
builder = builders.basic;
|
|
||||||
|
|
||||||
deps.build.host = {
|
|
||||||
inherit (packages.aux) b;
|
|
||||||
};
|
|
||||||
|
|
||||||
phases = {
|
|
||||||
install = ''
|
|
||||||
echo "a with b: ${config.deps.build.host.b.package.system}" > $out
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
{ config }:
|
|
||||||
let
|
|
||||||
inherit (config) lib builders packages;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
config.packages.aux.b = {
|
|
||||||
versions = {
|
|
||||||
"latest" =
|
|
||||||
{ config }:
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
custom = lib.options.create { type = lib.types.bool; };
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
meta = {
|
|
||||||
platforms = [ "i686-linux" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
name = "${config.pname}-${config.version}";
|
|
||||||
|
|
||||||
custom = true;
|
|
||||||
|
|
||||||
pname = "b";
|
|
||||||
version = "1.0.0";
|
|
||||||
|
|
||||||
builder = builders.basic;
|
|
||||||
|
|
||||||
phases = {
|
|
||||||
install = ''
|
|
||||||
echo "b" > $out
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,29 +1,27 @@
|
||||||
{ config }:
|
{
|
||||||
|
lib,
|
||||||
|
lib',
|
||||||
|
config,
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
inherit (config) lib;
|
doubles = lib'.systems.doubles.all;
|
||||||
|
|
||||||
doubles = lib.systems.doubles.all;
|
|
||||||
|
|
||||||
packages = builtins.removeAttrs config.packages [ "cross" ];
|
packages = builtins.removeAttrs config.packages [ "cross" ];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
includes = [
|
includes = [ ./foundation ];
|
||||||
./foundation
|
|
||||||
./aux/a.nix
|
|
||||||
./aux/b.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
packages = lib.options.create {
|
packages = lib.options.create {
|
||||||
description = "The package set.";
|
description = "The package set.";
|
||||||
type = lib.types.submodule {
|
type = lib.types.submodule {
|
||||||
freeform = lib.types.packages;
|
freeform = lib.types.attrs.of (lib.types.submodule { freeform = lib'.types.alias; });
|
||||||
|
|
||||||
options.cross = lib.attrs.generate doubles (
|
options.cross = lib.attrs.generate doubles (
|
||||||
system:
|
system:
|
||||||
lib.options.create {
|
lib.options.create {
|
||||||
description = "The cross-compiled package set for the ${system} target.";
|
description = "The cross-compiled package set for the ${system} target.";
|
||||||
type = lib.types.packages;
|
type = lib'.types.packages;
|
||||||
default = { };
|
default = { };
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -51,49 +49,38 @@ in
|
||||||
let
|
let
|
||||||
setHost =
|
setHost =
|
||||||
package:
|
package:
|
||||||
package
|
if package != { } then
|
||||||
// {
|
(package.extend (
|
||||||
__modules__ = package.__modules__ ++ [
|
{ config }:
|
||||||
{
|
{
|
||||||
config.platform = {
|
config = {
|
||||||
host = lib.modules.override 5 system;
|
platform = {
|
||||||
target = lib.modules.override 5 system;
|
host = lib.modules.overrides.force system;
|
||||||
|
target = lib.modules.overrides.default system;
|
||||||
|
};
|
||||||
|
|
||||||
|
deps = {
|
||||||
|
build = {
|
||||||
|
only = setHost package.deps.build.only;
|
||||||
|
build = setHost package.deps.build.build;
|
||||||
|
host = setHost package.deps.build.host;
|
||||||
|
target = setHost package.deps.build.target;
|
||||||
|
};
|
||||||
|
host = {
|
||||||
|
only = setHost package.deps.host.only;
|
||||||
|
host = setHost package.deps.host.host;
|
||||||
|
target = setHost package.deps.host.target;
|
||||||
|
};
|
||||||
|
target = {
|
||||||
|
only = setHost package.deps.target.only;
|
||||||
|
target = setHost package.deps.target.target;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
)).config
|
||||||
};
|
else
|
||||||
# if package != {}
|
package;
|
||||||
# then
|
|
||||||
# (package.extend (
|
|
||||||
# {config}: {
|
|
||||||
# config = {
|
|
||||||
# platform = {
|
|
||||||
# host = lib.modules.overrides.force system;
|
|
||||||
# target = lib.modules.overrides.default system;
|
|
||||||
# };
|
|
||||||
|
|
||||||
# deps = {
|
|
||||||
# build = {
|
|
||||||
# only = setHost package.deps.build.only;
|
|
||||||
# build = setHost package.deps.build.build;
|
|
||||||
# host = setHost package.deps.build.host;
|
|
||||||
# target = setHost package.deps.build.target;
|
|
||||||
# };
|
|
||||||
# host = {
|
|
||||||
# only = setHost package.deps.host.only;
|
|
||||||
# host = setHost package.deps.host.host;
|
|
||||||
# target = setHost package.deps.host.target;
|
|
||||||
# };
|
|
||||||
# target = {
|
|
||||||
# only = setHost package.deps.target.only;
|
|
||||||
# target = setHost package.deps.target.target;
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
# }
|
|
||||||
# ))
|
|
||||||
# .config
|
|
||||||
# else package;
|
|
||||||
|
|
||||||
updated = alias // {
|
updated = alias // {
|
||||||
versions = builtins.mapAttrs (version: package: setHost package) alias.versions;
|
versions = builtins.mapAttrs (version: package: setHost package) alias.versions;
|
||||||
|
|
|
@ -11,14 +11,13 @@ let
|
||||||
# These are the upstream foundational packages exported from the Aux Foundation project.
|
# These are the upstream foundational packages exported from the Aux Foundation project.
|
||||||
|
|
||||||
foundation
|
foundation
|
||||||
packages
|
|
||||||
;
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config.packages.foundation.binutils = {
|
config.packages.foundation.binutils = {
|
||||||
versions = {
|
versions = {
|
||||||
"latest" =
|
"latest" =
|
||||||
{ config }:
|
{ config, meta }:
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
src = lib.options.create {
|
src = lib.options.create {
|
||||||
|
@ -37,17 +36,9 @@ in
|
||||||
|
|
||||||
builder = builders.basic;
|
builder = builders.basic;
|
||||||
|
|
||||||
deps = {
|
|
||||||
build = {
|
|
||||||
host = {
|
|
||||||
inherit (packages.foundation) gcc;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
PATH = lib.paths.bin [
|
PATH = lib.paths.bin [
|
||||||
# foundation.stage2-gcc
|
foundation.stage2-gcc
|
||||||
foundation.stage2-binutils
|
foundation.stage2-binutils
|
||||||
foundation.stage2-gnumake
|
foundation.stage2-gnumake
|
||||||
foundation.stage2-gnupatch
|
foundation.stage2-gnupatch
|
||||||
|
@ -95,24 +86,24 @@ in
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
unpack = ''
|
unpack = lib.dag.entry.before [ "patch" ] ''
|
||||||
tar xf ${config.src}
|
tar xf ${config.src}
|
||||||
cd binutils-${config.version}
|
cd binutils-${config.version}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
patch = ''
|
patch = lib.dag.entry.between [ "configure" ] [ "unpack" ] ''
|
||||||
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
|
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configure = ''
|
configure = lib.dag.entry.between [ "build" ] [ "patch" ] ''
|
||||||
bash ./configure ${builtins.concatStringsSep " " configureFlags}
|
bash ./configure ${builtins.concatStringsSep " " configureFlags}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
build = ''
|
build = lib.dag.entry.between [ "install" ] [ "configure" ] ''
|
||||||
make -j $NIX_BUILD_CORES
|
make -j $NIX_BUILD_CORES
|
||||||
'';
|
'';
|
||||||
|
|
||||||
install = ''
|
install = lib.dag.entry.after [ "build" ] ''
|
||||||
make -j $NIX_BUILD_CORES install-strip
|
make -j $NIX_BUILD_CORES install-strip
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
./gcc
|
./gcc
|
||||||
./binutils
|
./binutils
|
||||||
./linux-headers
|
./linux-headers
|
||||||
./glibc
|
|
||||||
# ./xz
|
|
||||||
];
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
{ config, options }:
|
{
|
||||||
|
lib,
|
||||||
|
lib',
|
||||||
|
config,
|
||||||
|
options,
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
inherit (config)
|
inherit (config)
|
||||||
lib
|
|
||||||
mirrors
|
mirrors
|
||||||
builders
|
builders
|
||||||
# These are the upstream foundational packages exported from the Aux Foundation project.
|
# These are the upstream foundational packages exported from the Aux Foundation project.
|
||||||
|
|
||||||
foundation
|
foundation
|
||||||
packages
|
|
||||||
;
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -88,7 +91,28 @@ in
|
||||||
builder = builders.basic;
|
builder = builders.basic;
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
PATH = lib.paths.bin [
|
PATH =
|
||||||
|
let
|
||||||
|
gcc =
|
||||||
|
if
|
||||||
|
config.platform.build.triple == config.platform.host.triple
|
||||||
|
# If we're on the same system then we can use the existing GCC instance.
|
||||||
|
then
|
||||||
|
foundation.stage2-gcc
|
||||||
|
# Otherwise we are going to need a cross-compiler.
|
||||||
|
else
|
||||||
|
# TODO: Create a gcc-cross package.
|
||||||
|
(meta.extend (args: {
|
||||||
|
config = {
|
||||||
|
platform = {
|
||||||
|
build = config.platform.build.triple;
|
||||||
|
host = config.platform.build.triple;
|
||||||
|
target = lib.modules.override.force config.platform.host.triple;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})).config.package;
|
||||||
|
in
|
||||||
|
lib.paths.bin [
|
||||||
foundation.stage2-gcc
|
foundation.stage2-gcc
|
||||||
foundation.stage2-binutils
|
foundation.stage2-binutils
|
||||||
foundation.stage2-gnumake
|
foundation.stage2-gnumake
|
||||||
|
@ -106,12 +130,12 @@ in
|
||||||
|
|
||||||
phases =
|
phases =
|
||||||
let
|
let
|
||||||
host = lib.systems.withBuildInfo config.platform.host;
|
host = lib'.systems.withBuildInfo config.platform.host;
|
||||||
|
|
||||||
mbits = if host.system.cpu.family == "x86" then if host.is64bit then "-m64" else "-m32" else "";
|
mbits = if host.system.cpu.family == "x86" then if host.is64bit then "-m64" else "-m32" else "";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
unpack = ''
|
unpack = lib.dag.entry.before [ "patch" ] ''
|
||||||
# Unpack
|
# Unpack
|
||||||
tar xf ${config.src}
|
tar xf ${config.src}
|
||||||
tar xf ${config.gmp.src}
|
tar xf ${config.gmp.src}
|
||||||
|
@ -126,15 +150,17 @@ in
|
||||||
ln -s ../isl-${config.isl.version} isl
|
ln -s ../isl-${config.isl.version} isl
|
||||||
'';
|
'';
|
||||||
|
|
||||||
patch = ''
|
patch = lib.dag.entry.between [ "configure" ] [ "unpack" ] ''
|
||||||
# Patch
|
# Patch
|
||||||
# force musl even if host triple is gnu
|
# force musl even if host triple is gnu
|
||||||
sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host
|
sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configure = ''
|
configure = lib.dag.entry.between [ "build" ] [ "patch" ] ''
|
||||||
# Configure
|
# Configure
|
||||||
export CC="gcc -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
export CC="gcc -Wl,-dynamic-linker -march=${
|
||||||
|
host.gcc.arch or host.system.cpu.family
|
||||||
|
} ${mbits} -Wl,${foundation.stage1-musl}/lib/libc.so"
|
||||||
export CXX="g++ -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
export CXX="g++ -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
||||||
export CFLAGS_FOR_TARGET="-Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
export CFLAGS_FOR_TARGET="-Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
||||||
export LIBRARY_PATH="${foundation.stage1-musl}/lib"
|
export LIBRARY_PATH="${foundation.stage1-musl}/lib"
|
||||||
|
@ -156,12 +182,12 @@ in
|
||||||
CXXFLAGS=-static
|
CXXFLAGS=-static
|
||||||
'';
|
'';
|
||||||
|
|
||||||
build = ''
|
build = lib.dag.entry.between [ "install" ] [ "configure" ] ''
|
||||||
# Build
|
# Build
|
||||||
make -j $NIX_BUILD_CORES
|
make -j $NIX_BUILD_CORES
|
||||||
'';
|
'';
|
||||||
|
|
||||||
install = ''
|
install = lib.dag.entry.after [ "build" ] ''
|
||||||
# Install
|
# Install
|
||||||
make -j $NIX_BUILD_CORES install-strip
|
make -j $NIX_BUILD_CORES install-strip
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -54,16 +54,20 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
phases = {
|
phases = {
|
||||||
unpack = ''
|
unpack = lib.dag.entry.before [ "patch" ] ''
|
||||||
tar xf ${config.src}
|
tar xf ${config.src}
|
||||||
cd linux-${config.version}
|
cd linux-${config.version}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
build = ''
|
patch = lib.dag.entry.between [ "configure" ] [ "unpack" ] '''';
|
||||||
|
|
||||||
|
configure = lib.dag.entry.between [ "build" ] [ "patch" ] '''';
|
||||||
|
|
||||||
|
build = lib.dag.entry.between [ "install" ] [ "configure" ] ''
|
||||||
make -j $NIX_BUILD_CORES CC=musl-gcc HOSTCC=musl-gcc ARCH=${config.platform.host.linux.arch} headers
|
make -j $NIX_BUILD_CORES CC=musl-gcc HOSTCC=musl-gcc ARCH=${config.platform.host.linux.arch} headers
|
||||||
'';
|
'';
|
||||||
|
|
||||||
install = ''
|
install = lib.dag.entry.after [ "build" ] ''
|
||||||
find usr/include -name '.*' -exec rm {} +
|
find usr/include -name '.*' -exec rm {} +
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp -rv usr/include $out/
|
cp -rv usr/include $out/
|
||||||
|
|
Loading…
Reference in a new issue