feat: working transient deps
This commit is contained in:
parent
0f602b1cb7
commit
008632bc8b
12 changed files with 1300 additions and 1309 deletions
16
tidepool/flake.lock
generated
16
tidepool/flake.lock
generated
|
|
@ -8,10 +8,10 @@
|
|||
},
|
||||
"locked": {
|
||||
"dir": "foundation",
|
||||
"dirtyRev": "a707b0f06be6b36bcbfe88d0a9a5b9a803983a06-dirty",
|
||||
"dirtyShortRev": "a707b0f-dirty",
|
||||
"lastModified": 1719079124,
|
||||
"narHash": "sha256-hz9vVcHSvlq/W01UOh/GqPFUoH9DzCFB16n23oj7fnQ=",
|
||||
"dirtyRev": "2be3111b2c0911f40b47fe0a1fb22b5f5188cf59-dirty",
|
||||
"dirtyShortRev": "2be3111-dirty",
|
||||
"lastModified": 1719251485,
|
||||
"narHash": "sha256-9G1TPBdlQNXCZf6A66bCT9m2vhodkSF+rDtqOVuFteY=",
|
||||
"type": "git",
|
||||
"url": "file:../?dir=foundation"
|
||||
},
|
||||
|
|
@ -24,10 +24,10 @@
|
|||
"lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"dirtyRev": "a707b0f06be6b36bcbfe88d0a9a5b9a803983a06-dirty",
|
||||
"dirtyShortRev": "a707b0f-dirty",
|
||||
"lastModified": 1719079124,
|
||||
"narHash": "sha256-hz9vVcHSvlq/W01UOh/GqPFUoH9DzCFB16n23oj7fnQ=",
|
||||
"dirtyRev": "2be3111b2c0911f40b47fe0a1fb22b5f5188cf59-dirty",
|
||||
"dirtyShortRev": "2be3111-dirty",
|
||||
"lastModified": 1719251485,
|
||||
"narHash": "sha256-9G1TPBdlQNXCZf6A66bCT9m2vhodkSF+rDtqOVuFteY=",
|
||||
"type": "git",
|
||||
"url": "file:../?dir=lib"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -83,7 +83,13 @@ in {
|
|||
}
|
||||
);
|
||||
in
|
||||
built // {inherit (package) meta;};
|
||||
built
|
||||
// {
|
||||
inherit (package) meta;
|
||||
extras = {
|
||||
inherit package;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
# This file handles creating all of the exports for this project and is not
|
||||
# exported itself.
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
}: let
|
||||
lib' = config.lib;
|
||||
{config}: let
|
||||
inherit (config) lib;
|
||||
in {
|
||||
freeform = lib.types.any;
|
||||
# freeform = lib.types.any;
|
||||
|
||||
config = {
|
||||
exports = {
|
||||
lib = config.lib;
|
||||
inherit lib;
|
||||
modules = import ./modules.nix;
|
||||
|
||||
packages = {
|
||||
|
|
@ -25,7 +22,7 @@ in {
|
|||
# };
|
||||
# }))
|
||||
# .config;
|
||||
# foundation-gcc = config.packages.foundation.gcc;
|
||||
foundation-gcc = config.packages.foundation.gcc;
|
||||
# foundation-binutils = config.packages.foundation.binutils;
|
||||
# foundation-linux-headers = config.packages.foundation.linux-headers.versions.latest.extend {
|
||||
# platform.host = lib.modules.overrides.force "x86_64-linux";
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
{
|
||||
lib,
|
||||
lib',
|
||||
config,
|
||||
}: {
|
||||
}: let
|
||||
lib' = config.lib;
|
||||
in {
|
||||
config = {
|
||||
lib.packages = {
|
||||
dependencies = {
|
||||
|
|
@ -20,52 +21,85 @@
|
|||
in
|
||||
builtins.head sorted;
|
||||
|
||||
resolve = package:
|
||||
if package ? versions
|
||||
resolve = alias:
|
||||
if alias ? versions
|
||||
then
|
||||
package.versions.${config.preferences.packages.version}
|
||||
or (package.versions.${lib'.packages.getLatest package})
|
||||
else package;
|
||||
alias.versions.${config.preferences.packages.version}
|
||||
or (alias.versions.${lib'.packages.getLatest alias})
|
||||
else alias;
|
||||
|
||||
build = package: build: host: target: let
|
||||
resolved = lib'.packages.resolve package;
|
||||
build = alias: build: host: target: let
|
||||
package = lib'.packages.resolve alias;
|
||||
|
||||
buildDependencies = build': host': target':
|
||||
builtins.mapAttrs (name: dep: lib'.packages.build dep build' host' target');
|
||||
|
||||
result = resolved.extend (
|
||||
{config}: {
|
||||
config = {
|
||||
platform = {
|
||||
build = build;
|
||||
host = host;
|
||||
target = lib.modules.override 150 target;
|
||||
};
|
||||
result = lib.modules.run {
|
||||
modules =
|
||||
package.__modules__
|
||||
++ [
|
||||
lib'.types.package.children.submodule
|
||||
(
|
||||
{config}: {
|
||||
config = {
|
||||
__modules__ = package.__modules__;
|
||||
platform = {
|
||||
build = lib.modules.overrides.force (lib'.systems.withBuildInfo build);
|
||||
host = lib.modules.overrides.force (lib'.systems.withBuildInfo host);
|
||||
target = lib.modules.overrides.force (lib'.systems.withBuildInfo target);
|
||||
};
|
||||
|
||||
deps = {
|
||||
build = {
|
||||
only = buildDependencies build build build resolved.deps.build.only;
|
||||
build = buildDependencies build build target resolved.deps.build.build;
|
||||
host = buildDependencies build host target resolved.deps.build.host;
|
||||
target = buildDependencies build target target resolved.deps.build.target;
|
||||
};
|
||||
host = {
|
||||
only = buildDependencies host host host resolved.deps.host.only;
|
||||
host = buildDependencies host host target resolved.deps.host.host;
|
||||
target = buildDependencies host target target resolved.deps.host.target;
|
||||
};
|
||||
target = {
|
||||
only = buildDependencies target target target resolved.deps.target.only;
|
||||
target = buildDependencies target target target resolved.deps.target.target;
|
||||
};
|
||||
};
|
||||
# NOTE: This does not seem to work and instead the pre-existing deps are used.
|
||||
# This causes an issue because the platforms will be wrong.
|
||||
# deps = {
|
||||
# build = {
|
||||
# only = buildDependencies build build build package.deps.build.only;
|
||||
# build = buildDependencies build build target package.deps.build.build;
|
||||
# host = buildDependencies build host target package.deps.build.host;
|
||||
# target = buildDependencies build target target package.deps.build.target;
|
||||
# };
|
||||
# host = {
|
||||
# only = buildDependencies host host host package.deps.host.only;
|
||||
# host = buildDependencies host host target package.deps.host.host;
|
||||
# target = buildDependencies host target target package.deps.host.target;
|
||||
# };
|
||||
# target = {
|
||||
# only = buildDependencies target target target package.deps.target.only;
|
||||
# target = buildDependencies target target target package.deps.target.target;
|
||||
# };
|
||||
# };
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
};
|
||||
|
||||
package = config.builder.build config;
|
||||
resolved =
|
||||
result.config
|
||||
// {
|
||||
deps = {
|
||||
build = {
|
||||
only = buildDependencies build build build package.deps.build.only;
|
||||
build = buildDependencies build build target package.deps.build.build;
|
||||
host = buildDependencies build host target package.deps.build.host;
|
||||
target = buildDependencies build target target package.deps.build.target;
|
||||
};
|
||||
host = {
|
||||
only = buildDependencies host host host package.deps.host.only;
|
||||
host = buildDependencies host host target package.deps.host.host;
|
||||
target = buildDependencies host target target package.deps.host.target;
|
||||
};
|
||||
target = {
|
||||
only = buildDependencies target target target package.deps.target.only;
|
||||
target = buildDependencies target target target package.deps.target.target;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
in
|
||||
result;
|
||||
resolved
|
||||
// {
|
||||
package = resolved.builder.build resolved;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,8 +1,11 @@
|
|||
{
|
||||
lib,
|
||||
lib',
|
||||
config,
|
||||
}: {
|
||||
}: let
|
||||
inherit (config) preferences builders;
|
||||
|
||||
lib' = config.lib;
|
||||
in {
|
||||
config = {
|
||||
lib.types = {
|
||||
license = let
|
||||
|
|
@ -52,6 +55,12 @@
|
|||
in
|
||||
lib.types.either type (lib.types.list.of type);
|
||||
|
||||
platform =
|
||||
lib.types.coerce
|
||||
lib.types.string
|
||||
lib'.systems.withBuildInfo
|
||||
lib'.systems.types.platformWithBuildInfo;
|
||||
|
||||
builder = lib.types.submodule {
|
||||
freeform = lib.types.any;
|
||||
|
||||
|
|
@ -63,385 +72,287 @@
|
|||
};
|
||||
};
|
||||
|
||||
packages = lib.types.attrs.of (lib'.types.alias);
|
||||
packages = lib.types.attrs.of (lib.types.attrs.of lib'.types.alias);
|
||||
|
||||
alias = lib.types.attrs.of (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
versions = lib.options.create {
|
||||
description = "All available package versions.";
|
||||
type = lib.types.attrs.of lib'.types.package.base;
|
||||
};
|
||||
dependencies = let
|
||||
initial =
|
||||
(lib.types.attrs.lazy lib.types.any)
|
||||
// {
|
||||
check = value:
|
||||
lib.types.attrs.any.check value
|
||||
&& value ? versions;
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
lib.types.attrs.of (lib.types.coerce initial lib'.packages.resolve lib'.types.package);
|
||||
|
||||
dependencies = lib.types.attrs.of (
|
||||
lib.types.nullish (lib'.types.package.resolved)
|
||||
);
|
||||
alias = lib.types.submodule {
|
||||
options = {
|
||||
stable = lib.options.create {
|
||||
description = "The stable version of the package.";
|
||||
type = lib.types.nullish lib'.types.package;
|
||||
};
|
||||
|
||||
package = {
|
||||
resolved = let
|
||||
initial =
|
||||
lib.types.raw
|
||||
// {
|
||||
check = value:
|
||||
!(value ? __merged__)
|
||||
&& lib.types.raw.check
|
||||
value;
|
||||
};
|
||||
latest = lib.options.create {
|
||||
description = "The latest version of the package.";
|
||||
type = lib'.types.package;
|
||||
};
|
||||
|
||||
transform = value: let
|
||||
package = lib'.packages.resolve value;
|
||||
packageSubmodule = package.extend (args: {
|
||||
options.__export__ = lib.options.create {
|
||||
type = lib.types.raw;
|
||||
default.value = {
|
||||
inherit (args) options config;
|
||||
};
|
||||
};
|
||||
versions = lib.options.create {
|
||||
description = "Available versions of the package.";
|
||||
type = lib.types.attrs.of lib'.types.package;
|
||||
default.value = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config.__export__ = {
|
||||
inherit (args) options config;
|
||||
};
|
||||
});
|
||||
type = lib'.types.package.base.withSubModules (lib'.types.package.base.getSubModules
|
||||
++ [
|
||||
(args: {
|
||||
options.__export__ = lib.options.create {
|
||||
type = lib.types.raw;
|
||||
default.value = {
|
||||
inherit (args) options config;
|
||||
};
|
||||
};
|
||||
package = let
|
||||
normalize = value:
|
||||
if builtins.isFunction value || builtins.isList value
|
||||
then value
|
||||
else if value ? __modules__
|
||||
then value.__modules__
|
||||
else {
|
||||
config = value;
|
||||
};
|
||||
|
||||
config.__export__ = {
|
||||
inherit (args) options config;
|
||||
};
|
||||
})
|
||||
]);
|
||||
typeSubmodule = lib.modules.run {
|
||||
modules = type.getSubModules;
|
||||
args = type.functor.payload.args;
|
||||
};
|
||||
|
||||
getOptions = export: let
|
||||
process = path: option:
|
||||
if builtins.isAttrs option
|
||||
then
|
||||
if lib.types.is "option" option
|
||||
then [
|
||||
{
|
||||
inherit path;
|
||||
option = option;
|
||||
}
|
||||
]
|
||||
else
|
||||
builtins.concatLists (
|
||||
lib.attrs.mapToList
|
||||
(name: value: process (path ++ [name]) value)
|
||||
option
|
||||
)
|
||||
else [];
|
||||
in
|
||||
process [] export.options;
|
||||
|
||||
packageOptions = getOptions packageSubmodule.__export__;
|
||||
typeOptions = getOptions typeSubmodule.config.__export__;
|
||||
|
||||
customOptions =
|
||||
builtins.filter
|
||||
(
|
||||
packageOption:
|
||||
builtins.all (typeOption: packageOption.path != typeOption.path) typeOptions
|
||||
)
|
||||
packageOptions;
|
||||
|
||||
packageOptionsIds = builtins.map (option: builtins.concatStringsSep "." option.path) packageOptions;
|
||||
typeOptionsIds = builtins.map (option: builtins.concatStringsSep "." option.path) typeOptions;
|
||||
customOptionsIds = builtins.map (option: builtins.concatStringsSep "." option.path) customOptions;
|
||||
|
||||
resolvedOptions =
|
||||
builtins.foldl' (
|
||||
resolved: option: let
|
||||
first = builtins.head option.path;
|
||||
generated = lib.attrs.set option.path option.option;
|
||||
in
|
||||
if first == "__export__" || first == "__module__" || first == "__merged__"
|
||||
then resolved
|
||||
else lib.attrs.mergeRecursive resolved generated
|
||||
) {}
|
||||
customOptions;
|
||||
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.trace (builtins.deepSeq packageOptionsIds packageOptionsIds))
|
||||
# (builtins.trace (builtins.deepSeq typeOptionsIds typeOptionsIds))
|
||||
# (builtins.trace (builtins.deepSeq customOptionsIds customOptionsIds))
|
||||
# (builtins.trace packageSubmodule.__export__.config)
|
||||
(args: {
|
||||
__file__ = packageSubmodule.__export__.config.__file__ or "virtual:tidepool/src/lib/types.nix";
|
||||
builtins.concatLists
|
||||
normalized;
|
||||
};
|
||||
|
||||
options =
|
||||
resolvedOptions
|
||||
// {
|
||||
__merged__ = lib.options.create {
|
||||
type = lib.types.bool;
|
||||
default.value = true;
|
||||
};
|
||||
};
|
||||
transform = location: value: let
|
||||
modules =
|
||||
lib.lists.from.any (normalize value);
|
||||
|
||||
config =
|
||||
builtins.removeAttrs package ["extend" "package" "platform"]
|
||||
// {
|
||||
platform = {
|
||||
build = lib.modules.overrides.default package.platform.build.triple;
|
||||
host = lib.modules.overrides.default package.platform.host.triple;
|
||||
target = lib.modules.overrides.default package.platform.target.triple;
|
||||
};
|
||||
};
|
||||
# // {
|
||||
# builder =
|
||||
# (builtins.trace "builder")
|
||||
# (builtins.trace (args.config ? builder))
|
||||
# lib.modules.alias
|
||||
# packageSubmodule.__export__.options.builder;
|
||||
# };
|
||||
});
|
||||
result = lib.modules.run {
|
||||
prefix = location;
|
||||
modules =
|
||||
modules
|
||||
++ [submodule {config.__modules__ = modules;}];
|
||||
};
|
||||
in
|
||||
lib.types.coerce initial transform lib'.types.package.base;
|
||||
result.config;
|
||||
|
||||
base = lib.types.submodule (
|
||||
{
|
||||
config,
|
||||
meta,
|
||||
}: {
|
||||
options = {
|
||||
extend = lib.options.create {
|
||||
description = "Extend the package's submodules with additional configuration.";
|
||||
type = lib.types.function lib.types.raw;
|
||||
default.value = value: let
|
||||
result = meta.extend {
|
||||
modules =
|
||||
if builtins.isAttrs value
|
||||
then [{config = value;}]
|
||||
else lib.lists.from.any value;
|
||||
};
|
||||
in
|
||||
result.config;
|
||||
};
|
||||
final = lib.types.attrs.any;
|
||||
|
||||
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 "";
|
||||
};
|
||||
};
|
||||
submodule = {config}: {
|
||||
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 = [];
|
||||
};
|
||||
|
||||
pname = lib.options.create {
|
||||
description = "The program name for the package";
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
description = "The description 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;
|
||||
homepage = lib.options.create {
|
||||
description = "The homepage for the package.";
|
||||
type = lib.types.nullish lib.types.string;
|
||||
default.value = null;
|
||||
};
|
||||
|
||||
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 = [];
|
||||
};
|
||||
license = lib.options.create {
|
||||
description = "The license for the package.";
|
||||
type = lib.types.nullish lib'.types.license;
|
||||
default.value = null;
|
||||
};
|
||||
|
||||
platform = {
|
||||
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 = {
|
||||
build = {
|
||||
only = lib.options.create {
|
||||
description = "Dependencies which are only used in the build environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
|
||||
build = lib.options.create {
|
||||
description = "The build platform for the package.";
|
||||
type = lib.types.string;
|
||||
default.value = "x86_64-linux";
|
||||
apply = raw: let
|
||||
system = lib'.systems.from.string raw;
|
||||
x = lib'.systems.withBuildInfo raw;
|
||||
in
|
||||
x;
|
||||
description = "Dependencies which are created in the build environment and are executed in the build environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
|
||||
host = lib.options.create {
|
||||
description = "The host platform for the package.";
|
||||
type = lib.types.string;
|
||||
default.value = "x86_64-linux";
|
||||
# apply = raw: let
|
||||
# system = lib'.systems.from.string raw;
|
||||
# in {
|
||||
# inherit raw system;
|
||||
|
||||
# double = lib'.systems.into.double system;
|
||||
# triple = lib'.systems.into.triple system;
|
||||
# };
|
||||
apply = raw: let
|
||||
system = lib'.systems.from.string raw;
|
||||
x = lib'.systems.withBuildInfo raw;
|
||||
in
|
||||
x;
|
||||
description = "Dependencies which are created in the build environment and are executed in the host environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
|
||||
target = lib.options.create {
|
||||
description = "The target platform for the package.";
|
||||
type = lib.types.string;
|
||||
default.value = "x86_64-linux";
|
||||
# apply = raw: let
|
||||
# system = lib'.systems.from.string raw;
|
||||
# in {
|
||||
# inherit raw system;
|
||||
|
||||
# double = lib'.systems.into.double system;
|
||||
# triple = lib'.systems.into.triple system;
|
||||
# };
|
||||
apply = raw: let
|
||||
system = lib'.systems.from.string raw;
|
||||
x = lib'.systems.withBuildInfo raw;
|
||||
in
|
||||
x;
|
||||
description = "Dependencies which are created in the build environment and are executed in the target environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
};
|
||||
|
||||
phases = lib.options.create {
|
||||
description = "The phases for the package.";
|
||||
type = lib.types.dag.of (lib.types.either lib.types.string (lib.types.function 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 = {};
|
||||
};
|
||||
|
||||
builder = lib.options.create {
|
||||
description = "The builder for the package.";
|
||||
type = lib'.types.builder;
|
||||
};
|
||||
|
||||
deps = {
|
||||
build = {
|
||||
only = lib.options.create {
|
||||
description = "Dependencies which are only used in the build environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
|
||||
build = lib.options.create {
|
||||
description = "Dependencies which are created in the build environment and are executed in the build environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
|
||||
host = lib.options.create {
|
||||
description = "Dependencies which are created in the build environment and are executed in the host environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
|
||||
target = lib.options.create {
|
||||
description = "Dependencies which are created in the build environment and are executed in the target environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
host = {
|
||||
only = lib.options.create {
|
||||
description = "Dependencies which are only used in the host environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
|
||||
host = {
|
||||
only = lib.options.create {
|
||||
description = "Dependencies which are only used in the host environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
|
||||
host = lib.options.create {
|
||||
description = "Dependencies which are executed in the host environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
|
||||
target = lib.options.create {
|
||||
description = "Dependencies which are executed in the host environment which produces code for the target environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
host = lib.options.create {
|
||||
description = "Dependencies which are executed in the host environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
|
||||
target = {
|
||||
only = lib.options.create {
|
||||
description = "Dependencies which are only used in the target environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
|
||||
target = lib.options.create {
|
||||
description = "Dependencies which are executed in the target environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
target = lib.options.create {
|
||||
description = "Dependencies which are executed in the host environment which produces code for the target environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
description = "The built derivation.";
|
||||
type = lib.types.derivation;
|
||||
default.value = config.builder.build config;
|
||||
target = {
|
||||
only = lib.options.create {
|
||||
description = "Dependencies which are only used in the target environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
|
||||
target = lib.options.create {
|
||||
description = "Dependencies which are executed in the target environment.";
|
||||
type = lib'.types.dependencies;
|
||||
default.value = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
type =
|
||||
(lib.types.coerceWithLocation initial transform final)
|
||||
// {
|
||||
name = "Package";
|
||||
description = "a package definition";
|
||||
};
|
||||
in
|
||||
type
|
||||
// {
|
||||
children =
|
||||
type.children
|
||||
// {
|
||||
inherit submodule;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ in {
|
|||
platforms = ["i686-linux"];
|
||||
};
|
||||
|
||||
name = "${config.pname}-${config.version}";
|
||||
|
||||
pname = "a";
|
||||
version = "1.0.0";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
{
|
||||
lib',
|
||||
config,
|
||||
}: let
|
||||
inherit (config) builders packages;
|
||||
{config}: let
|
||||
inherit (config) lib builders packages;
|
||||
in {
|
||||
config.packages.aux.b = {
|
||||
versions = {
|
||||
"latest" = {config}: {
|
||||
options = {
|
||||
custom = lib'.options.create {
|
||||
type = lib'.types.bool;
|
||||
custom = lib.options.create {
|
||||
type = lib.types.bool;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -18,6 +15,8 @@ in {
|
|||
platforms = ["i686-linux"];
|
||||
};
|
||||
|
||||
name = "${config.pname}-${config.version}";
|
||||
|
||||
custom = true;
|
||||
|
||||
pname = "b";
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
{
|
||||
lib,
|
||||
lib',
|
||||
config,
|
||||
}: let
|
||||
doubles = lib'.systems.doubles.all;
|
||||
{config}: let
|
||||
inherit (config) lib;
|
||||
|
||||
doubles = lib.systems.doubles.all;
|
||||
|
||||
packages = builtins.removeAttrs config.packages ["cross"];
|
||||
in {
|
||||
|
|
@ -17,13 +15,13 @@ in {
|
|||
packages = lib.options.create {
|
||||
description = "The package set.";
|
||||
type = lib.types.submodule {
|
||||
freeform = lib.types.attrs.of (lib.types.submodule {freeform = lib'.types.alias;});
|
||||
freeform = lib.types.packages;
|
||||
|
||||
options.cross = lib.attrs.generate doubles (
|
||||
system:
|
||||
lib.options.create {
|
||||
description = "The cross-compiled package set for the ${system} target.";
|
||||
type = lib'.types.packages;
|
||||
type = lib.types.packages;
|
||||
default = {};
|
||||
}
|
||||
);
|
||||
|
|
@ -49,38 +47,39 @@ in {
|
|||
builtins.mapAttrs (
|
||||
name: alias: let
|
||||
setHost = package:
|
||||
if package != {}
|
||||
then
|
||||
(package.extend (
|
||||
{config}: {
|
||||
config = {
|
||||
platform = {
|
||||
host = lib.modules.overrides.force system;
|
||||
target = lib.modules.overrides.default system;
|
||||
};
|
||||
package;
|
||||
# if package != {}
|
||||
# then
|
||||
# (package.extend (
|
||||
# {config}: {
|
||||
# config = {
|
||||
# platform = {
|
||||
# host = lib.modules.overrides.force system;
|
||||
# target = lib.modules.overrides.default system;
|
||||
# };
|
||||
|
||||
deps = {
|
||||
build = {
|
||||
only = setHost package.deps.build.only;
|
||||
build = setHost package.deps.build.build;
|
||||
host = setHost package.deps.build.host;
|
||||
target = setHost package.deps.build.target;
|
||||
};
|
||||
host = {
|
||||
only = setHost package.deps.host.only;
|
||||
host = setHost package.deps.host.host;
|
||||
target = setHost package.deps.host.target;
|
||||
};
|
||||
target = {
|
||||
only = setHost package.deps.target.only;
|
||||
target = setHost package.deps.target.target;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
))
|
||||
.config
|
||||
else package;
|
||||
# deps = {
|
||||
# build = {
|
||||
# only = setHost package.deps.build.only;
|
||||
# build = setHost package.deps.build.build;
|
||||
# host = setHost package.deps.build.host;
|
||||
# target = setHost package.deps.build.target;
|
||||
# };
|
||||
# host = {
|
||||
# only = setHost package.deps.host.only;
|
||||
# host = setHost package.deps.host.host;
|
||||
# target = setHost package.deps.host.target;
|
||||
# };
|
||||
# target = {
|
||||
# only = setHost package.deps.target.only;
|
||||
# target = setHost package.deps.target.target;
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# }
|
||||
# ))
|
||||
# .config
|
||||
# else package;
|
||||
|
||||
updated =
|
||||
alias
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue