refactor(format): apply formatting
This commit is contained in:
parent
b414e151e6
commit
9315751220
|
@ -4,38 +4,45 @@ lib: {
|
||||||
## Merge a list of option definitions into a single value.
|
## Merge a list of option definitions into a single value.
|
||||||
##
|
##
|
||||||
## @type Location -> List Definition -> Any
|
## @type Location -> List Definition -> Any
|
||||||
default = location: definitions: let
|
default =
|
||||||
|
location: definitions:
|
||||||
|
let
|
||||||
values = lib.options.getDefinitionValues definitions;
|
values = lib.options.getDefinitionValues definitions;
|
||||||
first = builtins.elemAt values 0;
|
first = builtins.elemAt values 0;
|
||||||
mergedFunctions = x: lib.options.mergeDefault location (builtins.map (f: f x) values);
|
mergedFunctions = x: lib.options.mergeDefault location (builtins.map (f: f x) values);
|
||||||
mergedLists = builtins.concatLists values;
|
mergedLists = builtins.concatLists values;
|
||||||
mergedAttrs = builtins.foldl' lib.attrs.merge {} values;
|
mergedAttrs = builtins.foldl' lib.attrs.merge { } values;
|
||||||
mergedBools = builtins.any lib.bools.or false values;
|
mergedBools = builtins.any lib.bools.or false values;
|
||||||
mergedStrings = lib.strings.concat values;
|
mergedStrings = lib.strings.concat values;
|
||||||
in
|
in
|
||||||
if builtins.length values == 1
|
if builtins.length values == 1 then
|
||||||
then builtins.elemAt values 0
|
builtins.elemAt values 0
|
||||||
else if builtins.all builtins.isFunction values
|
else if builtins.all builtins.isFunction values then
|
||||||
then mergedFunctions
|
mergedFunctions
|
||||||
else if builtins.all builtins.isList values
|
else if builtins.all builtins.isList values then
|
||||||
then mergedLists
|
mergedLists
|
||||||
else if builtins.all builtins.isAttrs values
|
else if builtins.all builtins.isAttrs values then
|
||||||
then mergedAttrs
|
mergedAttrs
|
||||||
else if builtins.all builtins.isBool values
|
else if builtins.all builtins.isBool values then
|
||||||
then mergedBools
|
mergedBools
|
||||||
else if builtins.all lib.strings.isString values
|
else if builtins.all lib.strings.isString values then
|
||||||
then mergedStrings
|
mergedStrings
|
||||||
else if builtins.all builtins.isInt values && builtins.all (x: x == first) values
|
else if builtins.all builtins.isInt values && builtins.all (x: x == first) values then
|
||||||
then first
|
first
|
||||||
# TODO: Improve this error message to show the location and definitions for the option.
|
# TODO: Improve this error message to show the location and definitions for the option.
|
||||||
else builtins.throw "Cannot merge definitions.";
|
else
|
||||||
|
builtins.throw "Cannot merge definitions.";
|
||||||
|
|
||||||
## Merge multiple option definitions together.
|
## Merge multiple option definitions together.
|
||||||
##
|
##
|
||||||
## @type Location -> Type -> List Definition
|
## @type Location -> Type -> List Definition
|
||||||
definitions = location: type: definitions: let
|
definitions =
|
||||||
|
location: type: definitions:
|
||||||
|
let
|
||||||
identifier = lib.options.getIdentifier location;
|
identifier = lib.options.getIdentifier location;
|
||||||
resolve = definition: let
|
resolve =
|
||||||
|
definition:
|
||||||
|
let
|
||||||
properties = builtins.addErrorContext "while evaluating definitions from `${definition.__file__ or "<unknown>"}`:" (
|
properties = builtins.addErrorContext "while evaluating definitions from `${definition.__file__ or "<unknown>"}`:" (
|
||||||
lib.modules.apply.properties definition.value
|
lib.modules.apply.properties definition.value
|
||||||
);
|
);
|
||||||
|
@ -50,27 +57,27 @@ lib: {
|
||||||
overridden = lib.modules.apply.overrides resolved;
|
overridden = lib.modules.apply.overrides resolved;
|
||||||
|
|
||||||
values =
|
values =
|
||||||
if builtins.any (definition: lib.types.is "order" definition.value) overridden.values
|
if builtins.any (definition: lib.types.is "order" definition.value) overridden.values then
|
||||||
then lib.modules.apply.order overridden.values
|
lib.modules.apply.order overridden.values
|
||||||
else overridden.values;
|
else
|
||||||
|
overridden.values;
|
||||||
|
|
||||||
isDefined = values != [];
|
isDefined = values != [ ];
|
||||||
|
|
||||||
invalid = builtins.filter (definition: !(type.check definition.value)) values;
|
invalid = builtins.filter (definition: !(type.check definition.value)) values;
|
||||||
|
|
||||||
merged =
|
merged =
|
||||||
if isDefined
|
if isDefined then
|
||||||
then
|
if builtins.all (definition: type.check definition.value) values then
|
||||||
if builtins.all (definition: type.check definition.value) values
|
type.merge location values
|
||||||
then type.merge location values
|
else
|
||||||
else builtins.throw "A definition for `${identifier}` is not of type `${type.description}`. Definition values:${lib.options.getDefinitions invalid}"
|
builtins.throw "A definition for `${identifier}` is not of type `${type.description}`. Definition values:${lib.options.getDefinitions invalid}"
|
||||||
else builtins.throw "The option `${identifier}` is used but not defined.";
|
else
|
||||||
|
builtins.throw "The option `${identifier}` is used but not defined.";
|
||||||
|
|
||||||
optional =
|
optional = if isDefined then { value = merged; } else { };
|
||||||
if isDefined
|
in
|
||||||
then {value = merged;}
|
{
|
||||||
else {};
|
|
||||||
in {
|
|
||||||
inherit
|
inherit
|
||||||
isDefined
|
isDefined
|
||||||
values
|
values
|
||||||
|
@ -87,25 +94,28 @@ lib: {
|
||||||
## Merge multiple option declarations together.
|
## Merge multiple option declarations together.
|
||||||
##
|
##
|
||||||
## @type Location -> List Option
|
## @type Location -> List Option
|
||||||
declarations = location: options: let
|
declarations =
|
||||||
merge = result: option: let
|
location: options:
|
||||||
|
let
|
||||||
|
merge =
|
||||||
|
result: option:
|
||||||
|
let
|
||||||
mergedType = result.type.mergeType option.options.type.functor;
|
mergedType = result.type.mergeType option.options.type.functor;
|
||||||
isTypeMergeable = mergedType != null;
|
isTypeMergeable = mergedType != null;
|
||||||
shared = name: option.options ? ${name} && result ? ${name};
|
shared = name: option.options ? ${name} && result ? ${name};
|
||||||
typeSet = lib.attrs.when ((shared "type") && isTypeMergeable) {type = mergedType;};
|
typeSet = lib.attrs.when ((shared "type") && isTypeMergeable) { type = mergedType; };
|
||||||
files = result.declarations;
|
files = result.declarations;
|
||||||
serializedFiles = builtins.concatStringsSep " and " files;
|
serializedFiles = builtins.concatStringsSep " and " files;
|
||||||
getSubModules = option.options.type.getSubModules or null;
|
getSubModules = option.options.type.getSubModules or null;
|
||||||
submodules =
|
submodules =
|
||||||
if getSubModules != null
|
if getSubModules != null then
|
||||||
then
|
|
||||||
builtins.map (module: {
|
builtins.map (module: {
|
||||||
__file__ = option.__file__;
|
__file__ = option.__file__;
|
||||||
includes = [module];
|
includes = [ module ];
|
||||||
})
|
}) getSubModules
|
||||||
getSubModules
|
|
||||||
++ result.options
|
++ result.options
|
||||||
else result.options;
|
else
|
||||||
|
result.options;
|
||||||
in
|
in
|
||||||
if
|
if
|
||||||
shared "default"
|
shared "default"
|
||||||
|
@ -113,57 +123,65 @@ lib: {
|
||||||
|| shared "description"
|
|| shared "description"
|
||||||
|| shared "apply"
|
|| shared "apply"
|
||||||
|| (shared "type" && !isTypeMergeable)
|
|| (shared "type" && !isTypeMergeable)
|
||||||
then builtins.throw "The option `${lib.options.getIdentifier location}` in `${option.__file__}` is already declared in ${serializedFiles}"
|
then
|
||||||
|
builtins.throw "The option `${lib.options.getIdentifier location}` in `${option.__file__}` is already declared in ${serializedFiles}"
|
||||||
else
|
else
|
||||||
option.options
|
option.options
|
||||||
// result
|
// result
|
||||||
// {
|
// {
|
||||||
declarations = result.declarations ++ [option.__file__];
|
declarations = result.declarations ++ [ option.__file__ ];
|
||||||
options = submodules;
|
options = submodules;
|
||||||
}
|
}
|
||||||
// typeSet;
|
// typeSet;
|
||||||
in
|
in
|
||||||
builtins.foldl' merge {
|
builtins.foldl' merge {
|
||||||
inherit location;
|
inherit location;
|
||||||
declarations = [];
|
declarations = [ ];
|
||||||
options = [];
|
options = [ ];
|
||||||
}
|
} options;
|
||||||
options;
|
|
||||||
|
|
||||||
## Merge an option, only supporting a single unique definition.
|
## Merge an option, only supporting a single unique definition.
|
||||||
##
|
##
|
||||||
## @type String -> Location -> List Definition -> Any
|
## @type String -> Location -> List Definition -> Any
|
||||||
unique = message: location: definitions: let
|
unique =
|
||||||
|
message: location: definitions:
|
||||||
|
let
|
||||||
identifier = lib.options.getIdentifier location;
|
identifier = lib.options.getIdentifier location;
|
||||||
total = builtins.length definitions;
|
total = builtins.length definitions;
|
||||||
first = builtins.elemAt definitions 0;
|
first = builtins.elemAt definitions 0;
|
||||||
in
|
in
|
||||||
if total == 1
|
if total == 1 then
|
||||||
then first.value
|
first.value
|
||||||
else if total == 0
|
else if total == 0 then
|
||||||
then builtins.throw "Cannot merge unused option `${identifier}`.\n${message}"
|
builtins.throw "Cannot merge unused option `${identifier}`.\n${message}"
|
||||||
else builtins.throw "The option `${identifier}` is defined multiple times, but must be unique.\n${message}\nDefinitions:${lib.options.getDefinitions definitions}";
|
else
|
||||||
|
builtins.throw "The option `${identifier}` is defined multiple times, but must be unique.\n${message}\nDefinitions:${lib.options.getDefinitions definitions}";
|
||||||
|
|
||||||
## Merge a single instance of an option.
|
## Merge a single instance of an option.
|
||||||
##
|
##
|
||||||
## @type Location -> List Definition -> Any
|
## @type Location -> List Definition -> Any
|
||||||
one = lib.options.merge.unique "";
|
one = lib.options.merge.unique "";
|
||||||
|
|
||||||
equal = location: definitions: let
|
equal =
|
||||||
|
location: definitions:
|
||||||
|
let
|
||||||
identifier = lib.options.getIdentifier location;
|
identifier = lib.options.getIdentifier location;
|
||||||
first = builtins.elemAt definitions 0;
|
first = builtins.elemAt definitions 0;
|
||||||
rest = builtins.tail definitions;
|
rest = builtins.tail definitions;
|
||||||
merge = x: y:
|
merge =
|
||||||
if x != y
|
x: y:
|
||||||
then builtins.throw "The option `${identifier}` has conflicting definitions:${lib.options.getDefinitions definitions}"
|
if x != y then
|
||||||
else x;
|
builtins.throw "The option `${identifier}` has conflicting definitions:${lib.options.getDefinitions definitions}"
|
||||||
|
else
|
||||||
|
x;
|
||||||
merged = builtins.foldl' merge first rest;
|
merged = builtins.foldl' merge first rest;
|
||||||
in
|
in
|
||||||
if builtins.length definitions == 0
|
if builtins.length definitions == 0 then
|
||||||
then builtins.throw "Cannot merge unused option `${identifier}`."
|
builtins.throw "Cannot merge unused option `${identifier}`."
|
||||||
else if builtins.length definitions == 1
|
else if builtins.length definitions == 1 then
|
||||||
then first.value
|
first.value
|
||||||
else merged.value;
|
else
|
||||||
|
merged.value;
|
||||||
};
|
};
|
||||||
|
|
||||||
## Check whether a value is an option.
|
## Check whether a value is an option.
|
||||||
|
@ -174,16 +192,18 @@ lib: {
|
||||||
## Create an option.
|
## Create an option.
|
||||||
##
|
##
|
||||||
## @type { type? :: String | Null, apply? :: (a -> b) | Null, default? :: { value :: a, text :: String }, example? :: String | Null, visible? :: Bool | Null, internal? :: Bool | Null, writable? :: Bool | Null, description? :: String | Null } -> Option a
|
## @type { type? :: String | Null, apply? :: (a -> b) | Null, default? :: { value :: a, text :: String }, example? :: String | Null, visible? :: Bool | Null, internal? :: Bool | Null, writable? :: Bool | Null, description? :: String | Null } -> Option a
|
||||||
create = settings @ {
|
create =
|
||||||
|
settings@{
|
||||||
type ? lib.types.unspecified,
|
type ? lib.types.unspecified,
|
||||||
apply ? null,
|
apply ? null,
|
||||||
default ? {},
|
default ? { },
|
||||||
example ? null,
|
example ? null,
|
||||||
visible ? null,
|
visible ? null,
|
||||||
internal ? null,
|
internal ? null,
|
||||||
writable ? null,
|
writable ? null,
|
||||||
description ? null,
|
description ? null,
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
__type__ = "option";
|
__type__ = "option";
|
||||||
inherit
|
inherit
|
||||||
type
|
type
|
||||||
|
@ -200,7 +220,9 @@ lib: {
|
||||||
## Create a sink option.
|
## Create a sink option.
|
||||||
##
|
##
|
||||||
## @type @alias lib.options.create
|
## @type @alias lib.options.create
|
||||||
sink = settings: let
|
sink =
|
||||||
|
settings:
|
||||||
|
let
|
||||||
defaults = {
|
defaults = {
|
||||||
internal = true;
|
internal = true;
|
||||||
visible = false;
|
visible = false;
|
||||||
|
@ -224,7 +246,9 @@ lib: {
|
||||||
## Convert a list of option identifiers into a single identifier.
|
## Convert a list of option identifiers into a single identifier.
|
||||||
##
|
##
|
||||||
## @type List String -> String
|
## @type List String -> String
|
||||||
getIdentifier = location: let
|
getIdentifier =
|
||||||
|
location:
|
||||||
|
let
|
||||||
special = [
|
special = [
|
||||||
# lib.types.attrs.of (lib.types.submodule {})
|
# lib.types.attrs.of (lib.types.submodule {})
|
||||||
"<name>"
|
"<name>"
|
||||||
|
@ -233,26 +257,25 @@ lib: {
|
||||||
# lib.types.function
|
# lib.types.function
|
||||||
"<function body>"
|
"<function body>"
|
||||||
];
|
];
|
||||||
escape = part:
|
escape = part: if builtins.elem part special then part else lib.strings.escape.nix.identifier part;
|
||||||
if builtins.elem part special
|
|
||||||
then part
|
|
||||||
else lib.strings.escape.nix.identifier part;
|
|
||||||
in
|
in
|
||||||
lib.strings.concatMapSep "." escape location;
|
lib.strings.concatMapSep "." escape location;
|
||||||
|
|
||||||
## Get a string message of the definitions for an option.
|
## Get a string message of the definitions for an option.
|
||||||
##
|
##
|
||||||
## @type List Definition -> String
|
## @type List Definition -> String
|
||||||
getDefinitions = definitions: let
|
getDefinitions =
|
||||||
serialize = definition: let
|
definitions:
|
||||||
valueWithRecursionLimit =
|
let
|
||||||
lib.generators.withRecursion {
|
serialize =
|
||||||
|
definition:
|
||||||
|
let
|
||||||
|
valueWithRecursionLimit = lib.generators.withRecursion {
|
||||||
limit = 10;
|
limit = 10;
|
||||||
throw = false;
|
throw = false;
|
||||||
}
|
} definition.value;
|
||||||
definition.value;
|
|
||||||
|
|
||||||
eval = builtins.tryEval (lib.generators.pretty {} valueWithRecursionLimit);
|
eval = builtins.tryEval (lib.generators.pretty { } valueWithRecursionLimit);
|
||||||
|
|
||||||
lines = lib.strings.split "\n" eval.value;
|
lines = lib.strings.split "\n" eval.value;
|
||||||
linesLength = builtins.length lines;
|
linesLength = builtins.length lines;
|
||||||
|
@ -263,24 +286,27 @@ lib: {
|
||||||
value = builtins.concatStringsSep "\n " (firstFiveLines ++ ellipsis);
|
value = builtins.concatStringsSep "\n " (firstFiveLines ++ ellipsis);
|
||||||
|
|
||||||
result =
|
result =
|
||||||
if !eval.success
|
if !eval.success then
|
||||||
then ""
|
""
|
||||||
else if linesLength > 1
|
else if linesLength > 1 then
|
||||||
then ":\n " + value
|
":\n " + value
|
||||||
else ": " + value;
|
else
|
||||||
in "\n- In `${definition.__file__}`${result}";
|
": " + value;
|
||||||
|
in
|
||||||
|
"\n- In `${definition.__file__}`${result}";
|
||||||
in
|
in
|
||||||
lib.strings.concatMap serialize definitions;
|
lib.strings.concatMap serialize definitions;
|
||||||
|
|
||||||
## Run a set of definitions, calculating the resolved value and associated information.
|
## Run a set of definitions, calculating the resolved value and associated information.
|
||||||
##
|
##
|
||||||
## @type Location -> Option -> List Definition -> String & { value :: Any, highestPriority :: Int, isDefined :: Bool, files :: List String, definitions :: List Any, definitionsWithLocations :: List Definition }
|
## @type Location -> Option -> List Definition -> String & { value :: Any, highestPriority :: Int, isDefined :: Bool, files :: List String, definitions :: List Any, definitionsWithLocations :: List Definition }
|
||||||
run = location: option: definitions: let
|
run =
|
||||||
|
location: option: definitions:
|
||||||
|
let
|
||||||
identifier = lib.options.getIdentifier location;
|
identifier = lib.options.getIdentifier location;
|
||||||
|
|
||||||
definitionsWithDefault =
|
definitionsWithDefault =
|
||||||
if option ? default && option.default ? value
|
if option ? default && option.default ? value then
|
||||||
then
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
__file__ = builtins.head option.declarations;
|
__file__ = builtins.head option.declarations;
|
||||||
|
@ -288,28 +314,25 @@ lib: {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
++ definitions
|
++ definitions
|
||||||
else definitions;
|
else
|
||||||
|
definitions;
|
||||||
|
|
||||||
merged =
|
merged =
|
||||||
if option.writable or null == false && builtins.length definitionsWithDefault > 1
|
if option.writable or null == false && builtins.length definitionsWithDefault > 1 then
|
||||||
then let
|
let
|
||||||
separatedDefinitions =
|
separatedDefinitions = builtins.map (
|
||||||
builtins.map (
|
|
||||||
definition:
|
definition:
|
||||||
definition
|
definition
|
||||||
// {
|
// {
|
||||||
value = (lib.options.merge.definitions location option.type [definition]).merged;
|
value = (lib.options.merge.definitions location option.type [ definition ]).merged;
|
||||||
}
|
}
|
||||||
)
|
) definitionsWithDefault;
|
||||||
definitionsWithDefault;
|
|
||||||
in
|
in
|
||||||
builtins.throw "The option `${identifier}` is not writable, but is set more than once:${lib.options.getDefinitions separatedDefinitions}"
|
builtins.throw "The option `${identifier}` is not writable, but is set more than once:${lib.options.getDefinitions separatedDefinitions}"
|
||||||
else lib.options.merge.definitions location option.type definitionsWithDefault;
|
else
|
||||||
|
lib.options.merge.definitions location option.type definitionsWithDefault;
|
||||||
|
|
||||||
value =
|
value = if option.apply or null != null then option.apply merged.merged else merged.merged;
|
||||||
if option.apply or null != null
|
|
||||||
then option.apply merged.merged
|
|
||||||
else merged.merged;
|
|
||||||
in
|
in
|
||||||
option
|
option
|
||||||
// {
|
// {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,39 +1,35 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.builders.basic;
|
cfg = config.builders.basic;
|
||||||
|
|
||||||
lib' = config.lib;
|
lib' = config.lib;
|
||||||
|
|
||||||
inherit (config) foundation;
|
inherit (config) foundation;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
config.builders = {
|
config.builders = {
|
||||||
basic = {
|
basic = {
|
||||||
executable = "${foundation.stage2-bash}/bin/bash";
|
executable = "${foundation.stage2-bash}/bin/bash";
|
||||||
|
|
||||||
build = package: let
|
build =
|
||||||
|
package:
|
||||||
|
let
|
||||||
phases = lib.dag.apply.defaults package.phases {
|
phases = lib.dag.apply.defaults package.phases {
|
||||||
unpack = lib.dag.entry.before ["patch"] "";
|
unpack = lib.dag.entry.before [ "patch" ] "";
|
||||||
|
|
||||||
patch = lib.dag.entry.between ["configure"] ["unpack"] "";
|
patch = lib.dag.entry.between [ "configure" ] [ "unpack" ] "";
|
||||||
|
|
||||||
configure = lib.dag.entry.between ["build"] ["patch"] "";
|
configure = lib.dag.entry.between [ "build" ] [ "patch" ] "";
|
||||||
|
|
||||||
build = lib.dag.entry.between ["install"] ["configure"] "";
|
build = lib.dag.entry.between [ "install" ] [ "configure" ] "";
|
||||||
|
|
||||||
install = lib.dag.entry.after ["build"] "";
|
install = lib.dag.entry.after [ "build" ] "";
|
||||||
};
|
};
|
||||||
sorted = lib.dag.sort.topographic phases;
|
sorted = lib.dag.sort.topographic phases;
|
||||||
|
|
||||||
script =
|
script = lib.strings.concatMapSep "\n" (
|
||||||
lib.strings.concatMapSep "\n" (
|
entry: if builtins.isFunction entry.value then entry.value package else entry.value
|
||||||
entry:
|
) sorted.result;
|
||||||
if builtins.isFunction entry.value
|
|
||||||
then entry.value package
|
|
||||||
else entry.value
|
|
||||||
)
|
|
||||||
sorted.result;
|
|
||||||
|
|
||||||
system = package.platform.build.double;
|
system = package.platform.build.double;
|
||||||
|
|
||||||
|
@ -43,11 +39,12 @@ in {
|
||||||
inherit (package) name;
|
inherit (package) name;
|
||||||
inherit script system;
|
inherit script system;
|
||||||
|
|
||||||
passAsFile = ["script"];
|
passAsFile = [ "script" ];
|
||||||
|
|
||||||
SHELL = cfg.executable;
|
SHELL = cfg.executable;
|
||||||
|
|
||||||
PATH = let
|
PATH =
|
||||||
|
let
|
||||||
bins = lib.paths.bin (
|
bins = lib.paths.bin (
|
||||||
(lib'.packages.dependencies.getPackages package.deps.build.host)
|
(lib'.packages.dependencies.getPackages package.deps.build.host)
|
||||||
++ [
|
++ [
|
||||||
|
@ -57,7 +54,7 @@ in {
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
builtins.concatStringsSep ":" (
|
builtins.concatStringsSep ":" (
|
||||||
[bins] ++ (lib.lists.when (package.env ? PATH) [package.env.PATH])
|
[ bins ] ++ (lib.lists.when (package.env ? PATH) [ package.env.PATH ])
|
||||||
);
|
);
|
||||||
|
|
||||||
builder = cfg.executable;
|
builder = cfg.executable;
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
# 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}: let
|
{ config }:
|
||||||
|
let
|
||||||
inherit (config) lib;
|
inherit (config) lib;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
# freeform = lib.types.any;
|
# freeform = lib.types.any;
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
|
{ lib, config }:
|
||||||
|
let
|
||||||
|
in
|
||||||
{
|
{
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
in {
|
|
||||||
config = {
|
config = {
|
||||||
lib.options = {
|
lib.options = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
|
|
@ -1,41 +1,48 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
lib' = config.lib;
|
lib' = config.lib;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
config = {
|
config = {
|
||||||
lib.packages = {
|
lib.packages = {
|
||||||
dependencies = {
|
dependencies = {
|
||||||
getPackages = dependencies: let
|
getPackages =
|
||||||
|
dependencies:
|
||||||
|
let
|
||||||
available = builtins.filter (dependency: !(builtins.isNull dependency)) (
|
available = builtins.filter (dependency: !(builtins.isNull dependency)) (
|
||||||
builtins.attrValues dependencies
|
builtins.attrValues dependencies
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
builtins.map (dependency: dependency.package) available;
|
builtins.map (dependency: dependency.package) available;
|
||||||
|
|
||||||
build = build': host': target':
|
build =
|
||||||
builtins.mapAttrs
|
build': host': target':
|
||||||
(name: dep: lib'.packages.build dep build' host' target');
|
builtins.mapAttrs (name: dep: lib'.packages.build dep build' host' target');
|
||||||
};
|
};
|
||||||
|
|
||||||
getLatest = alias: let
|
getLatest =
|
||||||
|
alias:
|
||||||
|
let
|
||||||
versions = builtins.attrNames alias.versions;
|
versions = builtins.attrNames alias.versions;
|
||||||
sorted = builtins.sort (lib.versions.gte) versions;
|
sorted = builtins.sort (lib.versions.gte) versions;
|
||||||
in
|
in
|
||||||
builtins.head sorted;
|
builtins.head sorted;
|
||||||
|
|
||||||
resolve = alias:
|
resolve =
|
||||||
if alias ? versions
|
alias:
|
||||||
then
|
if alias ? versions then
|
||||||
alias.versions.${config.preferences.packages.version}
|
alias.versions.${config.preferences.packages.version}
|
||||||
or (alias.versions.${lib'.packages.getLatest alias})
|
or (alias.versions.${lib'.packages.getLatest alias})
|
||||||
else alias;
|
else
|
||||||
|
alias;
|
||||||
|
|
||||||
build = alias: build: host: target: let
|
build =
|
||||||
|
alias: build: host: target:
|
||||||
|
let
|
||||||
package = lib'.packages.resolve alias;
|
package = lib'.packages.resolve alias;
|
||||||
|
|
||||||
buildDependencies = build': host': target':
|
buildDependencies =
|
||||||
|
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 = {
|
platform = {
|
||||||
|
@ -45,12 +52,11 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
withPlatform = lib.modules.run {
|
withPlatform = lib.modules.run {
|
||||||
modules =
|
modules = package.__modules__ ++ [
|
||||||
package.__modules__
|
|
||||||
++ [
|
|
||||||
lib'.types.package.children.submodule
|
lib'.types.package.children.submodule
|
||||||
(
|
(
|
||||||
{config}: {
|
{ config }:
|
||||||
|
{
|
||||||
config = {
|
config = {
|
||||||
__modules__ = package.__modules__;
|
__modules__ = package.__modules__;
|
||||||
|
|
||||||
|
@ -64,9 +70,7 @@ in {
|
||||||
# Not all platform information can be effectively handled via submodules. To handle
|
# 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
|
# the case where a user copies the resolved config over we need to ensure that
|
||||||
# dependencies are appropriately updated.
|
# dependencies are appropriately updated.
|
||||||
withDeps =
|
withDeps = withPlatform.config // {
|
||||||
withPlatform.config
|
|
||||||
// {
|
|
||||||
deps = {
|
deps = {
|
||||||
build = {
|
build = {
|
||||||
only = buildDependencies build build build withPlatform.config.deps.build.only;
|
only = buildDependencies build build build withPlatform.config.deps.build.only;
|
||||||
|
@ -87,12 +91,11 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
withPackage = lib.modules.run {
|
withPackage = lib.modules.run {
|
||||||
modules =
|
modules = package.__modules__ ++ [
|
||||||
package.__modules__
|
|
||||||
++ [
|
|
||||||
lib'.types.package.children.submodule
|
lib'.types.package.children.submodule
|
||||||
(
|
(
|
||||||
{config}: {
|
{ config }:
|
||||||
|
{
|
||||||
config = {
|
config = {
|
||||||
__modules__ = package.__modules__;
|
__modules__ = package.__modules__;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,16 +1,17 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
inherit (config) preferences builders;
|
inherit (config) preferences builders;
|
||||||
|
|
||||||
lib' = config.lib;
|
lib' = config.lib;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
config = {
|
config = {
|
||||||
lib.types = {
|
lib.types = {
|
||||||
license = let
|
license =
|
||||||
|
let
|
||||||
type = lib.types.submodule (
|
type = lib.types.submodule (
|
||||||
{config}: {
|
{ config }:
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
name = {
|
name = {
|
||||||
full = lib.options.create {
|
full = lib.options.create {
|
||||||
|
@ -56,9 +57,7 @@ in {
|
||||||
lib.types.either type (lib.types.list.of type);
|
lib.types.either type (lib.types.list.of type);
|
||||||
|
|
||||||
platform =
|
platform =
|
||||||
lib.types.coerce
|
lib.types.coerce lib.types.string lib'.systems.withBuildInfo
|
||||||
lib.types.string
|
|
||||||
lib'.systems.withBuildInfo
|
|
||||||
lib'.systems.types.platformWithBuildInfo;
|
lib'.systems.types.platformWithBuildInfo;
|
||||||
|
|
||||||
builder = lib.types.submodule {
|
builder = lib.types.submodule {
|
||||||
|
@ -74,10 +73,14 @@ in {
|
||||||
|
|
||||||
packages = lib.types.attrs.of (lib.types.attrs.of lib'.types.alias);
|
packages = lib.types.attrs.of (lib.types.attrs.of lib'.types.alias);
|
||||||
|
|
||||||
dependencies = build: host: target: let
|
dependencies =
|
||||||
|
build: host: target:
|
||||||
|
let
|
||||||
initial = lib.types.raw;
|
initial = lib.types.raw;
|
||||||
|
|
||||||
transform = value: let
|
transform =
|
||||||
|
value:
|
||||||
|
let
|
||||||
package = lib'.packages.resolve value;
|
package = lib'.packages.resolve value;
|
||||||
in
|
in
|
||||||
lib'.packages.build package build host target;
|
lib'.packages.build package build host target;
|
||||||
|
@ -99,76 +102,78 @@ in {
|
||||||
versions = lib.options.create {
|
versions = lib.options.create {
|
||||||
description = "Available versions of the package.";
|
description = "Available versions of the package.";
|
||||||
type = lib.types.attrs.of lib'.types.package;
|
type = lib.types.attrs.of lib'.types.package;
|
||||||
default.value = {};
|
default.value = { };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
normalize = value:
|
let
|
||||||
if builtins.isFunction value || builtins.isList value
|
normalize =
|
||||||
then value
|
value:
|
||||||
else if value ? __modules__
|
if builtins.isFunction value || builtins.isList value then
|
||||||
then value.__modules__
|
value
|
||||||
else {
|
else if value ? __modules__ then
|
||||||
config = value;
|
value.__modules__
|
||||||
};
|
else
|
||||||
|
{ config = value; };
|
||||||
|
|
||||||
initial = lib.types.create {
|
initial = lib.types.create {
|
||||||
name = "PackageConfig";
|
name = "PackageConfig";
|
||||||
description = "configuration for a package";
|
description = "configuration for a package";
|
||||||
check = value: builtins.isFunction value || builtins.isAttrs value || builtins.isList value;
|
check = value: builtins.isFunction value || builtins.isAttrs value || builtins.isList value;
|
||||||
merge = location: definitions: let
|
merge =
|
||||||
normalized =
|
location: definitions:
|
||||||
builtins.map
|
let
|
||||||
(definition: lib.lists.from.any (normalize definition.value))
|
normalized = builtins.map (definition: lib.lists.from.any (normalize definition.value)) definitions;
|
||||||
definitions;
|
|
||||||
in
|
in
|
||||||
builtins.concatLists
|
builtins.concatLists normalized;
|
||||||
normalized;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
transform = location: value: let
|
transform =
|
||||||
modules =
|
location: value:
|
||||||
lib.lists.from.any (normalize value);
|
let
|
||||||
|
modules = lib.lists.from.any (normalize value);
|
||||||
|
|
||||||
result = lib.modules.run {
|
result = lib.modules.run {
|
||||||
prefix = location;
|
prefix = location;
|
||||||
modules =
|
modules = modules ++ [
|
||||||
modules
|
submodule
|
||||||
++ [submodule {config.__modules__ = modules;}];
|
{ config.__modules__ = modules; }
|
||||||
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
result.config;
|
result.config;
|
||||||
|
|
||||||
final = lib.types.raw;
|
final = lib.types.raw;
|
||||||
|
|
||||||
deps = build: host: target:
|
deps =
|
||||||
|
build: host: target:
|
||||||
lib.types.submodule {
|
lib.types.submodule {
|
||||||
options = {
|
options = {
|
||||||
build = {
|
build = {
|
||||||
only = lib.options.create {
|
only = lib.options.create {
|
||||||
description = "Dependencies which are only used in the build environment.";
|
description = "Dependencies which are only used in the build environment.";
|
||||||
type = lib'.types.dependencies build build build;
|
type = lib'.types.dependencies build build build;
|
||||||
default.value = {};
|
default.value = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
build = lib.options.create {
|
build = lib.options.create {
|
||||||
description = "Dependencies which are created in the build environment and are executed in the build environment.";
|
description = "Dependencies which are created in the build environment and are executed in the build environment.";
|
||||||
type = lib'.types.dependencies build build target;
|
type = lib'.types.dependencies build build target;
|
||||||
default.value = {};
|
default.value = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
host = lib.options.create {
|
host = lib.options.create {
|
||||||
description = "Dependencies which are created in the build environment and are executed in the host environment.";
|
description = "Dependencies which are created in the build environment and are executed in the host environment.";
|
||||||
type = lib'.types.dependencies build host target;
|
type = lib'.types.dependencies build host target;
|
||||||
default.value = {};
|
default.value = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
target = lib.options.create {
|
target = lib.options.create {
|
||||||
description = "Dependencies which are created in the build environment and are executed in the target environment.";
|
description = "Dependencies which are created in the build environment and are executed in the target environment.";
|
||||||
type = lib'.types.dependencies build target target;
|
type = lib'.types.dependencies build target target;
|
||||||
default.value = {};
|
default.value = { };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -176,19 +181,19 @@ in {
|
||||||
only = lib.options.create {
|
only = lib.options.create {
|
||||||
description = "Dependencies which are only used in the host environment.";
|
description = "Dependencies which are only used in the host environment.";
|
||||||
type = lib'.types.dependencies host host host;
|
type = lib'.types.dependencies host host host;
|
||||||
default.value = {};
|
default.value = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
host = lib.options.create {
|
host = lib.options.create {
|
||||||
description = "Dependencies which are executed in the host environment.";
|
description = "Dependencies which are executed in the host environment.";
|
||||||
type = lib'.types.dependencies host host target;
|
type = lib'.types.dependencies host host target;
|
||||||
default.value = {};
|
default.value = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
target = lib.options.create {
|
target = lib.options.create {
|
||||||
description = "Dependencies which are executed in the host environment which produces code for the target environment.";
|
description = "Dependencies which are executed in the host environment which produces code for the target environment.";
|
||||||
type = lib'.types.dependencies host target target;
|
type = lib'.types.dependencies host target target;
|
||||||
default.value = {};
|
default.value = { };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -196,33 +201,33 @@ in {
|
||||||
only = lib.options.create {
|
only = lib.options.create {
|
||||||
description = "Dependencies which are only used in the target environment.";
|
description = "Dependencies which are only used in the target environment.";
|
||||||
type = lib'.types.dependencies target target target;
|
type = lib'.types.dependencies target target target;
|
||||||
default.value = {};
|
default.value = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
target = lib.options.create {
|
target = lib.options.create {
|
||||||
description = "Dependencies which are executed in the target environment.";
|
description = "Dependencies which are executed in the target environment.";
|
||||||
type = lib'.types.dependencies target target target;
|
type = lib'.types.dependencies target target target;
|
||||||
default.value = {};
|
default.value = { };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
submodule = {config}: let
|
submodule =
|
||||||
|
{ config }:
|
||||||
|
let
|
||||||
build = config.platform.build;
|
build = config.platform.build;
|
||||||
host = config.platform.host;
|
host = config.platform.host;
|
||||||
target = config.platform.target;
|
target = config.platform.target;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
__modules__ = lib.options.create {
|
__modules__ = lib.options.create {
|
||||||
description = "User specified modules for the package definition.";
|
description = "User specified modules for the package definition.";
|
||||||
type = lib.types.list.of (initial
|
type = lib.types.list.of (initial // { merge = lib.options.merge.one; });
|
||||||
// {
|
|
||||||
merge = lib.options.merge.one;
|
|
||||||
});
|
|
||||||
# writable = false;
|
# writable = false;
|
||||||
internal = true;
|
internal = true;
|
||||||
default.value = [];
|
default.value = [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -271,7 +276,7 @@ in {
|
||||||
platforms = lib.options.create {
|
platforms = lib.options.create {
|
||||||
description = "The platforms the package supports.";
|
description = "The platforms the package supports.";
|
||||||
type = lib.types.list.of lib.types.string;
|
type = lib.types.list.of lib.types.string;
|
||||||
default.value = [];
|
default.value = [ ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -301,9 +306,7 @@ in {
|
||||||
default = {
|
default = {
|
||||||
text = "\${config.pname}-\${config.version}";
|
text = "\${config.pname}-\${config.version}";
|
||||||
value =
|
value =
|
||||||
if config.pname != null && config.version != null
|
if config.pname != null && config.version != null then "${config.pname}-${config.version}" else "";
|
||||||
then "${config.pname}-${config.version}"
|
|
||||||
else "";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -327,13 +330,13 @@ in {
|
||||||
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.string;
|
||||||
default.value = {};
|
default.value = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
env = lib.options.create {
|
env = lib.options.create {
|
||||||
description = "The environment for the package.";
|
description = "The environment for the package.";
|
||||||
type = lib.types.attrs.of lib.types.string;
|
type = lib.types.attrs.of lib.types.string;
|
||||||
default.value = {};
|
default.value = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -345,7 +348,7 @@ in {
|
||||||
deps = lib.options.create {
|
deps = lib.options.create {
|
||||||
description = "The dependencies for the package.";
|
description = "The dependencies for the package.";
|
||||||
type = deps build host target;
|
type = deps build host target;
|
||||||
default.value = {};
|
default.value = { };
|
||||||
apply = value: {
|
apply = value: {
|
||||||
build = {
|
build = {
|
||||||
only = lib'.packages.dependencies.build build build build value.build.only;
|
only = lib'.packages.dependencies.build build build build value.build.only;
|
||||||
|
@ -367,18 +370,14 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
type =
|
type = (lib.types.coerceWithLocation initial transform final) // {
|
||||||
(lib.types.coerceWithLocation initial transform final)
|
|
||||||
// {
|
|
||||||
name = "Package";
|
name = "Package";
|
||||||
description = "a package definition";
|
description = "a package definition";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
type
|
type
|
||||||
// {
|
// {
|
||||||
children =
|
children = type.children // {
|
||||||
type.children
|
|
||||||
// {
|
|
||||||
inherit submodule;
|
inherit submodule;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
{
|
{ lib', config }:
|
||||||
lib',
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
inherit (config) builders packages;
|
inherit (config) builders packages;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
config.packages.aux.a = {
|
config.packages.aux.a = {
|
||||||
versions = {
|
versions = {
|
||||||
"latest" = {config}: {
|
"latest" =
|
||||||
|
{ config }:
|
||||||
|
{
|
||||||
config = {
|
config = {
|
||||||
meta = {
|
meta = {
|
||||||
platforms = ["i686-linux"];
|
platforms = [ "i686-linux" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
name = "${config.pname}-${config.version}";
|
name = "${config.pname}-${config.version}";
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
{config}: let
|
{ config }:
|
||||||
|
let
|
||||||
inherit (config) lib builders packages;
|
inherit (config) lib builders packages;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
config.packages.aux.b = {
|
config.packages.aux.b = {
|
||||||
versions = {
|
versions = {
|
||||||
"latest" = {config}: {
|
"latest" =
|
||||||
|
{ config }:
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
custom = lib.options.create {
|
custom = lib.options.create { type = lib.types.bool; };
|
||||||
type = lib.types.bool;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
meta = {
|
meta = {
|
||||||
platforms = ["i686-linux"];
|
platforms = [ "i686-linux" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
name = "${config.pname}-${config.version}";
|
name = "${config.pname}-${config.version}";
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
{config}: let
|
{ config }:
|
||||||
|
let
|
||||||
inherit (config) lib;
|
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/a.nix
|
||||||
|
@ -22,7 +24,7 @@ in {
|
||||||
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 = { };
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -45,9 +47,12 @@ in {
|
||||||
builtins.mapAttrs (
|
builtins.mapAttrs (
|
||||||
namespace:
|
namespace:
|
||||||
builtins.mapAttrs (
|
builtins.mapAttrs (
|
||||||
name: alias: let
|
name: alias:
|
||||||
setHost = package:
|
let
|
||||||
package // {
|
setHost =
|
||||||
|
package:
|
||||||
|
package
|
||||||
|
// {
|
||||||
__modules__ = package.__modules__ ++ [
|
__modules__ = package.__modules__ ++ [
|
||||||
{
|
{
|
||||||
config.platform = {
|
config.platform = {
|
||||||
|
@ -90,15 +95,12 @@ in {
|
||||||
# .config
|
# .config
|
||||||
# else package;
|
# else package;
|
||||||
|
|
||||||
updated =
|
updated = alias // {
|
||||||
alias
|
|
||||||
// {
|
|
||||||
versions = builtins.mapAttrs (version: package: setHost package) alias.versions;
|
versions = builtins.mapAttrs (version: package: setHost package) alias.versions;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
updated
|
updated
|
||||||
)
|
)
|
||||||
)
|
) packages
|
||||||
packages
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
lib',
|
lib',
|
||||||
config,
|
config,
|
||||||
options,
|
options,
|
||||||
}: let
|
}:
|
||||||
inherit
|
let
|
||||||
(config)
|
inherit (config)
|
||||||
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.
|
||||||
|
@ -13,10 +13,13 @@
|
||||||
foundation
|
foundation
|
||||||
packages
|
packages
|
||||||
;
|
;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
config.packages.foundation.binutils = {
|
config.packages.foundation.binutils = {
|
||||||
versions = {
|
versions = {
|
||||||
"latest" = {config}: {
|
"latest" =
|
||||||
|
{ config }:
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
src = lib.options.create {
|
src = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
@ -26,7 +29,7 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
meta = {
|
meta = {
|
||||||
platforms = ["i686-linux"];
|
platforms = [ "i686-linux" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
pname = "binutils";
|
pname = "binutils";
|
||||||
|
@ -58,7 +61,8 @@ in {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
phases = let
|
phases =
|
||||||
|
let
|
||||||
patches = [
|
patches = [
|
||||||
# Make binutils output deterministic by default.
|
# Make binutils output deterministic by default.
|
||||||
./patches/deterministic.patch
|
./patches/deterministic.patch
|
||||||
|
@ -89,7 +93,8 @@ in {
|
||||||
|
|
||||||
"--disable-multilib"
|
"--disable-multilib"
|
||||||
];
|
];
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
unpack = ''
|
unpack = ''
|
||||||
tar xf ${config.src}
|
tar xf ${config.src}
|
||||||
cd binutils-${config.version}
|
cd binutils-${config.version}
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
lib',
|
lib',
|
||||||
config,
|
config,
|
||||||
options,
|
options,
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
includes = [
|
includes = [
|
||||||
./gcc
|
./gcc
|
||||||
./binutils
|
./binutils
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
{
|
{ config, options }:
|
||||||
config,
|
let
|
||||||
options,
|
inherit (config)
|
||||||
}: let
|
|
||||||
inherit
|
|
||||||
(config)
|
|
||||||
lib
|
lib
|
||||||
mirrors
|
mirrors
|
||||||
builders
|
builders
|
||||||
|
@ -12,13 +9,13 @@
|
||||||
foundation
|
foundation
|
||||||
packages
|
packages
|
||||||
;
|
;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
config.packages.foundation.gcc = {
|
config.packages.foundation.gcc = {
|
||||||
versions = {
|
versions = {
|
||||||
"latest" = {
|
"latest" =
|
||||||
config,
|
{ config, meta }:
|
||||||
meta,
|
{
|
||||||
}: {
|
|
||||||
options = {
|
options = {
|
||||||
src = lib.options.create {
|
src = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
@ -82,7 +79,7 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
meta = {
|
meta = {
|
||||||
platforms = ["i686-linux"];
|
platforms = [ "i686-linux" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
pname = "gcc";
|
pname = "gcc";
|
||||||
|
@ -107,17 +104,13 @@ in {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
phases = let
|
phases =
|
||||||
|
let
|
||||||
host = lib.systems.withBuildInfo config.platform.host;
|
host = lib.systems.withBuildInfo config.platform.host;
|
||||||
|
|
||||||
mbits =
|
mbits = if host.system.cpu.family == "x86" then if host.is64bit then "-m64" else "-m32" else "";
|
||||||
if host.system.cpu.family == "x86"
|
in
|
||||||
then
|
{
|
||||||
if host.is64bit
|
|
||||||
then "-m64"
|
|
||||||
else "-m32"
|
|
||||||
else "";
|
|
||||||
in {
|
|
||||||
unpack = ''
|
unpack = ''
|
||||||
# Unpack
|
# Unpack
|
||||||
tar xf ${config.src}
|
tar xf ${config.src}
|
||||||
|
|
|
@ -3,22 +3,22 @@
|
||||||
lib',
|
lib',
|
||||||
config,
|
config,
|
||||||
options,
|
options,
|
||||||
}: let
|
}:
|
||||||
inherit
|
let
|
||||||
(config)
|
inherit (config)
|
||||||
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
|
||||||
;
|
;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
config.packages.foundation.linux-headers = {
|
config.packages.foundation.linux-headers = {
|
||||||
versions = {
|
versions = {
|
||||||
"latest" = {
|
"latest" =
|
||||||
config,
|
{ config, meta }:
|
||||||
meta,
|
{
|
||||||
}: {
|
|
||||||
options = {
|
options = {
|
||||||
src = lib.options.create {
|
src = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
@ -28,7 +28,7 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
meta = {
|
meta = {
|
||||||
platforms = ["i686-linux"];
|
platforms = [ "i686-linux" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
pname = "linux-headers";
|
pname = "linux-headers";
|
||||||
|
|
Loading…
Reference in a new issue