chore: format
This commit is contained in:
parent
85e84618d6
commit
b64f370317
7 changed files with 173 additions and 177 deletions
|
|
@ -28,7 +28,8 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
new = module:
|
||||
new =
|
||||
module:
|
||||
let
|
||||
set = lib.modules.run {
|
||||
modules = [
|
||||
|
|
@ -37,14 +38,16 @@ let
|
|||
./src/mirrors
|
||||
|
||||
recursiveLibModule
|
||||
] ++ lib.lists.from.any module;
|
||||
]
|
||||
++ lib.lists.from.any module;
|
||||
};
|
||||
in
|
||||
set.config // {
|
||||
inherit new;
|
||||
inherit (set) extend;
|
||||
};
|
||||
set.config
|
||||
// {
|
||||
inherit new;
|
||||
inherit (set) extend;
|
||||
};
|
||||
in
|
||||
new [
|
||||
./src/packages
|
||||
]
|
||||
new [
|
||||
./src/packages
|
||||
]
|
||||
|
|
|
|||
|
|
@ -53,10 +53,14 @@ in
|
|||
|
||||
script = lib.strings.concatMapSep "\n" (entry: entry.value) sorted.result;
|
||||
|
||||
executable = if system == "i686-linux" then
|
||||
"${foundation.stage2-bash}/bin/bash"
|
||||
else
|
||||
"${(lib.packages.build packages.foundation.bash.versions."5.2.15-stage1" "i686-linux" system system).package}/bin/bash";
|
||||
executable =
|
||||
if system == "i686-linux" then
|
||||
"${foundation.stage2-bash}/bin/bash"
|
||||
else
|
||||
"${
|
||||
(lib.packages.build packages.foundation.bash.versions."5.2.15-stage1" "i686-linux" system system)
|
||||
.package
|
||||
}/bin/bash";
|
||||
|
||||
built = builtins.derivation (
|
||||
package.env
|
||||
|
|
|
|||
|
|
@ -6,22 +6,24 @@ let
|
|||
inherit (config.internal.packages) foundation;
|
||||
in
|
||||
{
|
||||
config.builders.passthrough = { config }: {
|
||||
options = {
|
||||
settings.derivation = lib.options.create {
|
||||
description = "The derivation to use for the package.";
|
||||
type = lib.types.derivation;
|
||||
config.builders.passthrough =
|
||||
{ config }:
|
||||
{
|
||||
options = {
|
||||
settings.derivation = lib.options.create {
|
||||
description = "The derivation to use for the package.";
|
||||
type = lib.types.derivation;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
build =
|
||||
package:
|
||||
package.builder.settings.derivation
|
||||
// {
|
||||
inherit package;
|
||||
inherit (package) meta extend extras;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
build =
|
||||
package:
|
||||
package.builder.settings.derivation
|
||||
// {
|
||||
inherit package;
|
||||
inherit (package) meta extend extras;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,9 @@ in
|
|||
global = global.config;
|
||||
};
|
||||
|
||||
prefix = package.__module__.args.dynamic.meta.prefix ++ [ "<context ${builtins.concatStringsSep path}>" ];
|
||||
prefix = package.__module__.args.dynamic.meta.prefix ++ [
|
||||
"<context ${builtins.concatStringsSep path}>"
|
||||
];
|
||||
modules = (builtins.map (context: { config = context; }) contexts) ++ [
|
||||
{
|
||||
freeform = lib.types.any;
|
||||
|
|
|
|||
|
|
@ -40,50 +40,44 @@ in
|
|||
# }
|
||||
# ]
|
||||
#
|
||||
spec = input:
|
||||
spec =
|
||||
input:
|
||||
let
|
||||
specs = lib.lists.from.any input;
|
||||
|
||||
platforms = lib.lists.flatten (
|
||||
builtins.map
|
||||
(spec:
|
||||
let
|
||||
build = lib.platforms.expand spec spec.build;
|
||||
host = lib.platforms.expand spec spec.host;
|
||||
target = lib.platforms.expand spec spec.target;
|
||||
in
|
||||
builtins.concatMap
|
||||
(build:
|
||||
builtins.concatMap
|
||||
(host:
|
||||
builtins.map
|
||||
(target: {
|
||||
build = build;
|
||||
host =
|
||||
if host == "@build" then
|
||||
build
|
||||
else host;
|
||||
target =
|
||||
if target == "@host" then
|
||||
host
|
||||
else if target == "@build" then
|
||||
build
|
||||
else
|
||||
target;
|
||||
})
|
||||
target
|
||||
)
|
||||
host
|
||||
)
|
||||
build
|
||||
)
|
||||
specs
|
||||
builtins.map (
|
||||
spec:
|
||||
let
|
||||
build = lib.platforms.expand spec spec.build;
|
||||
host = lib.platforms.expand spec spec.host;
|
||||
target = lib.platforms.expand spec spec.target;
|
||||
in
|
||||
builtins.concatMap (
|
||||
build:
|
||||
builtins.concatMap (
|
||||
host:
|
||||
builtins.map (target: {
|
||||
build = build;
|
||||
host = if host == "@build" then build else host;
|
||||
target =
|
||||
if target == "@host" then
|
||||
host
|
||||
else if target == "@build" then
|
||||
build
|
||||
else
|
||||
target;
|
||||
}) target
|
||||
) host
|
||||
) build
|
||||
) specs
|
||||
);
|
||||
in
|
||||
platforms;
|
||||
};
|
||||
|
||||
expand = spec: value:
|
||||
expand =
|
||||
spec: value:
|
||||
if builtins.isList value then
|
||||
builtins.concatMap (system: lib.platforms.expand spec system) value
|
||||
else if value == "@build" then
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@ let
|
|||
|
||||
getDoubles =
|
||||
predicate:
|
||||
builtins.map
|
||||
lib.systems.into.double
|
||||
(builtins.filter predicate lib.systems.doubles.resolved);
|
||||
builtins.map lib.systems.into.double (builtins.filter predicate lib.systems.doubles.resolved);
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -2791,11 +2789,7 @@ in
|
|||
// (builtins.removeAttrs settings [ "system" ]);
|
||||
|
||||
assertions = builtins.foldl' (
|
||||
result:
|
||||
{ assertion, message }:
|
||||
if assertion resolved then
|
||||
result
|
||||
else builtins.throw message
|
||||
result: { assertion, message }: if assertion resolved then result else builtins.throw message
|
||||
) true (resolved.system.abi.assertions or [ ]);
|
||||
in
|
||||
assert resolved.useAndroidPrebuilt -> resolved.isAndroid;
|
||||
|
|
|
|||
|
|
@ -152,11 +152,9 @@ in
|
|||
merge =
|
||||
location: definitions:
|
||||
let
|
||||
modules = builtins.concatMap
|
||||
(
|
||||
definition: lib.lists.from.any (normalize definition.value)
|
||||
)
|
||||
definitions;
|
||||
modules = builtins.concatMap (
|
||||
definition: lib.lists.from.any (normalize definition.value)
|
||||
) definitions;
|
||||
|
||||
result = lib.modules.run {
|
||||
prefix = location;
|
||||
|
|
@ -174,80 +172,87 @@ in
|
|||
result.config;
|
||||
};
|
||||
|
||||
submodule = { config, meta, name ? "builder" }: {
|
||||
options = {
|
||||
__modules__ = lib.options.create {
|
||||
description = "User specified modules for the builder definition.";
|
||||
type = lib.types.list.of (initial // { merge = lib.options.merge.one; });
|
||||
internal = true;
|
||||
default.value = [ ];
|
||||
};
|
||||
|
||||
extend = lib.options.create {
|
||||
description = "Extend the package definition.";
|
||||
type = lib.types.function lib.types.raw;
|
||||
default.value =
|
||||
module:
|
||||
let
|
||||
normalized =
|
||||
if builtins.isList module then
|
||||
module
|
||||
else if builtins.isFunction module || module ? config then
|
||||
[ module ]
|
||||
else
|
||||
[
|
||||
{
|
||||
config = module;
|
||||
}
|
||||
];
|
||||
|
||||
modules = config.__modules__ ++ normalized;
|
||||
|
||||
result = lib.modules.run {
|
||||
prefix = meta.prefix;
|
||||
|
||||
args = {
|
||||
global = global.config;
|
||||
};
|
||||
|
||||
modules = [
|
||||
submodule
|
||||
{ config.__modules__ = modules; }
|
||||
]
|
||||
++ modules;
|
||||
};
|
||||
in
|
||||
result.config;
|
||||
};
|
||||
|
||||
name = lib.options.create {
|
||||
description = "The name of the builder.";
|
||||
type = lib.types.string;
|
||||
default = lib.attrs.when (name != "builder") {
|
||||
value = name;
|
||||
submodule =
|
||||
{
|
||||
config,
|
||||
meta,
|
||||
name ? "builder",
|
||||
}:
|
||||
{
|
||||
options = {
|
||||
__modules__ = lib.options.create {
|
||||
description = "User specified modules for the builder definition.";
|
||||
type = lib.types.list.of (initial // { merge = lib.options.merge.one; });
|
||||
internal = true;
|
||||
default.value = [ ];
|
||||
};
|
||||
writable = false;
|
||||
};
|
||||
|
||||
build = lib.options.create {
|
||||
description = "The build function which takes a package definition and creates a derivation.";
|
||||
type = lib.types.function lib.types.artifact;
|
||||
};
|
||||
extend = lib.options.create {
|
||||
description = "Extend the package definition.";
|
||||
type = lib.types.function lib.types.raw;
|
||||
default.value =
|
||||
module:
|
||||
let
|
||||
normalized =
|
||||
if builtins.isList module then
|
||||
module
|
||||
else if builtins.isFunction module || module ? config then
|
||||
[ module ]
|
||||
else
|
||||
[
|
||||
{
|
||||
config = module;
|
||||
}
|
||||
];
|
||||
|
||||
settings = lib.options.create {
|
||||
description = "The settings for the builder.";
|
||||
type = lib.types.submodule ({ config }: { });
|
||||
default.value = { };
|
||||
modules = config.__modules__ ++ normalized;
|
||||
|
||||
result = lib.modules.run {
|
||||
prefix = meta.prefix;
|
||||
|
||||
args = {
|
||||
global = global.config;
|
||||
};
|
||||
|
||||
modules = [
|
||||
submodule
|
||||
{ config.__modules__ = modules; }
|
||||
]
|
||||
++ modules;
|
||||
};
|
||||
in
|
||||
result.config;
|
||||
};
|
||||
|
||||
name = lib.options.create {
|
||||
description = "The name of the builder.";
|
||||
type = lib.types.string;
|
||||
default = lib.attrs.when (name != "builder") {
|
||||
value = name;
|
||||
};
|
||||
writable = false;
|
||||
};
|
||||
|
||||
build = lib.options.create {
|
||||
description = "The build function which takes a package definition and creates a derivation.";
|
||||
type = lib.types.function lib.types.artifact;
|
||||
};
|
||||
|
||||
settings = lib.options.create {
|
||||
description = "The settings for the builder.";
|
||||
type = lib.types.submodule ({ config }: { });
|
||||
default.value = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
type = (lib.types.coerceWithLocation initial transform final) // {
|
||||
name = "Builder";
|
||||
description = "a builder";
|
||||
};
|
||||
in
|
||||
type // {
|
||||
type
|
||||
// {
|
||||
children = type.children // {
|
||||
inherit submodule;
|
||||
};
|
||||
|
|
@ -283,32 +288,26 @@ in
|
|||
transform =
|
||||
value:
|
||||
let
|
||||
result = builtins.mapAttrs
|
||||
(
|
||||
namespace: aliases:
|
||||
builtins.mapAttrs
|
||||
(
|
||||
id: alias:
|
||||
alias
|
||||
// {
|
||||
versions = builtins.mapAttrs
|
||||
(version: package: {
|
||||
__modules__ = (lib.lists.from.any (normalize package)) ++ [
|
||||
{
|
||||
config = {
|
||||
id = lib.modules.overrides.default id;
|
||||
version = lib.modules.overrides.default version;
|
||||
namespace = lib.modules.overrides.default namespace;
|
||||
};
|
||||
}
|
||||
];
|
||||
})
|
||||
alias.versions;
|
||||
}
|
||||
)
|
||||
aliases
|
||||
)
|
||||
value;
|
||||
result = builtins.mapAttrs (
|
||||
namespace: aliases:
|
||||
builtins.mapAttrs (
|
||||
id: alias:
|
||||
alias
|
||||
// {
|
||||
versions = builtins.mapAttrs (version: package: {
|
||||
__modules__ = (lib.lists.from.any (normalize package)) ++ [
|
||||
{
|
||||
config = {
|
||||
id = lib.modules.overrides.default id;
|
||||
version = lib.modules.overrides.default version;
|
||||
namespace = lib.modules.overrides.default namespace;
|
||||
};
|
||||
}
|
||||
];
|
||||
}) alias.versions;
|
||||
}
|
||||
) aliases
|
||||
) value;
|
||||
in
|
||||
result;
|
||||
|
||||
|
|
@ -406,8 +405,8 @@ in
|
|||
let
|
||||
default = config.${global.config.preferences.packages.version};
|
||||
in
|
||||
default.extend
|
||||
or (builtins.throw "Package \"${name}\" does not have a ${global.config.preferences.packages.version} release.");
|
||||
default.extend
|
||||
or (builtins.throw "Package \"${name}\" does not have a ${global.config.preferences.packages.version} release.");
|
||||
};
|
||||
|
||||
stable = lib.options.create {
|
||||
|
|
@ -489,11 +488,9 @@ in
|
|||
merge =
|
||||
location: definitions:
|
||||
let
|
||||
modules = builtins.concatMap
|
||||
(
|
||||
definition: lib.lists.from.any (normalize definition.value)
|
||||
)
|
||||
definitions;
|
||||
modules = builtins.concatMap (
|
||||
definition: lib.lists.from.any (normalize definition.value)
|
||||
) definitions;
|
||||
|
||||
result = lib.modules.run {
|
||||
prefix = location;
|
||||
|
|
@ -560,9 +557,9 @@ in
|
|||
};
|
||||
|
||||
submodule =
|
||||
{ config
|
||||
, meta
|
||||
,
|
||||
{
|
||||
config,
|
||||
meta,
|
||||
}:
|
||||
let
|
||||
build = config.platform.build;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue