refactor(format): apply formatting
This commit is contained in:
parent
d2b053d63a
commit
0a63667459
|
@ -4,166 +4,184 @@ 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 =
|
||||||
values = lib.options.getDefinitionValues definitions;
|
location: definitions:
|
||||||
first = builtins.elemAt values 0;
|
let
|
||||||
mergedFunctions = x: lib.options.mergeDefault location (builtins.map (f: f x) values);
|
values = lib.options.getDefinitionValues definitions;
|
||||||
mergedLists = builtins.concatLists values;
|
first = builtins.elemAt values 0;
|
||||||
mergedAttrs = builtins.foldl' lib.attrs.merge {} values;
|
mergedFunctions = x: lib.options.mergeDefault location (builtins.map (f: f x) values);
|
||||||
mergedBools = builtins.any lib.bools.or false values;
|
mergedLists = builtins.concatLists values;
|
||||||
mergedStrings = lib.strings.concat values;
|
mergedAttrs = builtins.foldl' lib.attrs.merge { } values;
|
||||||
in
|
mergedBools = builtins.any lib.bools.or false values;
|
||||||
if builtins.length values == 1
|
mergedStrings = lib.strings.concat values;
|
||||||
then builtins.elemAt values 0
|
in
|
||||||
else if builtins.all builtins.isFunction values
|
if builtins.length values == 1 then
|
||||||
then mergedFunctions
|
builtins.elemAt values 0
|
||||||
else if builtins.all builtins.isList values
|
else if builtins.all builtins.isFunction values then
|
||||||
then mergedLists
|
mergedFunctions
|
||||||
else if builtins.all builtins.isAttrs values
|
else if builtins.all builtins.isList values then
|
||||||
then mergedAttrs
|
mergedLists
|
||||||
else if builtins.all builtins.isBool values
|
else if builtins.all builtins.isAttrs values then
|
||||||
then mergedBools
|
mergedAttrs
|
||||||
else if builtins.all lib.strings.isString values
|
else if builtins.all builtins.isBool values then
|
||||||
then mergedStrings
|
mergedBools
|
||||||
else if builtins.all builtins.isInt values && builtins.all (x: x == first) values
|
else if builtins.all lib.strings.isString values then
|
||||||
then first
|
mergedStrings
|
||||||
|
else if builtins.all builtins.isInt values && builtins.all (x: x == first) values then
|
||||||
|
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 =
|
||||||
identifier = lib.options.getIdentifier location;
|
location: type: definitions:
|
||||||
resolve = definition: let
|
let
|
||||||
properties = builtins.addErrorContext "while evaluating definitions from `${definition.__file__ or "<unknown>"}`:" (
|
identifier = lib.options.getIdentifier location;
|
||||||
lib.modules.apply.properties definition.value
|
resolve =
|
||||||
);
|
definition:
|
||||||
normalize = value: {
|
let
|
||||||
__file__ = definition.__file__;
|
properties = builtins.addErrorContext "while evaluating definitions from `${definition.__file__ or "<unknown>"}`:" (
|
||||||
inherit value;
|
lib.modules.apply.properties definition.value
|
||||||
};
|
);
|
||||||
|
normalize = value: {
|
||||||
|
__file__ = definition.__file__;
|
||||||
|
inherit value;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
builtins.map normalize properties;
|
||||||
|
|
||||||
|
resolved = builtins.concatMap resolve definitions;
|
||||||
|
overridden = lib.modules.apply.overrides resolved;
|
||||||
|
|
||||||
|
values =
|
||||||
|
if builtins.any (definition: lib.types.is "order" definition.value) overridden.values then
|
||||||
|
lib.modules.apply.order overridden.values
|
||||||
|
else
|
||||||
|
overridden.values;
|
||||||
|
|
||||||
|
isDefined = values != [ ];
|
||||||
|
|
||||||
|
invalid = builtins.filter (definition: !(type.check definition.value)) values;
|
||||||
|
|
||||||
|
merged =
|
||||||
|
if isDefined then
|
||||||
|
if builtins.all (definition: type.check definition.value) values then
|
||||||
|
type.merge location values
|
||||||
|
else
|
||||||
|
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.";
|
||||||
|
|
||||||
|
optional = if isDefined then { value = merged; } else { };
|
||||||
in
|
in
|
||||||
builtins.map normalize properties;
|
{
|
||||||
|
inherit
|
||||||
|
isDefined
|
||||||
|
values
|
||||||
|
merged
|
||||||
|
optional
|
||||||
|
;
|
||||||
|
|
||||||
resolved = builtins.concatMap resolve definitions;
|
raw = {
|
||||||
overridden = lib.modules.apply.overrides resolved;
|
inherit values;
|
||||||
|
inherit (overridden) highestPriority;
|
||||||
values =
|
};
|
||||||
if builtins.any (definition: lib.types.is "order" definition.value) overridden.values
|
|
||||||
then lib.modules.apply.order overridden.values
|
|
||||||
else overridden.values;
|
|
||||||
|
|
||||||
isDefined = values != [];
|
|
||||||
|
|
||||||
invalid = builtins.filter (definition: !(type.check definition.value)) values;
|
|
||||||
|
|
||||||
merged =
|
|
||||||
if isDefined
|
|
||||||
then
|
|
||||||
if builtins.all (definition: type.check definition.value) values
|
|
||||||
then type.merge location values
|
|
||||||
else 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.";
|
|
||||||
|
|
||||||
optional =
|
|
||||||
if isDefined
|
|
||||||
then {value = merged;}
|
|
||||||
else {};
|
|
||||||
in {
|
|
||||||
inherit
|
|
||||||
isDefined
|
|
||||||
values
|
|
||||||
merged
|
|
||||||
optional
|
|
||||||
;
|
|
||||||
|
|
||||||
raw = {
|
|
||||||
inherit values;
|
|
||||||
inherit (overridden) highestPriority;
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
## 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:
|
||||||
mergedType = result.type.mergeType option.options.type.functor;
|
let
|
||||||
isTypeMergeable = mergedType != null;
|
merge =
|
||||||
shared = name: option.options ? ${name} && result ? ${name};
|
result: option:
|
||||||
typeSet = lib.attrs.when ((shared "type") && isTypeMergeable) {type = mergedType;};
|
let
|
||||||
files = result.declarations;
|
mergedType = result.type.mergeType option.options.type.functor;
|
||||||
serializedFiles = builtins.concatStringsSep " and " files;
|
isTypeMergeable = mergedType != null;
|
||||||
getSubModules = option.options.type.getSubModules or null;
|
shared = name: option.options ? ${name} && result ? ${name};
|
||||||
submodules =
|
typeSet = lib.attrs.when ((shared "type") && isTypeMergeable) { type = mergedType; };
|
||||||
if getSubModules != null
|
files = result.declarations;
|
||||||
|
serializedFiles = builtins.concatStringsSep " and " files;
|
||||||
|
getSubModules = option.options.type.getSubModules or null;
|
||||||
|
submodules =
|
||||||
|
if getSubModules != null then
|
||||||
|
builtins.map (module: {
|
||||||
|
__file__ = option.__file__;
|
||||||
|
includes = [ module ];
|
||||||
|
}) getSubModules
|
||||||
|
++ result.options
|
||||||
|
else
|
||||||
|
result.options;
|
||||||
|
in
|
||||||
|
if
|
||||||
|
shared "default"
|
||||||
|
|| shared "example"
|
||||||
|
|| shared "description"
|
||||||
|
|| shared "apply"
|
||||||
|
|| (shared "type" && !isTypeMergeable)
|
||||||
then
|
then
|
||||||
builtins.map (module: {
|
builtins.throw "The option `${lib.options.getIdentifier location}` in `${option.__file__}` is already declared in ${serializedFiles}"
|
||||||
__file__ = option.__file__;
|
else
|
||||||
includes = [module];
|
option.options
|
||||||
})
|
// result
|
||||||
getSubModules
|
// {
|
||||||
++ result.options
|
declarations = result.declarations ++ [ option.__file__ ];
|
||||||
else result.options;
|
options = submodules;
|
||||||
|
}
|
||||||
|
// typeSet;
|
||||||
in
|
in
|
||||||
if
|
|
||||||
shared "default"
|
|
||||||
|| shared "example"
|
|
||||||
|| shared "description"
|
|
||||||
|| shared "apply"
|
|
||||||
|| (shared "type" && !isTypeMergeable)
|
|
||||||
then builtins.throw "The option `${lib.options.getIdentifier location}` in `${option.__file__}` is already declared in ${serializedFiles}"
|
|
||||||
else
|
|
||||||
option.options
|
|
||||||
// result
|
|
||||||
// {
|
|
||||||
declarations = result.declarations ++ [option.__file__];
|
|
||||||
options = submodules;
|
|
||||||
}
|
|
||||||
// typeSet;
|
|
||||||
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 =
|
||||||
identifier = lib.options.getIdentifier location;
|
message: location: definitions:
|
||||||
total = builtins.length definitions;
|
let
|
||||||
first = builtins.elemAt definitions 0;
|
identifier = lib.options.getIdentifier location;
|
||||||
in
|
total = builtins.length definitions;
|
||||||
if total == 1
|
first = builtins.elemAt definitions 0;
|
||||||
then first.value
|
in
|
||||||
else if total == 0
|
if total == 1 then
|
||||||
then builtins.throw "Cannot merge unused option `${identifier}`.\n${message}"
|
first.value
|
||||||
else builtins.throw "The option `${identifier}` is defined multiple times, but must be unique.\n${message}\nDefinitions:${lib.options.getDefinitions definitions}";
|
else if total == 0 then
|
||||||
|
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}";
|
||||||
|
|
||||||
## 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 =
|
||||||
identifier = lib.options.getIdentifier location;
|
location: definitions:
|
||||||
first = builtins.elemAt definitions 0;
|
let
|
||||||
rest = builtins.tail definitions;
|
identifier = lib.options.getIdentifier location;
|
||||||
merge = x: y:
|
first = builtins.elemAt definitions 0;
|
||||||
if x != y
|
rest = builtins.tail definitions;
|
||||||
then builtins.throw "The option `${identifier}` has conflicting definitions:${lib.options.getDefinitions definitions}"
|
merge =
|
||||||
else x;
|
x: y:
|
||||||
merged = builtins.foldl' merge first rest;
|
if x != y then
|
||||||
in
|
builtins.throw "The option `${identifier}` has conflicting definitions:${lib.options.getDefinitions definitions}"
|
||||||
if builtins.length definitions == 0
|
else
|
||||||
then builtins.throw "Cannot merge unused option `${identifier}`."
|
x;
|
||||||
else if builtins.length definitions == 1
|
merged = builtins.foldl' merge first rest;
|
||||||
then first.value
|
in
|
||||||
else merged.value;
|
if builtins.length definitions == 0 then
|
||||||
|
builtins.throw "Cannot merge unused option `${identifier}`."
|
||||||
|
else if builtins.length definitions == 1 then
|
||||||
|
first.value
|
||||||
|
else
|
||||||
|
merged.value;
|
||||||
};
|
};
|
||||||
|
|
||||||
## Check whether a value is an option.
|
## Check whether a value is an option.
|
||||||
|
@ -174,46 +192,50 @@ 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 =
|
||||||
type ? lib.types.unspecified,
|
settings@{
|
||||||
apply ? null,
|
type ? lib.types.unspecified,
|
||||||
default ? {},
|
apply ? null,
|
||||||
example ? null,
|
default ? { },
|
||||||
visible ? null,
|
example ? null,
|
||||||
internal ? null,
|
visible ? null,
|
||||||
writable ? null,
|
internal ? null,
|
||||||
description ? null,
|
writable ? null,
|
||||||
}: {
|
description ? null,
|
||||||
__type__ = "option";
|
}:
|
||||||
inherit
|
{
|
||||||
type
|
__type__ = "option";
|
||||||
apply
|
inherit
|
||||||
default
|
type
|
||||||
example
|
apply
|
||||||
visible
|
default
|
||||||
internal
|
example
|
||||||
writable
|
visible
|
||||||
description
|
internal
|
||||||
;
|
writable
|
||||||
};
|
description
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
## Create a sink option.
|
## Create a sink option.
|
||||||
##
|
##
|
||||||
## @type @alias lib.options.create
|
## @type @alias lib.options.create
|
||||||
sink = settings: let
|
sink =
|
||||||
defaults = {
|
settings:
|
||||||
internal = true;
|
let
|
||||||
visible = false;
|
defaults = {
|
||||||
default = false;
|
internal = true;
|
||||||
description = "A sink option for unused definitions";
|
visible = false;
|
||||||
type = lib.types.create {
|
default = false;
|
||||||
name = "sink";
|
description = "A sink option for unused definitions";
|
||||||
check = lib.fp.const true;
|
type = lib.types.create {
|
||||||
merge = lib.fp.const (lib.fp.const false);
|
name = "sink";
|
||||||
|
check = lib.fp.const true;
|
||||||
|
merge = lib.fp.const (lib.fp.const false);
|
||||||
|
};
|
||||||
|
apply = value: builtins.throw "Cannot read the value of a Sink option.";
|
||||||
};
|
};
|
||||||
apply = value: builtins.throw "Cannot read the value of a Sink option.";
|
in
|
||||||
};
|
|
||||||
in
|
|
||||||
lib.options.create (defaults // settings);
|
lib.options.create (defaults // settings);
|
||||||
|
|
||||||
## Get the definition values from a list of options definitions.
|
## Get the definition values from a list of options definitions.
|
||||||
|
@ -224,93 +246,94 @@ 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 =
|
||||||
special = [
|
location:
|
||||||
# lib.types.attrs.of (lib.types.submodule {})
|
let
|
||||||
"<name>"
|
special = [
|
||||||
# lib.types.list.of (submodule {})
|
# lib.types.attrs.of (lib.types.submodule {})
|
||||||
"*"
|
"<name>"
|
||||||
# lib.types.function
|
# lib.types.list.of (submodule {})
|
||||||
"<function body>"
|
"*"
|
||||||
];
|
# lib.types.function
|
||||||
escape = part:
|
"<function body>"
|
||||||
if builtins.elem part special
|
];
|
||||||
then part
|
escape = part: if builtins.elem part special then part else lib.strings.escape.nix.identifier 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 =
|
||||||
limit = 10;
|
definition:
|
||||||
throw = false;
|
let
|
||||||
}
|
valueWithRecursionLimit = lib.generators.withRecursion {
|
||||||
definition.value;
|
limit = 10;
|
||||||
|
throw = false;
|
||||||
|
} 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;
|
||||||
firstFiveLines = lib.lists.take 5 lines;
|
firstFiveLines = lib.lists.take 5 lines;
|
||||||
|
|
||||||
ellipsis = lib.lists.when (linesLength > 5) "...";
|
ellipsis = lib.lists.when (linesLength > 5) "...";
|
||||||
|
|
||||||
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
|
in
|
||||||
|
"\n- In `${definition.__file__}`${result}";
|
||||||
|
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 =
|
||||||
identifier = lib.options.getIdentifier location;
|
location: option: definitions:
|
||||||
|
let
|
||||||
|
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;
|
value = lib.modules.overrides.option option.default.value;
|
||||||
value = lib.modules.overrides.option option.default.value;
|
}
|
||||||
}
|
]
|
||||||
]
|
++ definitions
|
||||||
++ definitions
|
else
|
||||||
else definitions;
|
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
|
||||||
else lib.options.merge.definitions location option.type definitionsWithDefault;
|
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
|
in
|
||||||
then option.apply merged.merged
|
|
||||||
else merged.merged;
|
|
||||||
in
|
|
||||||
option
|
option
|
||||||
// {
|
// {
|
||||||
value = builtins.addErrorContext "while evaluating the option `${identifier}`:" value;
|
value = builtins.addErrorContext "while evaluating the option `${identifier}`:" value;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,88 +1,85 @@
|
||||||
{
|
{ 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 =
|
||||||
phases = lib.dag.apply.defaults package.phases {
|
package:
|
||||||
unpack = lib.dag.entry.before ["patch"] "";
|
let
|
||||||
|
phases = lib.dag.apply.defaults package.phases {
|
||||||
|
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;
|
||||||
|
|
||||||
built = builtins.derivation (
|
built = builtins.derivation (
|
||||||
package.env
|
package.env
|
||||||
// {
|
// {
|
||||||
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 =
|
||||||
bins = lib.paths.bin (
|
let
|
||||||
(lib'.packages.dependencies.getPackages package.deps.build.host)
|
bins = lib.paths.bin (
|
||||||
++ [
|
(lib'.packages.dependencies.getPackages package.deps.build.host)
|
||||||
foundation.stage2-bash
|
++ [
|
||||||
foundation.stage2-coreutils
|
foundation.stage2-bash
|
||||||
]
|
foundation.stage2-coreutils
|
||||||
);
|
]
|
||||||
in
|
);
|
||||||
builtins.concatStringsSep ":" (
|
in
|
||||||
[bins] ++ (lib.lists.when (package.env ? PATH) [package.env.PATH])
|
builtins.concatStringsSep ":" (
|
||||||
);
|
[ bins ] ++ (lib.lists.when (package.env ? PATH) [ package.env.PATH ])
|
||||||
|
);
|
||||||
|
|
||||||
builder = cfg.executable;
|
builder = cfg.executable;
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"-e"
|
"-e"
|
||||||
(builtins.toFile "bash-builder.sh" ''
|
(builtins.toFile "bash-builder.sh" ''
|
||||||
export CONFIG_SHELL=$SHELL
|
export CONFIG_SHELL=$SHELL
|
||||||
|
|
||||||
# Normalize the NIX_BUILD_CORES variable. The value might be 0, which
|
# Normalize the NIX_BUILD_CORES variable. The value might be 0, which
|
||||||
# means that we're supposed to try and auto-detect the number of
|
# means that we're supposed to try and auto-detect the number of
|
||||||
# available CPU cores at run-time.
|
# available CPU cores at run-time.
|
||||||
NIX_BUILD_CORES="''${NIX_BUILD_CORES:-1}"
|
NIX_BUILD_CORES="''${NIX_BUILD_CORES:-1}"
|
||||||
if ((NIX_BUILD_CORES <= 0)); then
|
if ((NIX_BUILD_CORES <= 0)); then
|
||||||
guess=$(nproc 2>/dev/null || true)
|
guess=$(nproc 2>/dev/null || true)
|
||||||
((NIX_BUILD_CORES = guess <= 0 ? 1 : guess))
|
((NIX_BUILD_CORES = guess <= 0 ? 1 : guess))
|
||||||
fi
|
fi
|
||||||
export NIX_BUILD_CORES
|
export NIX_BUILD_CORES
|
||||||
|
|
||||||
bash -eux $scriptPath
|
bash -eux $scriptPath
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
built
|
built
|
||||||
// {
|
// {
|
||||||
inherit (package) meta;
|
inherit (package) meta;
|
||||||
|
|
|
@ -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,56 +1,62 @@
|
||||||
{
|
{ 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 =
|
||||||
available = builtins.filter (dependency: !(builtins.isNull dependency)) (
|
dependencies:
|
||||||
builtins.attrValues dependencies
|
let
|
||||||
);
|
available = builtins.filter (dependency: !(builtins.isNull dependency)) (
|
||||||
in
|
builtins.attrValues dependencies
|
||||||
|
);
|
||||||
|
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 =
|
||||||
versions = builtins.attrNames alias.versions;
|
alias:
|
||||||
sorted = builtins.sort (lib.versions.gte) versions;
|
let
|
||||||
in
|
versions = builtins.attrNames alias.versions;
|
||||||
|
sorted = builtins.sort (lib.versions.gte) versions;
|
||||||
|
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 =
|
||||||
package = lib'.packages.resolve alias;
|
alias: build: host: target:
|
||||||
|
let
|
||||||
|
package = lib'.packages.resolve alias;
|
||||||
|
|
||||||
buildDependencies = build': host': target':
|
buildDependencies =
|
||||||
builtins.mapAttrs (name: dep: lib'.packages.build dep build' host' target');
|
build': host': target':
|
||||||
|
builtins.mapAttrs (name: dep: lib'.packages.build dep build' host' target');
|
||||||
|
|
||||||
platform = {
|
platform = {
|
||||||
build = lib.modules.overrides.force build;
|
build = lib.modules.overrides.force build;
|
||||||
host = lib.modules.overrides.force host;
|
host = lib.modules.overrides.force host;
|
||||||
target = lib.modules.overrides.force target;
|
target = lib.modules.overrides.force target;
|
||||||
};
|
};
|
||||||
|
|
||||||
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__;
|
||||||
|
|
||||||
|
@ -59,14 +65,12 @@ 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;
|
||||||
|
@ -86,13 +90,12 @@ 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__;
|
||||||
|
|
||||||
|
@ -105,8 +108,8 @@ in {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
withPackage.config;
|
withPackage.config;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,65 +1,64 @@
|
||||||
{
|
{ 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 =
|
||||||
type = lib.types.submodule (
|
let
|
||||||
{config}: {
|
type = lib.types.submodule (
|
||||||
options = {
|
{ config }:
|
||||||
name = {
|
{
|
||||||
full = lib.options.create {
|
options = {
|
||||||
description = "The full name of the license.";
|
name = {
|
||||||
type = lib.types.string;
|
full = lib.options.create {
|
||||||
|
description = "The full name of the license.";
|
||||||
|
type = lib.types.string;
|
||||||
|
};
|
||||||
|
|
||||||
|
short = lib.options.create {
|
||||||
|
description = "The short name of the license.";
|
||||||
|
type = lib.types.string;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
short = lib.options.create {
|
spdx = lib.options.create {
|
||||||
description = "The short name of the license.";
|
description = "The SPDX identifier for the license.";
|
||||||
type = lib.types.string;
|
type = lib.types.nullish lib.types.string;
|
||||||
|
default.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
url = lib.options.create {
|
||||||
|
description = "The URL for the license.";
|
||||||
|
type = lib.types.nullish lib.types.string;
|
||||||
|
};
|
||||||
|
|
||||||
|
free = lib.options.create {
|
||||||
|
description = "Whether the license is free.";
|
||||||
|
type = lib.types.bool;
|
||||||
|
default.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
redistributable = lib.options.create {
|
||||||
|
description = "Whether the license is allows redistribution.";
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = {
|
||||||
|
text = "config.free";
|
||||||
|
value = config.free;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
}
|
||||||
spdx = lib.options.create {
|
);
|
||||||
description = "The SPDX identifier for the license.";
|
in
|
||||||
type = lib.types.nullish lib.types.string;
|
|
||||||
default.value = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
url = lib.options.create {
|
|
||||||
description = "The URL for the license.";
|
|
||||||
type = lib.types.nullish lib.types.string;
|
|
||||||
};
|
|
||||||
|
|
||||||
free = lib.options.create {
|
|
||||||
description = "Whether the license is free.";
|
|
||||||
type = lib.types.bool;
|
|
||||||
default.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
redistributable = lib.options.create {
|
|
||||||
description = "Whether the license is allows redistribution.";
|
|
||||||
type = lib.types.bool;
|
|
||||||
default = {
|
|
||||||
text = "config.free";
|
|
||||||
value = config.free;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
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.types.platformWithBuildInfo;
|
||||||
lib'.systems.withBuildInfo
|
|
||||||
lib'.systems.types.platformWithBuildInfo;
|
|
||||||
|
|
||||||
builder = lib.types.submodule {
|
builder = lib.types.submodule {
|
||||||
freeform = lib.types.any;
|
freeform = lib.types.any;
|
||||||
|
@ -74,14 +73,18 @@ 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 =
|
||||||
initial = lib.types.raw;
|
build: host: target:
|
||||||
|
let
|
||||||
|
initial = lib.types.raw;
|
||||||
|
|
||||||
transform = value: let
|
transform =
|
||||||
package = lib'.packages.resolve value;
|
value:
|
||||||
|
let
|
||||||
|
package = lib'.packages.resolve value;
|
||||||
|
in
|
||||||
|
lib'.packages.build package build host target;
|
||||||
in
|
in
|
||||||
lib'.packages.build package build host target;
|
|
||||||
in
|
|
||||||
lib.types.attrs.of (lib.types.coerce initial transform lib'.types.package);
|
lib.types.attrs.of (lib.types.coerce initial transform lib'.types.package);
|
||||||
|
|
||||||
alias = lib.types.submodule {
|
alias = lib.types.submodule {
|
||||||
|
@ -99,288 +102,284 @@ 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 {
|
||||||
|
name = "PackageConfig";
|
||||||
|
description = "configuration for a package";
|
||||||
|
check = value: builtins.isFunction value || builtins.isAttrs value || builtins.isList value;
|
||||||
|
merge =
|
||||||
|
location: definitions:
|
||||||
|
let
|
||||||
|
normalized = builtins.map (definition: lib.lists.from.any (normalize definition.value)) definitions;
|
||||||
|
in
|
||||||
|
builtins.concatLists normalized;
|
||||||
};
|
};
|
||||||
|
|
||||||
initial = lib.types.create {
|
transform =
|
||||||
name = "PackageConfig";
|
location: value:
|
||||||
description = "configuration for a package";
|
let
|
||||||
check = value: builtins.isFunction value || builtins.isAttrs value || builtins.isList value;
|
modules = lib.lists.from.any (normalize value);
|
||||||
merge = location: definitions: let
|
|
||||||
normalized =
|
|
||||||
builtins.map
|
|
||||||
(definition: lib.lists.from.any (normalize definition.value))
|
|
||||||
definitions;
|
|
||||||
in
|
|
||||||
builtins.concatLists
|
|
||||||
normalized;
|
|
||||||
};
|
|
||||||
|
|
||||||
transform = location: value: let
|
result = lib.modules.run {
|
||||||
modules =
|
prefix = location;
|
||||||
lib.lists.from.any (normalize value);
|
modules = modules ++ [
|
||||||
|
submodule
|
||||||
result = lib.modules.run {
|
{ config.__modules__ = modules; }
|
||||||
prefix = location;
|
];
|
||||||
modules =
|
|
||||||
modules
|
|
||||||
++ [submodule {config.__modules__ = modules;}];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
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 {
|
|
||||||
description = "Dependencies which are created in the build environment and are executed in the build environment.";
|
|
||||||
type = lib'.types.dependencies build build target;
|
|
||||||
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 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 = {};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
in
|
||||||
|
result.config;
|
||||||
|
|
||||||
host = {
|
final = lib.types.raw;
|
||||||
only = lib.options.create {
|
|
||||||
description = "Dependencies which are only used in the host environment.";
|
|
||||||
type = lib'.types.dependencies host host host;
|
|
||||||
default.value = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
host = lib.options.create {
|
deps =
|
||||||
description = "Dependencies which are executed in the host environment.";
|
build: host: target:
|
||||||
type = lib'.types.dependencies host host target;
|
lib.types.submodule {
|
||||||
default.value = {};
|
options = {
|
||||||
};
|
|
||||||
|
|
||||||
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 = {
|
|
||||||
description = lib.options.create {
|
|
||||||
description = "The description for the package.";
|
|
||||||
type = lib.types.nullish lib.types.string;
|
|
||||||
default.value = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
homepage = lib.options.create {
|
|
||||||
description = "The homepage for the package.";
|
|
||||||
type = lib.types.nullish lib.types.string;
|
|
||||||
default.value = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
license = lib.options.create {
|
|
||||||
description = "The license for the package.";
|
|
||||||
type = lib.types.nullish lib'.types.license;
|
|
||||||
default.value = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
free = lib.options.create {
|
|
||||||
description = "Whether the package is free.";
|
|
||||||
type = lib.types.bool;
|
|
||||||
default.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
insecure = lib.options.create {
|
|
||||||
description = "Whether the package is insecure.";
|
|
||||||
type = lib.types.bool;
|
|
||||||
default.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
broken = lib.options.create {
|
|
||||||
description = "Whether the package is broken.";
|
|
||||||
type = lib.types.bool;
|
|
||||||
default.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
main = lib.options.create {
|
|
||||||
description = "The main entry point for the package.";
|
|
||||||
type = lib.types.nullish lib.types.string;
|
|
||||||
default.value = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
platforms = lib.options.create {
|
|
||||||
description = "The platforms the package supports.";
|
|
||||||
type = lib.types.list.of lib.types.string;
|
|
||||||
default.value = [];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
platform = {
|
|
||||||
build = lib.options.create {
|
|
||||||
description = "The build platform for the package.";
|
|
||||||
type = lib'.types.platform;
|
|
||||||
default.value = lib'.systems.withBuildInfo "x86_64-linux";
|
|
||||||
};
|
|
||||||
|
|
||||||
host = lib.options.create {
|
|
||||||
description = "The host platform for the package.";
|
|
||||||
type = lib'.types.platform;
|
|
||||||
default.value = lib'.systems.withBuildInfo "x86_64-linux";
|
|
||||||
};
|
|
||||||
|
|
||||||
target = lib.options.create {
|
|
||||||
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;
|
|
||||||
default = {
|
|
||||||
text = "\${config.pname}-\${config.version}";
|
|
||||||
value =
|
|
||||||
if config.pname != null && config.version != null
|
|
||||||
then "${config.pname}-${config.version}"
|
|
||||||
else "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
pname = lib.options.create {
|
|
||||||
description = "The program name for the package";
|
|
||||||
type = lib.types.nullish lib.types.string;
|
|
||||||
default.value = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
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 {
|
|
||||||
description = "The phases for the package.";
|
|
||||||
type = lib.types.dag.of lib.types.string;
|
|
||||||
default.value = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
env = lib.options.create {
|
|
||||||
description = "The environment for the package.";
|
|
||||||
type = lib.types.attrs.of lib.types.string;
|
|
||||||
default.value = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
package = lib.options.create {
|
|
||||||
description = "The built derivation.";
|
|
||||||
type = lib.types.derivation;
|
|
||||||
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 = {
|
build = {
|
||||||
only = lib'.packages.dependencies.build build build build value.build.only;
|
only = lib.options.create {
|
||||||
build = lib'.packages.dependencies.build build build target value.build.build;
|
description = "Dependencies which are only used in the build environment.";
|
||||||
host = lib'.packages.dependencies.build build host target value.build.host;
|
type = lib'.types.dependencies build build build;
|
||||||
target = lib'.packages.dependencies.build build target target value.build.target;
|
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 build build target;
|
||||||
|
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 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 = {
|
host = {
|
||||||
only = lib'.packages.dependencies.build host host host value.host.only;
|
only = lib.options.create {
|
||||||
host = lib'.packages.dependencies.build host host target value.host.host;
|
description = "Dependencies which are only used in the host environment.";
|
||||||
target = lib'.packages.dependencies.build host target target value.host.target;
|
type = lib'.types.dependencies host host host;
|
||||||
|
default.value = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
host = lib.options.create {
|
||||||
|
description = "Dependencies which are executed in the host environment.";
|
||||||
|
type = lib'.types.dependencies host host target;
|
||||||
|
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 host target target;
|
||||||
|
default.value = { };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
target = {
|
target = {
|
||||||
only = lib'.packages.dependencies.build target target target value.target.only;
|
only = lib.options.create {
|
||||||
target = lib'.packages.dependencies.build target target target value.target.target;
|
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 = { };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
type =
|
submodule =
|
||||||
(lib.types.coerceWithLocation initial transform final)
|
{ 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 = {
|
||||||
|
description = lib.options.create {
|
||||||
|
description = "The description for the package.";
|
||||||
|
type = lib.types.nullish lib.types.string;
|
||||||
|
default.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
homepage = lib.options.create {
|
||||||
|
description = "The homepage for the package.";
|
||||||
|
type = lib.types.nullish lib.types.string;
|
||||||
|
default.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
license = lib.options.create {
|
||||||
|
description = "The license for the package.";
|
||||||
|
type = lib.types.nullish lib'.types.license;
|
||||||
|
default.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
free = lib.options.create {
|
||||||
|
description = "Whether the package is free.";
|
||||||
|
type = lib.types.bool;
|
||||||
|
default.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
insecure = lib.options.create {
|
||||||
|
description = "Whether the package is insecure.";
|
||||||
|
type = lib.types.bool;
|
||||||
|
default.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
broken = lib.options.create {
|
||||||
|
description = "Whether the package is broken.";
|
||||||
|
type = lib.types.bool;
|
||||||
|
default.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
main = lib.options.create {
|
||||||
|
description = "The main entry point for the package.";
|
||||||
|
type = lib.types.nullish lib.types.string;
|
||||||
|
default.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
platforms = lib.options.create {
|
||||||
|
description = "The platforms the package supports.";
|
||||||
|
type = lib.types.list.of lib.types.string;
|
||||||
|
default.value = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
platform = {
|
||||||
|
build = lib.options.create {
|
||||||
|
description = "The build platform for the package.";
|
||||||
|
type = lib'.types.platform;
|
||||||
|
default.value = lib'.systems.withBuildInfo "x86_64-linux";
|
||||||
|
};
|
||||||
|
|
||||||
|
host = lib.options.create {
|
||||||
|
description = "The host platform for the package.";
|
||||||
|
type = lib'.types.platform;
|
||||||
|
default.value = lib'.systems.withBuildInfo "x86_64-linux";
|
||||||
|
};
|
||||||
|
|
||||||
|
target = lib.options.create {
|
||||||
|
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;
|
||||||
|
default = {
|
||||||
|
text = "\${config.pname}-\${config.version}";
|
||||||
|
value =
|
||||||
|
if config.pname != null && config.version != null then "${config.pname}-${config.version}" else "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
pname = lib.options.create {
|
||||||
|
description = "The program name for the package";
|
||||||
|
type = lib.types.nullish lib.types.string;
|
||||||
|
default.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
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 {
|
||||||
|
description = "The phases for the package.";
|
||||||
|
type = lib.types.dag.of lib.types.string;
|
||||||
|
default.value = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
env = lib.options.create {
|
||||||
|
description = "The environment for the package.";
|
||||||
|
type = lib.types.attrs.of lib.types.string;
|
||||||
|
default.value = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
package = lib.options.create {
|
||||||
|
description = "The built derivation.";
|
||||||
|
type = lib.types.derivation;
|
||||||
|
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";
|
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,35 +1,36 @@
|
||||||
{
|
{ 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 }:
|
||||||
meta = {
|
{
|
||||||
platforms = ["i686-linux"];
|
config = {
|
||||||
};
|
meta = {
|
||||||
|
platforms = [ "i686-linux" ];
|
||||||
|
};
|
||||||
|
|
||||||
name = "${config.pname}-${config.version}";
|
name = "${config.pname}-${config.version}";
|
||||||
|
|
||||||
pname = "a";
|
pname = "a";
|
||||||
version = "1.0.0";
|
version = "1.0.0";
|
||||||
|
|
||||||
builder = builders.basic;
|
builder = builders.basic;
|
||||||
|
|
||||||
deps.build.host = {
|
deps.build.host = {
|
||||||
inherit (packages.aux) b;
|
inherit (packages.aux) b;
|
||||||
};
|
};
|
||||||
|
|
||||||
phases = {
|
phases = {
|
||||||
install = ''
|
install = ''
|
||||||
echo "a with b: ${config.deps.build.host.b.package.system}" > $out
|
echo "a with b: ${config.deps.build.host.b.package.system}" > $out
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,38 @@
|
||||||
{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" =
|
||||||
options = {
|
{ config }:
|
||||||
custom = lib.options.create {
|
{
|
||||||
type = lib.types.bool;
|
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
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
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,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
|
||||||
|
@ -19,11 +21,11 @@ in {
|
||||||
|
|
||||||
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 = { };
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -42,63 +44,63 @@ in {
|
||||||
|
|
||||||
config.packages.cross = lib.attrs.generate doubles (
|
config.packages.cross = lib.attrs.generate doubles (
|
||||||
system:
|
system:
|
||||||
|
builtins.mapAttrs (
|
||||||
|
namespace:
|
||||||
builtins.mapAttrs (
|
builtins.mapAttrs (
|
||||||
namespace:
|
name: alias:
|
||||||
builtins.mapAttrs (
|
let
|
||||||
name: alias: let
|
setHost =
|
||||||
setHost = package:
|
package:
|
||||||
package // {
|
package
|
||||||
__modules__ = package.__modules__ ++ [
|
// {
|
||||||
{
|
__modules__ = package.__modules__ ++ [
|
||||||
config.platform = {
|
{
|
||||||
host = lib.modules.override 5 system;
|
config.platform = {
|
||||||
target = lib.modules.override 5 system;
|
host = lib.modules.override 5 system;
|
||||||
};
|
target = lib.modules.override 5 system;
|
||||||
}
|
};
|
||||||
];
|
}
|
||||||
};
|
];
|
||||||
# if package != {}
|
};
|
||||||
# then
|
# if package != {}
|
||||||
# (package.extend (
|
# then
|
||||||
# {config}: {
|
# (package.extend (
|
||||||
# config = {
|
# {config}: {
|
||||||
# platform = {
|
# config = {
|
||||||
# host = lib.modules.overrides.force system;
|
# platform = {
|
||||||
# target = lib.modules.overrides.default system;
|
# host = lib.modules.overrides.force system;
|
||||||
# };
|
# target = lib.modules.overrides.default system;
|
||||||
|
# };
|
||||||
|
|
||||||
# deps = {
|
# deps = {
|
||||||
# build = {
|
# build = {
|
||||||
# only = setHost package.deps.build.only;
|
# only = setHost package.deps.build.only;
|
||||||
# build = setHost package.deps.build.build;
|
# build = setHost package.deps.build.build;
|
||||||
# host = setHost package.deps.build.host;
|
# host = setHost package.deps.build.host;
|
||||||
# target = setHost package.deps.build.target;
|
# target = setHost package.deps.build.target;
|
||||||
# };
|
# };
|
||||||
# host = {
|
# host = {
|
||||||
# only = setHost package.deps.host.only;
|
# only = setHost package.deps.host.only;
|
||||||
# host = setHost package.deps.host.host;
|
# host = setHost package.deps.host.host;
|
||||||
# target = setHost package.deps.host.target;
|
# target = setHost package.deps.host.target;
|
||||||
# };
|
# };
|
||||||
# target = {
|
# target = {
|
||||||
# only = setHost package.deps.target.only;
|
# only = setHost package.deps.target.only;
|
||||||
# target = setHost package.deps.target.target;
|
# target = setHost package.deps.target.target;
|
||||||
# };
|
# };
|
||||||
# };
|
# };
|
||||||
# };
|
# };
|
||||||
# }
|
# }
|
||||||
# ))
|
# ))
|
||||||
# .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
|
||||||
};
|
updated
|
||||||
in
|
|
||||||
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,111 +13,116 @@
|
||||||
foundation
|
foundation
|
||||||
packages
|
packages
|
||||||
;
|
;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
config.packages.foundation.binutils = {
|
config.packages.foundation.binutils = {
|
||||||
versions = {
|
versions = {
|
||||||
"latest" = {config}: {
|
"latest" =
|
||||||
options = {
|
{ config }:
|
||||||
src = lib.options.create {
|
{
|
||||||
type = lib.types.derivation;
|
options = {
|
||||||
description = "Source for the package.";
|
src = lib.options.create {
|
||||||
};
|
type = lib.types.derivation;
|
||||||
};
|
description = "Source for the package.";
|
||||||
|
|
||||||
config = {
|
|
||||||
meta = {
|
|
||||||
platforms = ["i686-linux"];
|
|
||||||
};
|
|
||||||
|
|
||||||
pname = "binutils";
|
|
||||||
version = "2.41";
|
|
||||||
|
|
||||||
builder = builders.basic;
|
|
||||||
|
|
||||||
deps = {
|
|
||||||
build = {
|
|
||||||
host = {
|
|
||||||
inherit (packages.foundation) gcc;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
env = {
|
config = {
|
||||||
PATH = lib.paths.bin [
|
meta = {
|
||||||
# foundation.stage2-gcc
|
platforms = [ "i686-linux" ];
|
||||||
foundation.stage2-binutils
|
};
|
||||||
foundation.stage2-gnumake
|
|
||||||
foundation.stage2-gnupatch
|
|
||||||
foundation.stage2-gnused
|
|
||||||
foundation.stage2-gnugrep
|
|
||||||
foundation.stage2-gawk
|
|
||||||
foundation.stage2-diffutils
|
|
||||||
foundation.stage2-findutils
|
|
||||||
foundation.stage2-gnutar
|
|
||||||
foundation.stage1-xz
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
phases = let
|
pname = "binutils";
|
||||||
patches = [
|
version = "2.41";
|
||||||
# Make binutils output deterministic by default.
|
|
||||||
./patches/deterministic.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
configureFlags = [
|
builder = builders.basic;
|
||||||
# "CC=musl-gcc"
|
|
||||||
"LDFLAGS=--static"
|
|
||||||
"--prefix=${builtins.placeholder "out"}"
|
|
||||||
"--build=${config.platform.build.triple}"
|
|
||||||
"--host=${config.platform.host.triple}"
|
|
||||||
"--target=${config.platform.target.triple}"
|
|
||||||
|
|
||||||
"--with-sysroot=/"
|
deps = {
|
||||||
"--enable-deterministic-archives"
|
build = {
|
||||||
# depends on bison
|
host = {
|
||||||
"--disable-gprofng"
|
inherit (packages.foundation) gcc;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# Turn on --enable-new-dtags by default to make the linker set
|
env = {
|
||||||
# RUNPATH instead of RPATH on binaries. This is important because
|
PATH = lib.paths.bin [
|
||||||
# RUNPATH can be overridden using LD_LIBRARY_PATH at runtime.
|
# foundation.stage2-gcc
|
||||||
"--enable-new-dtags"
|
foundation.stage2-binutils
|
||||||
|
foundation.stage2-gnumake
|
||||||
|
foundation.stage2-gnupatch
|
||||||
|
foundation.stage2-gnused
|
||||||
|
foundation.stage2-gnugrep
|
||||||
|
foundation.stage2-gawk
|
||||||
|
foundation.stage2-diffutils
|
||||||
|
foundation.stage2-findutils
|
||||||
|
foundation.stage2-gnutar
|
||||||
|
foundation.stage1-xz
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# By default binutils searches $libdir for libraries. This brings in
|
phases =
|
||||||
# libbfd and libopcodes into a default visibility. Drop default lib
|
let
|
||||||
# path to force users to declare their use of these libraries.
|
patches = [
|
||||||
"--with-lib-path=:"
|
# Make binutils output deterministic by default.
|
||||||
|
./patches/deterministic.patch
|
||||||
|
];
|
||||||
|
|
||||||
"--disable-multilib"
|
configureFlags = [
|
||||||
];
|
# "CC=musl-gcc"
|
||||||
in {
|
"LDFLAGS=--static"
|
||||||
unpack = ''
|
"--prefix=${builtins.placeholder "out"}"
|
||||||
tar xf ${config.src}
|
"--build=${config.platform.build.triple}"
|
||||||
cd binutils-${config.version}
|
"--host=${config.platform.host.triple}"
|
||||||
'';
|
"--target=${config.platform.target.triple}"
|
||||||
|
|
||||||
patch = ''
|
"--with-sysroot=/"
|
||||||
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
|
"--enable-deterministic-archives"
|
||||||
'';
|
# depends on bison
|
||||||
|
"--disable-gprofng"
|
||||||
|
|
||||||
configure = ''
|
# Turn on --enable-new-dtags by default to make the linker set
|
||||||
bash ./configure ${builtins.concatStringsSep " " configureFlags}
|
# RUNPATH instead of RPATH on binaries. This is important because
|
||||||
'';
|
# RUNPATH can be overridden using LD_LIBRARY_PATH at runtime.
|
||||||
|
"--enable-new-dtags"
|
||||||
|
|
||||||
build = ''
|
# By default binutils searches $libdir for libraries. This brings in
|
||||||
make -j $NIX_BUILD_CORES
|
# libbfd and libopcodes into a default visibility. Drop default lib
|
||||||
'';
|
# path to force users to declare their use of these libraries.
|
||||||
|
"--with-lib-path=:"
|
||||||
|
|
||||||
install = ''
|
"--disable-multilib"
|
||||||
make -j $NIX_BUILD_CORES install-strip
|
];
|
||||||
'';
|
in
|
||||||
};
|
{
|
||||||
|
unpack = ''
|
||||||
|
tar xf ${config.src}
|
||||||
|
cd binutils-${config.version}
|
||||||
|
'';
|
||||||
|
|
||||||
src = builtins.fetchurl {
|
patch = ''
|
||||||
url = "${mirrors.gnu}/binutils/binutils-${config.version}.tar.xz";
|
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
|
||||||
sha256 = "rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA=";
|
'';
|
||||||
|
|
||||||
|
configure = ''
|
||||||
|
bash ./configure ${builtins.concatStringsSep " " configureFlags}
|
||||||
|
'';
|
||||||
|
|
||||||
|
build = ''
|
||||||
|
make -j $NIX_BUILD_CORES
|
||||||
|
'';
|
||||||
|
|
||||||
|
install = ''
|
||||||
|
make -j $NIX_BUILD_CORES install-strip
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
src = builtins.fetchurl {
|
||||||
|
url = "${mirrors.gnu}/binutils/binutils-${config.version}.tar.xz";
|
||||||
|
sha256 = "rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA=";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,206 +9,202 @@
|
||||||
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 {
|
|
||||||
type = lib.types.derivation;
|
|
||||||
description = "Source for the package.";
|
|
||||||
};
|
|
||||||
|
|
||||||
cc = {
|
|
||||||
src = lib.options.create {
|
src = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
description = "The cc source for the package.";
|
description = "Source for the package.";
|
||||||
|
};
|
||||||
|
|
||||||
|
cc = {
|
||||||
|
src = lib.options.create {
|
||||||
|
type = lib.types.derivation;
|
||||||
|
description = "The cc source for the package.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
gmp = {
|
||||||
|
src = lib.options.create {
|
||||||
|
type = lib.types.derivation;
|
||||||
|
description = "The gmp source for the package.";
|
||||||
|
};
|
||||||
|
|
||||||
|
version = lib.options.create {
|
||||||
|
type = lib.types.string;
|
||||||
|
description = "Version of gmp.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
mpfr = {
|
||||||
|
src = lib.options.create {
|
||||||
|
type = lib.types.derivation;
|
||||||
|
description = "The mpfr source for the package.";
|
||||||
|
};
|
||||||
|
|
||||||
|
version = lib.options.create {
|
||||||
|
type = lib.types.string;
|
||||||
|
description = "Version of mpfr.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
mpc = {
|
||||||
|
src = lib.options.create {
|
||||||
|
type = lib.types.derivation;
|
||||||
|
description = "The mpc source for the package.";
|
||||||
|
};
|
||||||
|
|
||||||
|
version = lib.options.create {
|
||||||
|
type = lib.types.string;
|
||||||
|
description = "Version of mpc.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
isl = {
|
||||||
|
src = lib.options.create {
|
||||||
|
type = lib.types.derivation;
|
||||||
|
description = "The isl source for the package.";
|
||||||
|
};
|
||||||
|
version = lib.options.create {
|
||||||
|
type = lib.types.string;
|
||||||
|
description = "Version of isl.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
gmp = {
|
config = {
|
||||||
src = lib.options.create {
|
meta = {
|
||||||
type = lib.types.derivation;
|
platforms = [ "i686-linux" ];
|
||||||
description = "The gmp source for the package.";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
version = lib.options.create {
|
pname = "gcc";
|
||||||
type = lib.types.string;
|
version = "13.2.0";
|
||||||
description = "Version of gmp.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mpfr = {
|
builder = builders.basic;
|
||||||
src = lib.options.create {
|
|
||||||
type = lib.types.derivation;
|
env = {
|
||||||
description = "The mpfr source for the package.";
|
PATH = lib.paths.bin [
|
||||||
|
foundation.stage2-gcc
|
||||||
|
foundation.stage2-binutils
|
||||||
|
foundation.stage2-gnumake
|
||||||
|
foundation.stage2-gnused
|
||||||
|
foundation.stage2-gnugrep
|
||||||
|
foundation.stage2-gawk
|
||||||
|
foundation.stage2-diffutils
|
||||||
|
foundation.stage2-findutils
|
||||||
|
foundation.stage2-gnutar
|
||||||
|
foundation.stage2-gzip
|
||||||
|
foundation.stage2-bzip2
|
||||||
|
foundation.stage1-xz
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
version = lib.options.create {
|
phases =
|
||||||
type = lib.types.string;
|
let
|
||||||
description = "Version of mpfr.";
|
host = lib.systems.withBuildInfo config.platform.host;
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mpc = {
|
mbits = if host.system.cpu.family == "x86" then if host.is64bit then "-m64" else "-m32" else "";
|
||||||
src = lib.options.create {
|
in
|
||||||
type = lib.types.derivation;
|
{
|
||||||
description = "The mpc source for the package.";
|
unpack = ''
|
||||||
|
# Unpack
|
||||||
|
tar xf ${config.src}
|
||||||
|
tar xf ${config.gmp.src}
|
||||||
|
tar xf ${config.mpfr.src}
|
||||||
|
tar xf ${config.mpc.src}
|
||||||
|
tar xf ${config.isl.src}
|
||||||
|
cd gcc-${config.version}
|
||||||
|
|
||||||
|
ln -s ../gmp-${config.gmp.version} gmp
|
||||||
|
ln -s ../mpfr-${config.mpfr.version} mpfr
|
||||||
|
ln -s ../mpc-${config.mpc.version} mpc
|
||||||
|
ln -s ../isl-${config.isl.version} isl
|
||||||
|
'';
|
||||||
|
|
||||||
|
patch = ''
|
||||||
|
# Patch
|
||||||
|
# force musl even if host triple is gnu
|
||||||
|
sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host
|
||||||
|
'';
|
||||||
|
|
||||||
|
configure = ''
|
||||||
|
# Configure
|
||||||
|
export CC="gcc -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 LIBRARY_PATH="${foundation.stage1-musl}/lib"
|
||||||
|
|
||||||
|
bash ./configure \
|
||||||
|
--prefix=$out \
|
||||||
|
--build=${config.platform.build.triple} \
|
||||||
|
--host=${config.platform.host.triple} \
|
||||||
|
--target=${config.platform.target.triple} \
|
||||||
|
--with-native-system-header-dir=/include \
|
||||||
|
--with-sysroot=${foundation.stage1-musl} \
|
||||||
|
--enable-languages=c,c++ \
|
||||||
|
--disable-bootstrap \
|
||||||
|
--disable-libsanitizer \
|
||||||
|
--disable-lto \
|
||||||
|
--disable-multilib \
|
||||||
|
--disable-plugin \
|
||||||
|
CFLAGS=-static \
|
||||||
|
CXXFLAGS=-static
|
||||||
|
'';
|
||||||
|
|
||||||
|
build = ''
|
||||||
|
# Build
|
||||||
|
make -j $NIX_BUILD_CORES
|
||||||
|
'';
|
||||||
|
|
||||||
|
install = ''
|
||||||
|
# Install
|
||||||
|
make -j $NIX_BUILD_CORES install-strip
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
src = builtins.fetchurl {
|
||||||
|
url = "${mirrors.gnu}/gcc/gcc-${config.version}/gcc-${config.version}.tar.xz";
|
||||||
|
sha256 = "4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o=";
|
||||||
};
|
};
|
||||||
|
|
||||||
version = lib.options.create {
|
gmp = {
|
||||||
type = lib.types.string;
|
version = "6.3.0";
|
||||||
description = "Version of mpc.";
|
src = builtins.fetchurl {
|
||||||
|
url = "${mirrors.gnu}/gmp/gmp-${config.gmp.version}.tar.xz";
|
||||||
|
sha256 = "o8K4AgG4nmhhb0rTC8Zq7kknw85Q4zkpyoGdXENTiJg=";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
isl = {
|
mpfr = {
|
||||||
src = lib.options.create {
|
version = "4.2.1";
|
||||||
type = lib.types.derivation;
|
src = builtins.fetchurl {
|
||||||
description = "The isl source for the package.";
|
url = "${mirrors.gnu}/mpfr/mpfr-${config.mpfr.version}.tar.xz";
|
||||||
|
sha256 = "J3gHNTpnJpeJlpRa8T5Sgp46vXqaW3+yeTiU4Y8fy7I=";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
version = lib.options.create {
|
|
||||||
type = lib.types.string;
|
mpc = {
|
||||||
description = "Version of isl.";
|
version = "1.3.1";
|
||||||
|
src = builtins.fetchurl {
|
||||||
|
url = "${mirrors.gnu}/mpc/mpc-${config.mpc.version}.tar.gz";
|
||||||
|
sha256 = "q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
isl = {
|
||||||
|
version = "0.24";
|
||||||
|
src = builtins.fetchurl {
|
||||||
|
url = "https://gcc.gnu.org/pub/gcc/infrastructure/isl-${config.isl.version}.tar.bz2";
|
||||||
|
sha256 = "/PeN2WVsEOuM+fvV9ZoLawE4YgX+GTSzsoegoYmBRcA=";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
|
||||||
meta = {
|
|
||||||
platforms = ["i686-linux"];
|
|
||||||
};
|
|
||||||
|
|
||||||
pname = "gcc";
|
|
||||||
version = "13.2.0";
|
|
||||||
|
|
||||||
builder = builders.basic;
|
|
||||||
|
|
||||||
env = {
|
|
||||||
PATH = lib.paths.bin [
|
|
||||||
foundation.stage2-gcc
|
|
||||||
foundation.stage2-binutils
|
|
||||||
foundation.stage2-gnumake
|
|
||||||
foundation.stage2-gnused
|
|
||||||
foundation.stage2-gnugrep
|
|
||||||
foundation.stage2-gawk
|
|
||||||
foundation.stage2-diffutils
|
|
||||||
foundation.stage2-findutils
|
|
||||||
foundation.stage2-gnutar
|
|
||||||
foundation.stage2-gzip
|
|
||||||
foundation.stage2-bzip2
|
|
||||||
foundation.stage1-xz
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
phases = let
|
|
||||||
host = lib.systems.withBuildInfo config.platform.host;
|
|
||||||
|
|
||||||
mbits =
|
|
||||||
if host.system.cpu.family == "x86"
|
|
||||||
then
|
|
||||||
if host.is64bit
|
|
||||||
then "-m64"
|
|
||||||
else "-m32"
|
|
||||||
else "";
|
|
||||||
in {
|
|
||||||
unpack = ''
|
|
||||||
# Unpack
|
|
||||||
tar xf ${config.src}
|
|
||||||
tar xf ${config.gmp.src}
|
|
||||||
tar xf ${config.mpfr.src}
|
|
||||||
tar xf ${config.mpc.src}
|
|
||||||
tar xf ${config.isl.src}
|
|
||||||
cd gcc-${config.version}
|
|
||||||
|
|
||||||
ln -s ../gmp-${config.gmp.version} gmp
|
|
||||||
ln -s ../mpfr-${config.mpfr.version} mpfr
|
|
||||||
ln -s ../mpc-${config.mpc.version} mpc
|
|
||||||
ln -s ../isl-${config.isl.version} isl
|
|
||||||
'';
|
|
||||||
|
|
||||||
patch = ''
|
|
||||||
# Patch
|
|
||||||
# force musl even if host triple is gnu
|
|
||||||
sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host
|
|
||||||
'';
|
|
||||||
|
|
||||||
configure = ''
|
|
||||||
# Configure
|
|
||||||
export CC="gcc -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 LIBRARY_PATH="${foundation.stage1-musl}/lib"
|
|
||||||
|
|
||||||
bash ./configure \
|
|
||||||
--prefix=$out \
|
|
||||||
--build=${config.platform.build.triple} \
|
|
||||||
--host=${config.platform.host.triple} \
|
|
||||||
--target=${config.platform.target.triple} \
|
|
||||||
--with-native-system-header-dir=/include \
|
|
||||||
--with-sysroot=${foundation.stage1-musl} \
|
|
||||||
--enable-languages=c,c++ \
|
|
||||||
--disable-bootstrap \
|
|
||||||
--disable-libsanitizer \
|
|
||||||
--disable-lto \
|
|
||||||
--disable-multilib \
|
|
||||||
--disable-plugin \
|
|
||||||
CFLAGS=-static \
|
|
||||||
CXXFLAGS=-static
|
|
||||||
'';
|
|
||||||
|
|
||||||
build = ''
|
|
||||||
# Build
|
|
||||||
make -j $NIX_BUILD_CORES
|
|
||||||
'';
|
|
||||||
|
|
||||||
install = ''
|
|
||||||
# Install
|
|
||||||
make -j $NIX_BUILD_CORES install-strip
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
src = builtins.fetchurl {
|
|
||||||
url = "${mirrors.gnu}/gcc/gcc-${config.version}/gcc-${config.version}.tar.xz";
|
|
||||||
sha256 = "4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o=";
|
|
||||||
};
|
|
||||||
|
|
||||||
gmp = {
|
|
||||||
version = "6.3.0";
|
|
||||||
src = builtins.fetchurl {
|
|
||||||
url = "${mirrors.gnu}/gmp/gmp-${config.gmp.version}.tar.xz";
|
|
||||||
sha256 = "o8K4AgG4nmhhb0rTC8Zq7kknw85Q4zkpyoGdXENTiJg=";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mpfr = {
|
|
||||||
version = "4.2.1";
|
|
||||||
src = builtins.fetchurl {
|
|
||||||
url = "${mirrors.gnu}/mpfr/mpfr-${config.mpfr.version}.tar.xz";
|
|
||||||
sha256 = "J3gHNTpnJpeJlpRa8T5Sgp46vXqaW3+yeTiU4Y8fy7I=";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mpc = {
|
|
||||||
version = "1.3.1";
|
|
||||||
src = builtins.fetchurl {
|
|
||||||
url = "${mirrors.gnu}/mpc/mpc-${config.mpc.version}.tar.gz";
|
|
||||||
sha256 = "q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg=";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
isl = {
|
|
||||||
version = "0.24";
|
|
||||||
src = builtins.fetchurl {
|
|
||||||
url = "https://gcc.gnu.org/pub/gcc/infrastructure/isl-${config.isl.version}.tar.bz2";
|
|
||||||
sha256 = "/PeN2WVsEOuM+fvV9ZoLawE4YgX+GTSzsoegoYmBRcA=";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,79 +3,79 @@
|
||||||
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;
|
description = "Source for the package.";
|
||||||
description = "Source for the package.";
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
meta = {
|
||||||
|
platforms = [ "i686-linux" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
pname = "linux-headers";
|
||||||
|
version = "6.5.6";
|
||||||
|
|
||||||
|
builder = builders.basic;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
PATH = lib.paths.bin [
|
||||||
|
foundation.stage2-gcc
|
||||||
|
foundation.stage1-musl
|
||||||
|
foundation.stage2-binutils
|
||||||
|
foundation.stage2-gnumake
|
||||||
|
foundation.stage2-gnupatch
|
||||||
|
foundation.stage2-gnused
|
||||||
|
foundation.stage2-gnugrep
|
||||||
|
foundation.stage2-gawk
|
||||||
|
foundation.stage2-diffutils
|
||||||
|
foundation.stage2-findutils
|
||||||
|
foundation.stage2-gnutar
|
||||||
|
foundation.stage1-xz
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
phases = {
|
||||||
|
unpack = ''
|
||||||
|
tar xf ${config.src}
|
||||||
|
cd linux-${config.version}
|
||||||
|
'';
|
||||||
|
|
||||||
|
build = ''
|
||||||
|
make -j $NIX_BUILD_CORES CC=musl-gcc HOSTCC=musl-gcc ARCH=${config.platform.host.linux.arch} headers
|
||||||
|
'';
|
||||||
|
|
||||||
|
install = ''
|
||||||
|
find usr/include -name '.*' -exec rm {} +
|
||||||
|
mkdir -p $out
|
||||||
|
cp -rv usr/include $out/
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
src = builtins.fetchurl {
|
||||||
|
url = "https://cdn.kernel.org/pub/linux/kernel/v${lib.versions.major config.version}.x/linux-${config.version}.tar.xz";
|
||||||
|
sha256 = "eONtQhRUcFHCTfIUD0zglCjWxRWtmnGziyjoCUqV0vY=";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
|
||||||
meta = {
|
|
||||||
platforms = ["i686-linux"];
|
|
||||||
};
|
|
||||||
|
|
||||||
pname = "linux-headers";
|
|
||||||
version = "6.5.6";
|
|
||||||
|
|
||||||
builder = builders.basic;
|
|
||||||
|
|
||||||
env = {
|
|
||||||
PATH = lib.paths.bin [
|
|
||||||
foundation.stage2-gcc
|
|
||||||
foundation.stage1-musl
|
|
||||||
foundation.stage2-binutils
|
|
||||||
foundation.stage2-gnumake
|
|
||||||
foundation.stage2-gnupatch
|
|
||||||
foundation.stage2-gnused
|
|
||||||
foundation.stage2-gnugrep
|
|
||||||
foundation.stage2-gawk
|
|
||||||
foundation.stage2-diffutils
|
|
||||||
foundation.stage2-findutils
|
|
||||||
foundation.stage2-gnutar
|
|
||||||
foundation.stage1-xz
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
phases = {
|
|
||||||
unpack = ''
|
|
||||||
tar xf ${config.src}
|
|
||||||
cd linux-${config.version}
|
|
||||||
'';
|
|
||||||
|
|
||||||
build = ''
|
|
||||||
make -j $NIX_BUILD_CORES CC=musl-gcc HOSTCC=musl-gcc ARCH=${config.platform.host.linux.arch} headers
|
|
||||||
'';
|
|
||||||
|
|
||||||
install = ''
|
|
||||||
find usr/include -name '.*' -exec rm {} +
|
|
||||||
mkdir -p $out
|
|
||||||
cp -rv usr/include $out/
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
src = builtins.fetchurl {
|
|
||||||
url = "https://cdn.kernel.org/pub/linux/kernel/v${lib.versions.major config.version}.x/linux-${config.version}.tar.xz";
|
|
||||||
sha256 = "eONtQhRUcFHCTfIUD0zglCjWxRWtmnGziyjoCUqV0vY=";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue