Compare commits
1 commit
c2143518d7
...
e068db6843
Author | SHA1 | Date | |
---|---|---|---|
isabel roses | e068db6843 |
|
@ -3,10 +3,10 @@
|
||||||
"lib": {
|
"lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"dirtyRev": "856b88321e5f19019332f8b60b729095c2260340-dirty",
|
"dirtyRev": "9c29945531c58ad81f05cd1f4958c8894a733216-dirty",
|
||||||
"dirtyShortRev": "856b883-dirty",
|
"dirtyShortRev": "9c29945-dirty",
|
||||||
"lastModified": 1718299377,
|
"lastModified": 1718255029,
|
||||||
"narHash": "sha256-qsSV+ty3XdEOlxJr5/1ZGheyjDAIu3xWtFxVs1+rDKA=",
|
"narHash": "sha256-cyVYhw84W1s8u305BJR0YoNtdvCuRCd5DT+G3v3Lo4E=",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../?dir=lib"
|
"url": "file:../?dir=lib"
|
||||||
},
|
},
|
||||||
|
|
|
@ -187,7 +187,7 @@ lib: {
|
||||||
in
|
in
|
||||||
withFreeform (withMeta base);
|
withFreeform (withMeta base);
|
||||||
}
|
}
|
||||||
else builtins.throw "Module `${key}` (${file}) has unsupported attribute(s): ${invalidKeys}";
|
else builtins.throw "Module `${key}` has unsupported attribute(s): ${invalidKeys}";
|
||||||
|
|
||||||
## Convert a module that is either a function or an attribute set into
|
## Convert a module that is either a function or an attribute set into
|
||||||
## a resolved attribute set. If the module was a function then it will
|
## a resolved attribute set. If the module was a function then it will
|
||||||
|
@ -428,7 +428,7 @@ lib: {
|
||||||
matched = lib.options.run location option definitions';
|
matched = lib.options.run location option definitions';
|
||||||
unmatched = [];
|
unmatched = [];
|
||||||
}
|
}
|
||||||
else builtins.throw "The option `${lib.options.getIdentifier location}` in module `${(builtins.head optionDeclarations).__file__}` would be a parent of the following options, but its type `${(builtins.head optionDeclarations).options.type.description or "<no description>"}` does not support nested options."
|
else builtins.throw "The option `${lib.options.getIdentifier location}` in module `${(builtins.head optionDeclarations).__file__}` does not support nested options."
|
||||||
else process location declarations definitions
|
else process location declarations definitions
|
||||||
)
|
)
|
||||||
declarationsByName;
|
declarationsByName;
|
||||||
|
@ -611,7 +611,7 @@ lib: {
|
||||||
collected =
|
collected =
|
||||||
collect
|
collect
|
||||||
(args.path or "")
|
(args.path or "")
|
||||||
([internal] ++ modules)
|
(modules ++ [internal])
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
inherit options config;
|
inherit options config;
|
||||||
|
@ -625,8 +625,7 @@ lib: {
|
||||||
// args
|
// args
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
lib.modules.combine
|
lib.modules.combine prefix (lib.lists.reverse collected);
|
||||||
prefix (lib.lists.reverse collected);
|
|
||||||
|
|
||||||
options = merged.matched;
|
options = merged.matched;
|
||||||
|
|
||||||
|
|
|
@ -423,36 +423,5 @@ in {
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
evaluated.config.aux.message == expected;
|
evaluated.config.aux.message == expected;
|
||||||
|
|
||||||
"submodules" = let
|
|
||||||
expected = "Hello, World!";
|
|
||||||
evaluated = lib.modules.run {
|
|
||||||
modules = [
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
aux = lib.options.create {
|
|
||||||
default.value = {
|
|
||||||
message = "hi";
|
|
||||||
};
|
|
||||||
type = lib.types.attrs.of (lib.types.submodule ({name}: {
|
|
||||||
# freeform = lib.types.any;
|
|
||||||
options.message = lib.options.create {
|
|
||||||
type = lib.types.string;
|
|
||||||
};
|
|
||||||
}));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = {
|
|
||||||
aux = {
|
|
||||||
x = {
|
|
||||||
message = "Hello, World!";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
evaluated.config.aux.x.message == expected;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -750,13 +750,7 @@ lib: {
|
||||||
description ? null,
|
description ? null,
|
||||||
}: let
|
}: let
|
||||||
getModules = builtins.map (
|
getModules = builtins.map (
|
||||||
definition:
|
definition: {
|
||||||
if builtins.isAttrs definition
|
|
||||||
then {
|
|
||||||
__file__ = definition.__file__;
|
|
||||||
config = definition.value;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
__file__ = definition.__file__;
|
__file__ = definition.__file__;
|
||||||
includes = [definition.value];
|
includes = [definition.value];
|
||||||
}
|
}
|
||||||
|
@ -768,6 +762,9 @@ lib: {
|
||||||
modules =
|
modules =
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
options.__module__.args.dynamic.name = lib.options.create {
|
||||||
|
type = lib.types.string;
|
||||||
|
};
|
||||||
config.__module__.args.dynamic.name = lib.modules.overrides.default "<name>";
|
config.__module__.args.dynamic.name = lib.modules.overrides.default "<name>";
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -992,7 +989,7 @@ lib: {
|
||||||
## @type List Attrs -> Attrs
|
## @type List Attrs -> Attrs
|
||||||
one = types: let
|
one = types: let
|
||||||
first = builtins.elemAt types 0;
|
first = builtins.elemAt types 0;
|
||||||
rest = builtins.tail types;
|
rest = lib.lists.tail types;
|
||||||
in
|
in
|
||||||
if types == []
|
if types == []
|
||||||
then builtins.throw "lib.types.one must be given at least one type"
|
then builtins.throw "lib.types.one must be given at least one type"
|
||||||
|
|
|
@ -10,24 +10,21 @@
|
||||||
++ [
|
++ [
|
||||||
./src/export.nix
|
./src/export.nix
|
||||||
{
|
{
|
||||||
__file__ = "broken";
|
__file__ = ./default.nix;
|
||||||
|
|
||||||
# options.foundation = lib.options.create {
|
options.packages.aux = {
|
||||||
# type = lib.types.attrs.of lib.types.derivation;
|
foundation = lib.options.create {
|
||||||
# };
|
type = lib.types.attrs.of lib.types.package;
|
||||||
|
internal = true;
|
||||||
|
description = "The foundational packages used to construct the larger package set.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# config.foundation = foundation;
|
config.packages.aux = {
|
||||||
config.packages.foundation =
|
foundation = foundation;
|
||||||
builtins.mapAttrs (name: package: {
|
};
|
||||||
name = package.name;
|
|
||||||
|
|
||||||
inherit package;
|
|
||||||
|
|
||||||
meta = package.meta;
|
|
||||||
})
|
|
||||||
foundation;
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
result.config
|
result.config.exported
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "foundation",
|
"dir": "foundation",
|
||||||
"dirtyRev": "9c29945531c58ad81f05cd1f4958c8894a733216-dirty",
|
"dirtyRev": "cd12786be17a611976b44fbba3e245eca512535f-dirty",
|
||||||
"dirtyShortRev": "9c29945-dirty",
|
"dirtyShortRev": "cd12786-dirty",
|
||||||
"lastModified": 1718255029,
|
"lastModified": 1718199069,
|
||||||
"narHash": "sha256-fmrDe4GfvVfXZ9lzaOt+tgBUMFCsyKr0Dlnm8aQwAXs=",
|
"narHash": "sha256-H2Mkyp9BPDPte+E++uIG2N/vGtcS3H9Q7tM3fOOEXT0=",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../?dir=foundation"
|
"url": "file:../?dir=foundation"
|
||||||
},
|
},
|
||||||
|
@ -24,10 +24,10 @@
|
||||||
"lib": {
|
"lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"dirtyRev": "9c29945531c58ad81f05cd1f4958c8894a733216-dirty",
|
"dirtyRev": "cd12786be17a611976b44fbba3e245eca512535f-dirty",
|
||||||
"dirtyShortRev": "9c29945-dirty",
|
"dirtyShortRev": "cd12786-dirty",
|
||||||
"lastModified": 1718255029,
|
"lastModified": 1718199069,
|
||||||
"narHash": "sha256-fmrDe4GfvVfXZ9lzaOt+tgBUMFCsyKr0Dlnm8aQwAXs=",
|
"narHash": "sha256-H2Mkyp9BPDPte+E++uIG2N/vGtcS3H9Q7tM3fOOEXT0=",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../?dir=lib"
|
"url": "file:../?dir=lib"
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
lib,
|
lib,
|
||||||
config,
|
config,
|
||||||
}: let
|
}: let
|
||||||
cfg = config.exports;
|
cfg = config.exports.modules;
|
||||||
|
|
||||||
type = lib.types.one [
|
type = lib.types.one [
|
||||||
lib.types.path
|
lib.types.path
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
}: let
|
}: let
|
||||||
lib' = config.lib;
|
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
exports.packages = lib.options.create {
|
exports.packages = lib.options.create {
|
||||||
|
@ -15,8 +14,6 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
exported.packages = {
|
exported.packages = {};
|
||||||
# i686-linux = config.packages.foundation;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -107,164 +107,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
package = {
|
package = lib.types.submodule ({config}: {
|
||||||
base = lib.types.submodule ({config}: {
|
|
||||||
freeform = lib.types.any;
|
|
||||||
|
|
||||||
options = {
|
|
||||||
name = lib.options.create {
|
|
||||||
type = lib.types.string;
|
|
||||||
default = {
|
|
||||||
value = "${config.pname}-${config.version or "unknown"}";
|
|
||||||
text = "\${config.pname}-\${config.version}";
|
|
||||||
};
|
|
||||||
description = "The name of the package.";
|
|
||||||
};
|
|
||||||
|
|
||||||
pname = lib.options.create {
|
|
||||||
type = lib.types.nullish lib.types.string;
|
|
||||||
default.value = null;
|
|
||||||
description = "The name of the package.";
|
|
||||||
};
|
|
||||||
|
|
||||||
version = lib.options.create {
|
|
||||||
type = lib.types.nullish lib.types.string;
|
|
||||||
default.value = null;
|
|
||||||
description = "The version of the package.";
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = lib.options.create {
|
|
||||||
type = lib'.types.meta;
|
|
||||||
default = {
|
|
||||||
text = "{ name = <package>.pname; }";
|
|
||||||
value = {
|
|
||||||
name = config.pname;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
description = "The metadata for the package.";
|
|
||||||
};
|
|
||||||
|
|
||||||
env = lib.options.create {
|
|
||||||
type = lib.types.attrs.of lib.types.string;
|
|
||||||
default.value = {};
|
|
||||||
description = "Environment variables for the package's builder to use.";
|
|
||||||
};
|
|
||||||
|
|
||||||
phases = lib.options.create {
|
|
||||||
type = lib.types.dag.of (
|
|
||||||
lib.types.either
|
|
||||||
lib.types.string
|
|
||||||
(lib.types.function lib.types.string)
|
|
||||||
);
|
|
||||||
default.value = {};
|
|
||||||
description = "Phases for the package's builder to use.";
|
|
||||||
};
|
|
||||||
|
|
||||||
platform = {
|
|
||||||
build = lib.options.create {
|
|
||||||
type = lib.types.nullish lib.types.string;
|
|
||||||
default.value = null;
|
|
||||||
description = "The platform the package is built on.";
|
|
||||||
};
|
|
||||||
|
|
||||||
host = lib.options.create {
|
|
||||||
type = lib.types.nullish lib.types.string;
|
|
||||||
default.value = null;
|
|
||||||
description = "The platform the package is run on.";
|
|
||||||
};
|
|
||||||
|
|
||||||
target = lib.options.create {
|
|
||||||
type = lib.types.nullish lib.types.string;
|
|
||||||
default.value = null;
|
|
||||||
description = "The platform the package generates code for.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
builder = lib.options.create {
|
|
||||||
type = lib'.types.builder;
|
|
||||||
description = "The builder for the package.";
|
|
||||||
};
|
|
||||||
|
|
||||||
package = lib.options.create {
|
|
||||||
type = lib.types.derivation;
|
|
||||||
default = {
|
|
||||||
value = config.builder.build config.builder config;
|
|
||||||
text = "<derivation>";
|
|
||||||
};
|
|
||||||
description = "The package derivation.";
|
|
||||||
};
|
|
||||||
|
|
||||||
deps = {
|
|
||||||
build = {
|
|
||||||
only = lib.options.create {
|
|
||||||
type = lib'.types.dependencies;
|
|
||||||
default.value = {};
|
|
||||||
description = "Dependencies which are only used in the build environment.";
|
|
||||||
};
|
|
||||||
|
|
||||||
build = lib.options.create {
|
|
||||||
type = lib'.types.dependencies;
|
|
||||||
default.value = {};
|
|
||||||
description = "Dependencies which are created in the build environment and are run in the build environment.";
|
|
||||||
};
|
|
||||||
|
|
||||||
host = lib.options.create {
|
|
||||||
type = lib'.types.dependencies;
|
|
||||||
default.value = {};
|
|
||||||
description = "Dependencies which are created in the build environment and are run in the host environment.";
|
|
||||||
};
|
|
||||||
|
|
||||||
target = lib.options.create {
|
|
||||||
type = lib'.types.dependencies;
|
|
||||||
default.value = {};
|
|
||||||
description = "Dependencies which are created in the build environment and are run in the target environment.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
host = {
|
|
||||||
only = lib.options.create {
|
|
||||||
type = lib'.types.dependencies;
|
|
||||||
default.value = {};
|
|
||||||
description = "Dependencies which are only used in the host environment.";
|
|
||||||
};
|
|
||||||
|
|
||||||
host = lib.options.create {
|
|
||||||
type = lib'.types.dependencies;
|
|
||||||
default.value = {};
|
|
||||||
description = "Dependencies which are run in the host environment.";
|
|
||||||
};
|
|
||||||
|
|
||||||
target = lib.options.create {
|
|
||||||
type = lib'.types.dependencies;
|
|
||||||
default.value = {};
|
|
||||||
description = "Dependencies which are run in the host environment which produces code for the target environment.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
target = {
|
|
||||||
only = lib.options.create {
|
|
||||||
type = lib'.types.dependencies;
|
|
||||||
default.value = {};
|
|
||||||
description = "Dependencies which are only used in the target environment.";
|
|
||||||
};
|
|
||||||
|
|
||||||
target = lib.options.create {
|
|
||||||
type = lib'.types.dependencies;
|
|
||||||
default.value = {};
|
|
||||||
description = "Dependencies which are run in the target environment.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
versions = lib.options.create {
|
|
||||||
type = lib.types.attrs.of lib'.types.package;
|
|
||||||
default.value = {};
|
|
||||||
description = "Available versions of the package.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
targeted = lib.types.submodule ({config}: {
|
|
||||||
freeform = lib.types.any;
|
freeform = lib.types.any;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
@ -416,46 +259,13 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
dependencies = lib.types.attrs.of (lib.types.nullish lib'.types.package);
|
dependencies = lib.types.attrs.of (lib.types.nullish lib'.types.package);
|
||||||
|
|
||||||
packages = {
|
packages = lib.types.attrs.of (lib.types.submodule {
|
||||||
base = lib.types.attrs.of (lib.types.submodule {
|
freeform = lib.types.nullish lib'.types.package;
|
||||||
freeform = lib'.types.package.base;
|
|
||||||
|
|
||||||
# options =
|
|
||||||
# builtins.foldl' (result: system: {
|
|
||||||
# "${system}" = lib.options.create {
|
|
||||||
# type = lib'.types.packages.targeted;
|
|
||||||
# default.value = {};
|
|
||||||
# description = "Packages for the architecture `${system}`";
|
|
||||||
# };
|
|
||||||
# }) {}
|
|
||||||
# lib'.systems.doubles.all;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
targeted = lib.types.attrs.of (lib.types.submodule {
|
|
||||||
freeform = lib.types.nullish lib'.types.package.targeted;
|
|
||||||
|
|
||||||
options = {
|
|
||||||
cross = lib.options.create {
|
|
||||||
type = lib'.types.packages.cross;
|
|
||||||
default.value = {};
|
|
||||||
description = "Cross-compiled packages targeting another architecture.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
# Cross-compiled packages are accessed via
|
|
||||||
# packages.cross.<platform>.<namespace>.<name>
|
|
||||||
cross = lib.types.attrs.of (lib.types.submodule {
|
|
||||||
freeform = lib.types.attrs.of (lib.types.submodule {
|
|
||||||
freeform = lib.types.nullish lib'.types.package.targeted;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
builder = lib.types.submodule {
|
builder = lib.types.submodule {
|
||||||
freeform = lib.types.any;
|
freeform = lib.types.any;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{
|
{
|
||||||
exports = ./exports;
|
exports = ./exports;
|
||||||
lib = ./lib;
|
lib = ./lib;
|
||||||
packages = ./packages;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,19 @@
|
||||||
config,
|
config,
|
||||||
}: let
|
}: let
|
||||||
lib' = config.lib;
|
lib' = config.lib;
|
||||||
|
# configure = namespace: packages:
|
||||||
doubles = lib'.systems.doubles.all;
|
# builtins.mapAttrs
|
||||||
|
# (key: package: let
|
||||||
generic = builtins.removeAttrs config.packages ["targeted"];
|
# name =
|
||||||
|
# if package.pname != null && package.version != null
|
||||||
|
# then "${package.pname}-${package.version}"
|
||||||
|
# else key;
|
||||||
|
# in {
|
||||||
|
# name = lib.modules.overrides.default name;
|
||||||
|
# package = lib.modules.overrides.default (package.builder package);
|
||||||
|
# })
|
||||||
|
# packages;
|
||||||
|
# configs = builtins.mapAttrs configure config.packages;
|
||||||
in {
|
in {
|
||||||
includes = [
|
includes = [
|
||||||
# ./aux/foundation.nix
|
# ./aux/foundation.nix
|
||||||
|
@ -14,14 +23,9 @@ in {
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
packages = lib.options.create {
|
packages = lib.options.create {
|
||||||
default.value = {};
|
type = lib'.types.packages;
|
||||||
type = lib.types.attrs.of (lib.types.submodule {
|
|
||||||
freeform = lib.types.any;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
# config = lib.modules.merge configs;
|
||||||
packages.targeted.i686-linux = generic;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue