Compare commits

...

14 commits

Author SHA1 Message Date
isabel roses fe8157bd15
feat: inital support for x86_64-linux 2024-06-21 23:53:34 +01:00
Steve D 8e9cb4fbe9 foundation/stage0: fix hex0 hashes for amd64 & arm64 (#2)
I must confess to not understanding quite how all this works, but this seems to solve the problem of aarch64 fetching the x86-64 binary and vice-versa.

Reviewed-on: #2
Reviewed-by: Jake Hamilton <jake.hamilton@hey.com>
Co-authored-by: Steve Dodd <steved424@gmail.com>
Co-committed-by: Steve Dodd <steved424@gmail.com>
2024-06-17 10:59:52 +00:00
Jake Hamilton 9850da8aa9
fix: resolve issue with extending cross package 2024-06-16 02:24:21 -07:00
Jake Hamilton 0312e3c4cc
feat: working gcc build 2024-06-15 07:08:45 -07:00
Jake Hamilton 6bd35bf4d5
feat: rich platform information 2024-06-15 04:18:05 -07:00
Jake Hamilton 1c67c40213
feat: cross compilation package set 2024-06-15 03:58:25 -07:00
Jake Hamilton 2989fdc4fe
refactor: more elegant shorthand support 2024-06-15 02:35:37 -07:00
Jake Hamilton aa1c58f6ee
feat: support submodule longhand 2024-06-14 17:26:58 -07:00
Jake Hamilton 3713635d76
feat: simple builder 2024-06-14 07:01:18 -07:00
Jake Hamilton b3f9fe574e
refactor: enable foundation, standardize exports 2024-06-14 04:55:15 -07:00
Jake Hamilton fea8c2cd9c
feat: working package export 2024-06-14 04:47:54 -07:00
Jake Hamilton cdc90a4656
refactor: potluck -> tidepool 2024-06-14 02:12:19 -07:00
Jake Hamilton e1321add05
feat: dynamic cross packages generation 2024-06-14 01:40:46 -07:00
Jake Hamilton ea0ed58a7e
feat: working module packages 2024-06-14 01:26:16 -07:00
103 changed files with 2565 additions and 1643 deletions

View file

@ -25,7 +25,8 @@ may collaborate.
## Experiments
| Name | Phase | Description |
| ------------------------------ | --------- | -------------------------------------------------------------------------- |
| [Aux Lib](./lib) | Iteration | A library of common functions used in the Aux ecosystem. |
| [Aux Foundation](./foundation) | Iteration | Foundational packages which allow for bootstrapping a greater package set. |
| Name | Phase | Description |
| ------------------------------ | --------- | ------------------------------------------------------------------------------------ |
| [Aux Lib](./lib) | Iteration | A library of common functions used in the Aux ecosystem. |
| [Aux Foundation](./foundation) | Iteration | Foundational packages which allow for bootstrapping a greater package set. |
| [Aux Tidepool](./tidepool) | Idea | An initial package set built on top of Aux Foundation using Aux Lib's module system. |

View file

@ -4,11 +4,7 @@
modules = import ./src;
result = lib.modules.run {
modules =
(builtins.attrValues modules)
++ [
{config.aux.system = system;}
];
modules = (builtins.attrValues modules) ++ [{config.aux.system = system;}];
};
in
result.config.exports.resolved.packages

View file

@ -3,10 +3,10 @@
"lib": {
"locked": {
"dir": "lib",
"dirtyRev": "9c29945531c58ad81f05cd1f4958c8894a733216-dirty",
"dirtyShortRev": "9c29945-dirty",
"lastModified": 1718255029,
"narHash": "sha256-iPMsyNszFA+EzjtIpjmu9EAG7zdjLbuugLtfa64dJos=",
"dirtyRev": "856b88321e5f19019332f8b60b729095c2260340-dirty",
"dirtyShortRev": "856b883-dirty",
"lastModified": 1718299377,
"narHash": "sha256-qsSV+ty3XdEOlxJr5/1ZGheyjDAIu3xWtFxVs1+rDKA=",
"type": "git",
"url": "file:../?dir=lib"
},

View file

@ -14,24 +14,18 @@
forEachSystem = lib.attrs.generate [
"i686-linux"
"x86_64-linux"
];
in {
extras = let
result = lib.modules.run {
modules =
builtins.attrValues modules;
};
result = lib.modules.run {modules = builtins.attrValues modules;};
in
result.config.exports.resolved.extras;
packages = forEachSystem (
system: let
result = lib.modules.run {
modules =
(builtins.attrValues modules)
++ [
{config.aux.system = system;}
];
modules = (builtins.attrValues modules) ++ [{config.aux.system = system;}];
};
in
result.config.exports.resolved.packages

View file

@ -2,7 +2,7 @@
lib,
config,
}: let
system = config.aux.system;
inherit (config.aux) system;
architecture =
if system == "x86_64-linux"

View file

@ -35,7 +35,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -47,24 +50,26 @@ in {
config = {
aux.foundation.stages.stage0.kaem = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "kaem";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "kaem";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = kaem-unwrapped.package;
executable = kaem-unwrapped.package;
args = [
"--verbose"
"--strict"
"--file"
./build.kaem
];
args = [
"--verbose"
"--strict"
"--file"
./build.kaem
];
kaemUnwrapped = kaem-unwrapped.package;
PATH = lib.paths.bin [mescc-tools-extra.package];
});
kaemUnwrapped = kaem-unwrapped.package;
PATH = lib.paths.bin [mescc-tools-extra.package];
}
);
};
};
}

View file

@ -43,7 +43,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -55,27 +58,29 @@ in {
config = {
aux.foundation.stages.stage0.mescc-tools-extra = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "mescc-tools-tools";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "mescc-tools-tools";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = kaem-unwrapped.package;
executable = kaem-unwrapped.package;
args = [
"--verbose"
"--strict"
"--file"
./build.kaem
];
args = [
"--verbose"
"--strict"
"--file"
./build.kaem
];
src = sources.mescc-tools-extra;
src = sources.mescc-tools-extra;
m2libcOS = "linux";
m2libcArch = architecture.m2libc;
mesccTools = mescc-tools.package;
});
m2libcOS = "linux";
m2libcArch = architecture.m2libc;
mesccTools = mescc-tools.package;
}
);
};
};
}

View file

@ -129,7 +129,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -141,42 +144,44 @@ in {
config = {
aux.foundation.stages.stage0.mescc-tools = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "mescc-tools";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "mescc-tools";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = kaem-unwrapped.package;
executable = kaem-unwrapped.package;
args = [
"--verbose"
"--strict"
"--file"
./build.kaem
];
args = [
"--verbose"
"--strict"
"--file"
./build.kaem
];
M1 = M1.package;
M2 = M2.package;
blood-elf-0 = blood-elf.package;
hex2 = hex2.package;
M1 = M1.package;
M2 = M2.package;
blood-elf-0 = blood-elf.package;
hex2 = hex2.package;
m2libc = sources.m2libc;
m2libcArch = architecture.m2libc;
m2planet = sources.m2planet;
m2mesoplanet = sources.m2mesoplanet;
mesccTools = sources.mescc-tools;
mesccToolsExtra = sources.mescc-tools-extra;
m2libc = sources.m2libc;
m2libcArch = architecture.m2libc;
m2planet = sources.m2planet;
m2mesoplanet = sources.m2mesoplanet;
mesccTools = sources.mescc-tools;
mesccToolsExtra = sources.mescc-tools-extra;
bloodFlag = bloodFlag;
endianFlag = endianFlag;
baseAddress = baseAddress;
bloodFlag = bloodFlag;
endianFlag = endianFlag;
baseAddress = baseAddress;
mkdir = getExtraUtil "mkdir";
cp = getExtraUtil "cp";
chmod = getExtraUtil "chmod";
replace = getExtraUtil "replace";
});
mkdir = getExtraUtil "mkdir";
cp = getExtraUtil "cp";
chmod = getExtraUtil "chmod";
replace = getExtraUtil "replace";
}
);
};
};
}

View file

@ -41,7 +41,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -66,40 +69,44 @@ in {
config = {
aux.foundation.stages.stage0.hex0 = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "hex0";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "hex0";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = cfg.executable;
executable = cfg.executable;
args = [
"${sources.base}/hex0_${architecture}.hex0"
(builtins.placeholder "out")
];
args = [
"${sources.base}/hex0_${architecture}.hex0"
(builtins.placeholder "out")
];
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = cfg.hash;
});
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = cfg.hash;
}
);
hash = lib.modules.overrides.default (
if system == "x86_64-linux"
then "sha256-XTPsoKeI6wTZAF0UwEJPzuHelWOJe//wXg4HYO0dEJo="
else if system == "aarch64-linux"
then "sha256-RCgK9oZRDQUiWLVkcIBSR2HeoB+Bh0czthrpjFEkCaY="
else if system == "aarch64-linux"
then "sha256-XTPsoKeI6wTZAF0UwEJPzuHelWOJe//wXg4HYO0dEJo="
else if system == "i686-linux"
then "sha256-QU3RPGy51W7M2xnfFY1IqruKzusrSLU+L190ztN6JW8="
else null
);
executable = lib.modules.overrides.default (import <nix/fetchurl.nix> {
name = "hex0-seed";
url = "https://github.com/oriansj/bootstrap-seeds/raw/b1263ff14a17835f4d12539226208c426ced4fba/POSIX/${architecture}/hex0-seed";
executable = true;
hash = cfg.hash;
});
executable = lib.modules.overrides.default (
import <nix/fetchurl.nix> {
name = "hex0-seed";
url = "https://github.com/oriansj/bootstrap-seeds/raw/b1263ff14a17835f4d12539226208c426ced4fba/POSIX/${architecture}/hex0-seed";
executable = true;
hash = cfg.hash;
}
);
};
};
}

View file

@ -34,7 +34,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -46,19 +49,21 @@ in {
config = {
aux.foundation.stages.stage0.hex1 = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "hex1";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "hex1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = hex0.package;
executable = hex0.package;
args = [
"${sources.base}/hex1_${architecture.base}.hex0"
(builtins.placeholder "out")
];
});
args = [
"${sources.base}/hex1_${architecture.base}.hex0"
(builtins.placeholder "out")
];
}
);
};
};
}

View file

@ -35,7 +35,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -47,19 +50,21 @@ in {
config = {
aux.foundation.stages.stage0.hex2-0 = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "hex2-0";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "hex2-0";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = hex1.package;
executable = hex1.package;
args = [
"${sources.base}/hex2_${architecture.base}.hex1"
(builtins.placeholder "out")
];
});
args = [
"${sources.base}/hex2_${architecture.base}.hex1"
(builtins.placeholder "out")
];
}
);
};
};
}

View file

@ -36,7 +36,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -48,28 +51,30 @@ in {
config = {
aux.foundation.stages.stage0.catm = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "catm";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "catm";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable =
if architecture.base == "AArch64"
then hex1.package
else hex2-0.package;
executable =
if architecture.base == "AArch64"
then hex1.package
else hex2-0.package;
args =
if architecture.base == "AArch64"
then [
"${sources.base}/catm_${architecture.base}.hex1"
(builtins.placeholder "out")
]
else [
"${sources.base}/catm_${architecture.base}.hex2"
(builtins.placeholder "out")
];
});
args =
if architecture.base == "AArch64"
then [
"${sources.base}/catm_${architecture.base}.hex1"
(builtins.placeholder "out")
]
else [
"${sources.base}/catm_${architecture.base}.hex2"
(builtins.placeholder "out")
];
}
);
};
};
}

View file

@ -36,7 +36,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -48,34 +51,36 @@ in {
config = {
aux.foundation.stages.stage0.M0 = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "M0";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "M0";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = hex2-0.package;
executable = hex2-0.package;
args = let
M0_hex2-0 = builders.raw.build {
pname = "M0_hex2-0";
version = "1.6.0";
args = let
M0_hex2-0 = builders.raw.build {
pname = "M0_hex2-0";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = catm.package;
executable = catm.package;
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
"${sources.base}/M0_${architecture.base}.hex2"
];
};
in [
M0_hex2-0
(builtins.placeholder "out")
];
});
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
"${sources.base}/M0_${architecture.base}.hex2"
];
};
in [
M0_hex2-0
(builtins.placeholder "out")
];
}
);
};
};
}

View file

@ -37,7 +37,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -49,47 +52,49 @@ in {
config = {
aux.foundation.stages.stage0.cc_arch = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "cc_arch";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "cc_arch";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = hex2-0.package;
executable = hex2-0.package;
args = let
cc_arch0_hex2-0 = builders.raw.build {
pname = "cc_arch0_hex2-0";
version = "1.6.0";
args = let
cc_arch0_hex2-0 = builders.raw.build {
pname = "cc_arch0_hex2-0";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = M0.package;
executable = M0.package;
args = [
"${sources.base}/cc_${architecture.m2libc}.M1"
(builtins.placeholder "out")
];
};
cc_arch1_hex2-0 = builders.raw.build {
pname = "cc_arch1_hex2-0";
version = "1.6.0";
args = [
"${sources.base}/cc_${architecture.m2libc}.M1"
(builtins.placeholder "out")
];
};
cc_arch1_hex2-0 = builders.raw.build {
pname = "cc_arch1_hex2-0";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = catm.package;
executable = catm.package;
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
cc_arch0_hex2-0
];
};
in [
cc_arch1_hex2-0
(builtins.placeholder "out")
];
});
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
cc_arch0_hex2-0
];
};
in [
cc_arch1_hex2-0
(builtins.placeholder "out")
];
}
);
};
};
}

View file

@ -38,7 +38,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -50,97 +53,99 @@ in {
config = {
aux.foundation.stages.stage0.M2 = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "M2";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "M2";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = hex2-0.package;
executable = hex2-0.package;
args = let
M2_c = builders.raw.build {
pname = "M2_c";
version = "1.6.0";
args = let
M2_c = builders.raw.build {
pname = "M2_c";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = catm.package;
executable = catm.package;
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/linux/bootstrap.c"
"${sources.m2planet}/cc.h"
"${sources.m2libc}/bootstrappable.c"
"${sources.m2planet}/cc_globals.c"
"${sources.m2planet}/cc_reader.c"
"${sources.m2planet}/cc_strings.c"
"${sources.m2planet}/cc_types.c"
"${sources.m2planet}/cc_core.c"
"${sources.m2planet}/cc_macro.c"
"${sources.m2planet}/cc.c"
];
};
M2_M1 = builders.raw.build {
pname = "M2_M1";
version = "1.6.0";
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/linux/bootstrap.c"
"${sources.m2planet}/cc.h"
"${sources.m2libc}/bootstrappable.c"
"${sources.m2planet}/cc_globals.c"
"${sources.m2planet}/cc_reader.c"
"${sources.m2planet}/cc_strings.c"
"${sources.m2planet}/cc_types.c"
"${sources.m2planet}/cc_core.c"
"${sources.m2planet}/cc_macro.c"
"${sources.m2planet}/cc.c"
];
};
M2_M1 = builders.raw.build {
pname = "M2_M1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = cc_arch.package;
executable = cc_arch.package;
args = [
M2_c
(builtins.placeholder "out")
];
};
M2_M1' = builders.raw.build {
pname = "M2_M1";
version = "1.6.0";
args = [
M2_c
(builtins.placeholder "out")
];
};
M2_M1' = builders.raw.build {
pname = "M2_M1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = catm.package;
executable = catm.package;
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"${sources.m2libc}/${architecture.m2libc}/libc-core.M1"
M2_M1
];
};
M2_hex2-0 = builders.raw.build {
pname = "M2_hex2-0";
version = "1.6.0";
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"${sources.m2libc}/${architecture.m2libc}/libc-core.M1"
M2_M1
];
};
M2_hex2-0 = builders.raw.build {
pname = "M2_hex2-0";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = M0.package;
executable = M0.package;
args = [
M2_M1'
(builtins.placeholder "out")
];
};
M2_hex2-0' = builders.raw.build {
pname = "M2_hex2-0";
version = "1.6.0";
args = [
M2_M1'
(builtins.placeholder "out")
];
};
M2_hex2-0' = builders.raw.build {
pname = "M2_hex2-0";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = catm.package;
executable = catm.package;
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
M2_hex2-0
];
};
in [
M2_hex2-0'
(builtins.placeholder "out")
];
});
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
M2_hex2-0
];
};
in [
M2_hex2-0'
(builtins.placeholder "out")
];
}
);
};
};
}

View file

@ -39,7 +39,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -51,86 +54,88 @@ in {
config = {
aux.foundation.stages.stage0.blood-elf = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "blood-elf";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "blood-elf";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = hex2-0.package;
executable = hex2-0.package;
args = let
blood-elf_M1 = builders.raw.build {
pname = "blood-elf_M1";
version = "1.6.0";
args = let
blood-elf_M1 = builders.raw.build {
pname = "blood-elf_M1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = M2.package;
executable = M2.package;
args = [
"--architecture"
architecture.m2libc
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/bootstrap.c"
"-f"
"${sources.m2libc}/bootstrappable.c"
"-f"
"${sources.mescc-tools}/stringify.c"
"-f"
"${sources.mescc-tools}/blood-elf.c"
"--bootstrap-mode"
"-o"
(builtins.placeholder "out")
];
};
blood-elf_M1' = builders.raw.build {
pname = "blood-elf_M1-1";
version = "1.6.0";
args = [
"--architecture"
architecture.m2libc
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/bootstrap.c"
"-f"
"${sources.m2libc}/bootstrappable.c"
"-f"
"${sources.mescc-tools}/stringify.c"
"-f"
"${sources.mescc-tools}/blood-elf.c"
"--bootstrap-mode"
"-o"
(builtins.placeholder "out")
];
};
blood-elf_M1' = builders.raw.build {
pname = "blood-elf_M1-1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = catm.package;
executable = catm.package;
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"${sources.m2libc}/${architecture.m2libc}/libc-core.M1"
blood-elf_M1
];
};
blood-elf_hex2-0 = builders.raw.build {
pname = "blood-elf_hex2-0";
version = "1.6.0";
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"${sources.m2libc}/${architecture.m2libc}/libc-core.M1"
blood-elf_M1
];
};
blood-elf_hex2-0 = builders.raw.build {
pname = "blood-elf_hex2-0";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = M0.package;
executable = M0.package;
args = [
blood-elf_M1'
(builtins.placeholder "out")
];
};
blood-elf_hex2-0' = builders.raw.build {
pname = "blood-elf_hex2-0-1";
version = "1.6.0";
args = [
blood-elf_M1'
(builtins.placeholder "out")
];
};
blood-elf_hex2-0' = builders.raw.build {
pname = "blood-elf_hex2-0-1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = catm.package;
executable = catm.package;
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
blood-elf_hex2-0
];
};
in [
blood-elf_hex2-0'
(builtins.placeholder "out")
];
});
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
blood-elf_hex2-0
];
};
in [
blood-elf_hex2-0'
(builtins.placeholder "out")
];
}
);
};
};
}

View file

@ -40,7 +40,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -52,110 +55,112 @@ in {
config = {
aux.foundation.stages.stage0.M1-0 = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "M1-0";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "M1-0";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = hex2-0.package;
executable = hex2-0.package;
args = let
M1-macro-0_M1 = builders.raw.build {
pname = "M1-macro-0_M1";
version = "1.6.0";
args = let
M1-macro-0_M1 = builders.raw.build {
pname = "M1-macro-0_M1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = M2.package;
executable = M2.package;
args = [
"--architecture"
architecture.m2libc
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/bootstrap.c"
"-f"
"${sources.m2libc}/bootstrappable.c"
"-f"
"${sources.mescc-tools}/stringify.c"
"-f"
"${sources.mescc-tools}/M1-macro.c"
"--bootstrap-mode"
"--debug"
"-o"
(builtins.placeholder "out")
];
};
M1-macro-0-footer_M1 = builders.raw.build {
pname = "M1-macro-0-footer_M1";
version = "1.6.0";
meta = cfg.meta;
executable = blood-elf.package;
args =
(lib.lists.when (config.aux.platform.bits == 64) "--64")
++ [
args = [
"--architecture"
architecture.m2libc
"-f"
M1-macro-0_M1
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"${sources.m2libc}/${architecture.m2libc}/linux/bootstrap.c"
"-f"
"${sources.m2libc}/bootstrappable.c"
"-f"
"${sources.mescc-tools}/stringify.c"
"-f"
"${sources.mescc-tools}/M1-macro.c"
"--bootstrap-mode"
"--debug"
"-o"
(builtins.placeholder "out")
];
};
M1-macro-0_M1' = builders.raw.build {
pname = "M1-macro-0_M1-1";
version = "1.6.0";
};
M1-macro-0-footer_M1 = builders.raw.build {
pname = "M1-macro-0-footer_M1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = catm.package;
executable = blood-elf.package;
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"${sources.m2libc}/${architecture.m2libc}/libc-core.M1"
M1-macro-0_M1
M1-macro-0-footer_M1
];
};
M1-macro-0_hex2-0 = builders.raw.build {
pname = "M1-macro-0_hex2-0";
version = "1.6.0";
args =
(lib.lists.when (config.aux.platform.bits == 64) "--64")
++ [
"-f"
M1-macro-0_M1
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"-o"
(builtins.placeholder "out")
];
};
M1-macro-0_M1' = builders.raw.build {
pname = "M1-macro-0_M1-1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = M0.package;
executable = catm.package;
args = [
M1-macro-0_M1'
(builtins.placeholder "out")
];
};
M1-macro-0_hex2-0' = builders.raw.build {
pname = "M1-macro-0_hex2-0-1";
version = "1.6.0";
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"${sources.m2libc}/${architecture.m2libc}/libc-core.M1"
M1-macro-0_M1
M1-macro-0-footer_M1
];
};
M1-macro-0_hex2-0 = builders.raw.build {
pname = "M1-macro-0_hex2-0";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = catm.package;
executable = M0.package;
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
M1-macro-0_hex2-0
];
};
in [
M1-macro-0_hex2-0'
(builtins.placeholder "out")
];
});
args = [
M1-macro-0_M1'
(builtins.placeholder "out")
];
};
M1-macro-0_hex2-0' = builders.raw.build {
pname = "M1-macro-0_hex2-0-1";
version = "1.6.0";
meta = cfg.meta;
executable = catm.package;
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
M1-macro-0_hex2-0
];
};
in [
M1-macro-0_hex2-0'
(builtins.placeholder "out")
];
}
);
};
};
}

View file

@ -41,7 +41,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -53,128 +56,130 @@ in {
config = {
aux.foundation.stages.stage0.hex2-1 = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "hex2-1";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "hex2-1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = hex2-0.package;
executable = hex2-0.package;
args = let
hex2_linker_M1 = builders.raw.build {
pname = "hex2_linker_M1";
version = "1.6.0";
args = let
hex2_linker_M1 = builders.raw.build {
pname = "hex2_linker_M1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = M2.package;
executable = M2.package;
args = [
"--architecture"
architecture.m2libc
"-f"
"${sources.m2libc}/sys/types.h"
"-f"
"${sources.m2libc}/stddef.h"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
"-f"
"${sources.m2libc}/fcntl.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
"-f"
"${sources.m2libc}/stdlib.c"
"-f"
"${sources.m2libc}/stdio.h"
"-f"
"${sources.m2libc}/stdio.c"
"-f"
"${sources.m2libc}/bootstrappable.c"
"-f"
"${sources.mescc-tools}/hex2.h"
"-f"
"${sources.mescc-tools}/hex2_linker.c"
"-f"
"${sources.mescc-tools}/hex2_word.c"
"-f"
"${sources.mescc-tools}/hex2.c"
"--debug"
"-o"
(builtins.placeholder "out")
];
};
hex2_linker-footer_M1 = builders.raw.build {
pname = "hex2_linker-footer_M1";
version = "1.6.0";
meta = cfg.meta;
executable = blood-elf.package;
args =
(lib.lists.when (config.aux.platform.bits == 64) "--64")
++ [
args = [
"--architecture"
architecture.m2libc
"-f"
hex2_linker_M1
"${sources.m2libc}/sys/types.h"
"-f"
"${sources.m2libc}/stddef.h"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
"-f"
"${sources.m2libc}/fcntl.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
"-f"
"${sources.m2libc}/stdlib.c"
"-f"
"${sources.m2libc}/stdio.h"
"-f"
"${sources.m2libc}/stdio.c"
"-f"
"${sources.m2libc}/bootstrappable.c"
"-f"
"${sources.mescc-tools}/hex2.h"
"-f"
"${sources.mescc-tools}/hex2_linker.c"
"-f"
"${sources.mescc-tools}/hex2_word.c"
"-f"
"${sources.mescc-tools}/hex2.c"
"--debug"
"-o"
(builtins.placeholder "out")
];
};
hex2_linker-footer_M1 = builders.raw.build {
pname = "hex2_linker-footer_M1";
version = "1.6.0";
meta = cfg.meta;
executable = blood-elf.package;
args =
(lib.lists.when (config.aux.platform.bits == 64) "--64")
++ [
"-f"
hex2_linker_M1
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"-o"
(builtins.placeholder "out")
];
};
hex2_linker_hex2 = builders.raw.build {
pname = "hex2_linker_hex2";
version = "1.6.0";
meta = cfg.meta;
executable = M1-0.package;
args = [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"-f"
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
"-f"
hex2_linker_M1
"-f"
hex2_linker-footer_M1
"-o"
(builtins.placeholder "out")
];
};
hex2_linker_hex2 = builders.raw.build {
pname = "hex2_linker_hex2";
version = "1.6.0";
};
hex2_linker_hex2' = builders.raw.build {
pname = "hex2_linker_hex2-1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = M1-0.package;
executable = catm.package;
args = [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"-f"
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
"-f"
hex2_linker_M1
"-f"
hex2_linker-footer_M1
"-o"
(builtins.placeholder "out")
];
};
hex2_linker_hex2' = builders.raw.build {
pname = "hex2_linker_hex2-1";
version = "1.6.0";
meta = cfg.meta;
executable = catm.package;
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
hex2_linker_hex2
];
};
in [
hex2_linker_hex2'
(builtins.placeholder "out")
];
});
args = [
(builtins.placeholder "out")
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
hex2_linker_hex2
];
};
in [
hex2_linker_hex2'
(builtins.placeholder "out")
];
}
);
};
};
}

View file

@ -42,7 +42,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -54,133 +57,135 @@ in {
config = {
aux.foundation.stages.stage0.M1 = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "M1";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "M1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = hex2-1.package;
executable = hex2-1.package;
args = let
M1-macro_M1 = builders.raw.build {
pname = "M1-macro_M1";
version = "1.6.0";
args = let
M1-macro_M1 = builders.raw.build {
pname = "M1-macro_M1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = M2.package;
executable = M2.package;
args = [
"--architecture"
architecture.m2libc
"-f"
"${sources.m2libc}/sys/types.h"
"-f"
"${sources.m2libc}/stddef.h"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
"-f"
"${sources.m2libc}/fcntl.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
"-f"
"${sources.m2libc}/string.c"
"-f"
"${sources.m2libc}/stdlib.c"
"-f"
"${sources.m2libc}/stdio.h"
"-f"
"${sources.m2libc}/stdio.c"
"-f"
"${sources.m2libc}/bootstrappable.c"
"-f"
"${sources.mescc-tools}/stringify.c"
"-f"
"${sources.mescc-tools}/M1-macro.c"
"--debug"
"-o"
(builtins.placeholder "out")
];
};
M1-macro-footer_M1 = builders.raw.build {
pname = "M1-macro-footer_M1";
version = "1.6.0";
meta = cfg.meta;
executable = blood-elf.package;
args =
(lib.lists.when (config.aux.platform.bits == 64) "--64")
++ [
args = [
"--architecture"
architecture.m2libc
"-f"
M1-macro_M1
"${sources.m2libc}/sys/types.h"
"-f"
"${sources.m2libc}/stddef.h"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
"-f"
"${sources.m2libc}/fcntl.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
"-f"
"${sources.m2libc}/string.c"
"-f"
"${sources.m2libc}/stdlib.c"
"-f"
"${sources.m2libc}/stdio.h"
"-f"
"${sources.m2libc}/stdio.c"
"-f"
"${sources.m2libc}/bootstrappable.c"
"-f"
"${sources.mescc-tools}/stringify.c"
"-f"
"${sources.mescc-tools}/M1-macro.c"
"--debug"
"-o"
(builtins.placeholder "out")
];
};
M1-macro-footer_M1 = builders.raw.build {
pname = "M1-macro-footer_M1";
version = "1.6.0";
meta = cfg.meta;
executable = blood-elf.package;
args =
(lib.lists.when (config.aux.platform.bits == 64) "--64")
++ [
"-f"
M1-macro_M1
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"-o"
(builtins.placeholder "out")
];
};
M1-macro_hex2 = builders.raw.build {
pname = "M1-macro_hex2";
version = "1.6.0";
meta = cfg.meta;
executable = M1-0.package;
args = [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"-f"
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
"-f"
M1-macro_M1
"-f"
M1-macro-footer_M1
"-o"
(builtins.placeholder "out")
];
};
M1-macro_hex2 = builders.raw.build {
pname = "M1-macro_hex2";
version = "1.6.0";
meta = cfg.meta;
executable = M1-0.package;
args = [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"-f"
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
"-f"
M1-macro_M1
"-f"
M1-macro-footer_M1
"-o"
(builtins.placeholder "out")
];
};
in [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"--base-address"
(
if config.aux.system == "x86_64-linux"
then "0x00600000"
else if config.aux.system == "aarch64-linux"
then "0x00600000"
else if config.aux.system == "i686-linux"
then "0x08048000"
else builtins.throw "Unsupported system: ${config.aux.system}"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
"-f"
M1-macro_hex2
"-o"
(builtins.placeholder "out")
];
});
};
in [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"--base-address"
(
if config.aux.system == "x86_64-linux"
then "0x00600000"
else if config.aux.system == "aarch64-linux"
then "0x00600000"
else if config.aux.system == "i686-linux"
then "0x08048000"
else builtins.throw "Unsupported system: ${config.aux.system}"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
"-f"
M1-macro_hex2
"-o"
(builtins.placeholder "out")
];
}
);
};
};
}

View file

@ -41,7 +41,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -53,135 +56,137 @@ in {
config = {
aux.foundation.stages.stage0.hex2 = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "hex2";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "hex2";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = hex2-1.package;
executable = hex2-1.package;
args = let
hex2_linker_M1 = builders.raw.build {
pname = "hex2_linker_M1";
version = "1.6.0";
args = let
hex2_linker_M1 = builders.raw.build {
pname = "hex2_linker_M1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = M2.package;
executable = M2.package;
args = [
"--architecture"
architecture.m2libc
"-f"
"${sources.m2libc}/sys/types.h"
"-f"
"${sources.m2libc}/stddef.h"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
"-f"
"${sources.m2libc}/fcntl.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
"-f"
"${sources.m2libc}/stdlib.c"
"-f"
"${sources.m2libc}/stdio.h"
"-f"
"${sources.m2libc}/stdio.c"
"-f"
"${sources.m2libc}/bootstrappable.c"
"-f"
"${sources.mescc-tools}/hex2.h"
"-f"
"${sources.mescc-tools}/hex2_linker.c"
"-f"
"${sources.mescc-tools}/hex2_word.c"
"-f"
"${sources.mescc-tools}/hex2.c"
"--debug"
"-o"
(builtins.placeholder "out")
];
};
hex2_linker-footer_M1 = builders.raw.build {
pname = "hex2_linker-footer_M1";
version = "1.6.0";
meta = cfg.meta;
executable = blood-elf.package;
args =
(lib.lists.when (config.aux.platform.bits == 64) "--64")
++ [
args = [
"--architecture"
architecture.m2libc
"-f"
hex2_linker_M1
"${sources.m2libc}/sys/types.h"
"-f"
"${sources.m2libc}/stddef.h"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
"-f"
"${sources.m2libc}/fcntl.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
"-f"
"${sources.m2libc}/stdlib.c"
"-f"
"${sources.m2libc}/stdio.h"
"-f"
"${sources.m2libc}/stdio.c"
"-f"
"${sources.m2libc}/bootstrappable.c"
"-f"
"${sources.mescc-tools}/hex2.h"
"-f"
"${sources.mescc-tools}/hex2_linker.c"
"-f"
"${sources.mescc-tools}/hex2_word.c"
"-f"
"${sources.mescc-tools}/hex2.c"
"--debug"
"-o"
(builtins.placeholder "out")
];
};
hex2_linker-footer_M1 = builders.raw.build {
pname = "hex2_linker-footer_M1";
version = "1.6.0";
meta = cfg.meta;
executable = blood-elf.package;
args =
(lib.lists.when (config.aux.platform.bits == 64) "--64")
++ [
"-f"
hex2_linker_M1
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"-o"
(builtins.placeholder "out")
];
};
hex2_linker_hex2 = builders.raw.build {
pname = "hex2_linker_hex2";
version = "1.6.0";
meta = cfg.meta;
executable = M1.package;
args = [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"-f"
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
"-f"
hex2_linker_M1
"-f"
hex2_linker-footer_M1
"-o"
(builtins.placeholder "out")
];
};
hex2_linker_hex2 = builders.raw.build {
pname = "hex2_linker_hex2";
version = "1.6.0";
meta = cfg.meta;
executable = M1.package;
args = [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"-f"
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
"-f"
hex2_linker_M1
"-f"
hex2_linker-footer_M1
"-o"
(builtins.placeholder "out")
];
};
in [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"--base-address"
(
if config.aux.system == "x86_64-linux"
then "0x00600000"
else if config.aux.system == "aarch64-linux"
then "0x00600000"
else if config.aux.system == "i686-linux"
then "0x08048000"
else builtins.throw "Unsupported system: ${config.aux.system}"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
"-f"
hex2_linker_hex2
"-o"
(builtins.placeholder "out")
];
});
};
in [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"--base-address"
(
if config.aux.system == "x86_64-linux"
then "0x00600000"
else if config.aux.system == "aarch64-linux"
then "0x00600000"
else if config.aux.system == "i686-linux"
then "0x08048000"
else builtins.throw "Unsupported system: ${config.aux.system}"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
"-f"
hex2_linker_hex2
"-o"
(builtins.placeholder "out")
];
}
);
};
};
}

View file

@ -41,7 +41,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -53,137 +56,139 @@ in {
config = {
aux.foundation.stages.stage0.kaem-unwrapped = {
package = lib.modules.overrides.default (builders.raw.build {
pname = "kaem-unwrapped";
version = "1.6.0";
package = lib.modules.overrides.default (
builders.raw.build {
pname = "kaem-unwrapped";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = hex2.package;
executable = hex2.package;
args = let
kaem_M1 = builders.raw.build {
pname = "kaem_M1";
version = "1.6.0";
args = let
kaem_M1 = builders.raw.build {
pname = "kaem_M1";
version = "1.6.0";
meta = cfg.meta;
meta = cfg.meta;
executable = M2.package;
executable = M2.package;
args = [
"--architecture"
architecture.m2libc
"-f"
"${sources.m2libc}/sys/types.h"
"-f"
"${sources.m2libc}/stddef.h"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
"-f"
"${sources.m2libc}/fcntl.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
"-f"
"${sources.m2libc}/string.c"
"-f"
"${sources.m2libc}/stdlib.c"
"-f"
"${sources.m2libc}/stdio.h"
"-f"
"${sources.m2libc}/stdio.c"
"-f"
"${sources.m2libc}/bootstrappable.c"
"-f"
"${sources.mescc-tools}/Kaem/kaem.h"
"-f"
"${sources.mescc-tools}/Kaem/variable.c"
"-f"
"${sources.mescc-tools}/Kaem/kaem_globals.c"
"-f"
"${sources.mescc-tools}/Kaem/kaem.c"
"--debug"
"-o"
(builtins.placeholder "out")
];
};
kaem-footer_M1 = builders.raw.build {
pname = "kaem-footer_M1";
version = "1.6.0";
meta = cfg.meta;
executable = blood-elf.package;
args =
(lib.lists.when (config.aux.platform.bits == 64) "--64")
++ [
args = [
"--architecture"
architecture.m2libc
"-f"
kaem_M1
"${sources.m2libc}/sys/types.h"
"-f"
"${sources.m2libc}/stddef.h"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
"-f"
"${sources.m2libc}/fcntl.c"
"-f"
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
"-f"
"${sources.m2libc}/string.c"
"-f"
"${sources.m2libc}/stdlib.c"
"-f"
"${sources.m2libc}/stdio.h"
"-f"
"${sources.m2libc}/stdio.c"
"-f"
"${sources.m2libc}/bootstrappable.c"
"-f"
"${sources.mescc-tools}/Kaem/kaem.h"
"-f"
"${sources.mescc-tools}/Kaem/variable.c"
"-f"
"${sources.mescc-tools}/Kaem/kaem_globals.c"
"-f"
"${sources.mescc-tools}/Kaem/kaem.c"
"--debug"
"-o"
(builtins.placeholder "out")
];
};
kaem-footer_M1 = builders.raw.build {
pname = "kaem-footer_M1";
version = "1.6.0";
meta = cfg.meta;
executable = blood-elf.package;
args =
(lib.lists.when (config.aux.platform.bits == 64) "--64")
++ [
"-f"
kaem_M1
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"-o"
(builtins.placeholder "out")
];
};
kaem_hex2 = builders.raw.build {
pname = "kaem_hex2";
version = "1.6.0";
meta = cfg.meta;
executable = M1.package;
args = [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"-f"
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
"-f"
kaem_M1
"-f"
kaem-footer_M1
"-o"
(builtins.placeholder "out")
];
};
kaem_hex2 = builders.raw.build {
pname = "kaem_hex2";
version = "1.6.0";
meta = cfg.meta;
executable = M1.package;
args = [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
"-f"
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
"-f"
kaem_M1
"-f"
kaem-footer_M1
"-o"
(builtins.placeholder "out")
];
};
in [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"--base-address"
(
if config.aux.system == "x86_64-linux"
then "0x00600000"
else if config.aux.system == "aarch64-linux"
then "0x00600000"
else if config.aux.system == "i686-linux"
then "0x08048000"
else builtins.throw "Unsupported system: ${config.aux.system}"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
"-f"
kaem_hex2
"-o"
(builtins.placeholder "out")
];
});
};
in [
"--architecture"
architecture.m2libc
(
if config.aux.platform.endian == "little"
then "--little-endian"
else "--big-endian"
)
"--base-address"
(
if config.aux.system == "x86_64-linux"
then "0x00600000"
else if config.aux.system == "aarch64-linux"
then "0x00600000"
else if config.aux.system == "i686-linux"
then "0x08048000"
else builtins.throw "Unsupported system: ${config.aux.system}"
)
"-f"
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
"-f"
kaem_hex2
"-o"
(builtins.placeholder "out")
];
}
);
};
};
}

View file

@ -32,7 +32,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -9,9 +9,7 @@
stage1 = config.aux.foundation.stages.stage1;
in {
includes = [
./boot.nix
];
includes = [./boot.nix];
options.aux.foundation.stages.stage1.bash = {
meta = {
@ -37,7 +35,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
mainProgram = lib.options.create {

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -34,7 +34,10 @@ in {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
# TODO: Support more platforms.
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -9,9 +9,7 @@
stage1 = config.aux.foundation.stages.stage1;
in {
includes = [
./boot.nix
];
includes = [./boot.nix];
options.aux.foundation.stages.stage1.coreutils = {
meta = {
@ -37,7 +35,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -9,9 +9,7 @@
stage1 = config.aux.foundation.stages.stage1;
in {
includes = [
./boot.nix
];
includes = [./boot.nix];
options.aux.foundation.stages.stage1.gawk = {
meta = {
@ -37,7 +35,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
mainProgram = lib.options.create {

View file

@ -39,7 +39,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -32,7 +32,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
mainProgram = lib.options.create {

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -9,9 +9,7 @@
stage1 = config.aux.foundation.stages.stage1;
in {
includes = [
./boot.nix
];
includes = [./boot.nix];
options.aux.foundation.stages.stage1.gnumake = {
meta = {
@ -37,7 +35,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -32,7 +32,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};
@ -118,13 +121,8 @@ in {
];
objects =
builtins.map
(
value:
builtins.replaceStrings
[".c"]
[".o"]
(builtins.baseNameOf value)
builtins.map (
value: builtins.replaceStrings [".c"] [".o"] (builtins.baseNameOf value)
)
sources;
in
@ -134,9 +132,7 @@ in {
meta = cfg.meta;
src = cfg.src;
deps.build.host = [
stage1.tinycc.mes.compiler.package
];
deps.build.host = [stage1.tinycc.mes.compiler.package];
script = ''
# Unpack

View file

@ -9,9 +9,7 @@
stage1 = config.aux.foundation.stages.stage1;
in {
includes = [
./boot.nix
];
includes = [./boot.nix];
options.aux.foundation.stages.stage1.gnused = {
meta = {
@ -37,7 +35,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
mainProgram = lib.options.create {

View file

@ -38,7 +38,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
mainProgram = lib.options.create {

View file

@ -32,7 +32,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -10,9 +10,7 @@
stage1 = config.aux.foundation.stages.stage1;
stage2 = config.aux.foundation.stages.stage2;
in {
includes = [
./devtools.nix
];
includes = [./devtools.nix];
options.aux.foundation.stages.stage1.heirloom = {
meta = {
@ -48,7 +46,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -54,7 +54,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};
};

View file

@ -27,7 +27,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -34,7 +34,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};
@ -79,11 +82,9 @@ in {
sources = import ./sources.nix;
files =
lib.strings.concatMapSep
" "
(getSourcePath ".o")
(builtins.map compile sources.x86.linux.mescc.mes);
files = lib.strings.concatMapSep " " (getSourcePath ".o") (
builtins.map compile sources.x86.linux.mescc.mes
);
in
builders.kaem.build {
name = "mes-${stage1.mes.version}";

View file

@ -32,7 +32,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};
@ -57,9 +60,7 @@ in {
meta = cfg.meta;
deps.build.host = [
stage1.ln-boot.package
];
deps.build.host = [stage1.ln-boot.package];
script = ''
cd ${stage1.mes.libs.prefix}

View file

@ -34,7 +34,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};
@ -199,11 +202,13 @@ in {
libc-mini = createLib "libc-mini" sources.x86.linux.mescc.libc_mini;
libmescc = createLib "libmescc" sources.x86.linux.mescc.libmescc;
libc = createLib "libc" sources.x86.linux.mescc.libc;
libc_tcc = createLib "libc+tcc" (sources.x86.linux.mescc.libc_tcc
libc_tcc = createLib "libc+tcc" (
sources.x86.linux.mescc.libc_tcc
++ [
# We need `symlink` support for `ln-boot` to work.
"lib/linux/symlink.c"
]);
]
);
in
builders.kaem.build {
name = "mes-m2-libs-${stage1.mes.version}";

View file

@ -131,7 +131,6 @@ in {
# Install
make install
cp ${stage1.tinycc.mes.libs.package}/lib/libtcc1.a $out/lib
'';
};
};

View file

@ -9,9 +9,7 @@
stage1 = config.aux.foundation.stages.stage1;
in {
includes = [
./boot.nix
];
includes = [./boot.nix];
options.aux.foundation.stages.stage1.musl = {
meta = {
@ -38,7 +36,10 @@ in {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
# TODO: Support more platforms.
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86-64_linux"
];
};
};

View file

@ -35,7 +35,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"i686-linux"
"x86_64-linux"
];
};
};

View file

@ -38,7 +38,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -36,7 +36,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
mainProgram = lib.options.create {
@ -76,6 +79,7 @@ in {
deps.build.host = [
stage1.gcc.package
stage1.musl.package
stage1.coreutils.package
stage1.binutils.package
stage1.gnumake.package
stage1.gnupatch.package
@ -110,6 +114,7 @@ in {
make -j $NIX_BUILD_CORES install-strip
rm $out/bin/bashbug
ln -s $out/bin/bash $out/bin/sh
'';
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -34,7 +34,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};
@ -64,9 +67,7 @@ in {
};
package = let
patches = [
./patches/busybox-in-store.patch
];
patches = [./patches/busybox-in-store.patch];
busyboxConfig = [
"CC=musl-gcc"

View file

@ -34,7 +34,10 @@ in {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
# TODO: Support more platforms.
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
mainProgram = lib.options.create {

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -34,7 +34,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
mainProgram = lib.options.create {

View file

@ -34,7 +34,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
mainProgram = lib.options.create {

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
mainProgram = lib.options.create {

View file

@ -33,7 +33,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -34,7 +34,10 @@ in {
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
default.value = [
"x86_64-linux"
"i686-linux"
];
};
};

View file

@ -2,7 +2,7 @@
options.aux = {
system = lib.options.create {
type = lib.types.string;
default.value = "i686-linux";
default.value = "x86_64-linux";
description = ''
The system to build packages for. This value can be provided as either
`config.aux.system` or by setting the `system` argument for modules.

View file

@ -58,6 +58,10 @@ lib: {
else sorted;
};
apply = {
# defaults = graph: defaults:
};
## Map over the entries in a DAG and modify their values.
##
## @type (String -> a -> b) -> Dag a -> Dag b

View file

@ -317,6 +317,20 @@ lib: {
vm = lib.modules.override 10;
};
## Create alias definitions for a given option.
##
## @type Option -> Attrs
alias = lib.modules.aliasWith lib.fp.id;
## Create alias definitions for a given option.
##
## @type (Attrs -> Attrs) -> Option -> Attrs
aliasWith = f: option: let
exists = lib.types.is "option" option && option.isDefined;
value = f (lib.modules.merge option.definitions);
in
lib.modules.when exists value;
## Combine multiple modules together.
##
## @type List String -> List Module -> { matched :: Attrs, unmatched :: List Definition }
@ -344,7 +358,7 @@ lib: {
in
if builtins.isAttrs subtree
then builtins.mapAttrs (name: f module) subtree
else builtins.throw "Value for `${builtins.concatStringsSep "." prefix} is of type `${builtins.typeOf subtree}` but an attribute set was expected."
else builtins.throw "Value for `${builtins.concatStringsSep "." prefix}` is of type `${builtins.typeOf subtree}` but an attribute set was expected."
)
modules);

View file

@ -454,5 +454,262 @@ in {
};
in
evaluated.config.aux.x.message == expected;
"submodules without shorthand" = let
expected = "Hello, World!";
evaluated = lib.modules.run {
modules = [
{
options = {
aux = lib.options.create {
type = lib.types.submodules.of {
shorthand = false;
modules = [
{
options.message = lib.options.create {
type = lib.types.string;
};
}
];
};
};
};
config = {
aux = {
options = {
message2 = lib.options.create {
type = lib.types.string;
};
};
config = {
message = expected;
message2 = expected;
};
};
};
}
];
};
in
evaluated.config.aux.message == evaluated.config.aux.message2;
"function submodules" = let
expected = "Hello, World!";
evaluated = lib.modules.run {
modules = [
{
options = {
aux = lib.options.create {
type = lib.types.submodules.of {
shorthand = false;
modules = [
{
options.message = lib.options.create {
type = lib.types.string;
};
}
];
};
};
};
config = {
aux = args: {
config.message = expected;
};
};
}
];
};
in
evaluated.config.aux.message == expected;
"merges submodules" = let
expected = "Hello, World!";
evaluated = lib.modules.run {
modules = [
{
options = {
aux = lib.options.create {
type = lib.types.submodules.of {
shorthand = false;
modules = [
{
options.message = lib.options.create {
type = lib.types.string;
};
}
];
};
};
};
config = {
aux = args: {
options.message2 = lib.options.create {
type = lib.types.string;
};
config.message = expected;
};
};
}
{
config = {
aux.config.message2 = expected;
};
}
];
};
in
evaluated.config.aux.message == evaluated.config.aux.message2;
"flexible shorthand" = let
expected = "Hello, World!";
evaluated = lib.modules.run {
modules = [
{
options = {
aux = lib.options.create {
type = lib.types.submodules.of {
shorthand = true;
modules = [
{
options.message = lib.options.create {
type = lib.types.string;
};
}
];
};
};
};
config = {
aux = args: {
options.message2 = lib.options.create {
type = lib.types.string;
};
config.message = expected;
};
};
}
{
config = {
aux.message2 = expected;
};
}
];
};
in
evaluated.config.aux.message == evaluated.config.aux.message2;
"base level submodule" = let
expected = "Hello, World!";
evaluated = lib.modules.run {
modules = [
{
options = {
aux = lib.options.create {
type = lib.types.submodule {
options.message = lib.options.create {
type = lib.types.string;
};
};
};
};
config = {
aux = args: {
options.message2 = lib.options.create {
type = lib.types.string;
};
config.message = expected;
};
};
}
{
config = {
aux.message2 = expected;
};
}
];
};
in
evaluated.config.aux.message == evaluated.config.aux.message2;
"base level submodule (freeform)" = let
expected = "Hello, World!";
evaluated = lib.modules.run {
modules = [
{
options = {
aux = lib.options.create {
type = lib.types.submodule {
freeform = lib.types.any;
options.message = lib.options.create {
type = lib.types.string;
};
};
};
};
config = {
aux = args: {
options.message2 = lib.options.create {
type = lib.types.string;
};
config.message = expected;
};
};
}
{
config = {
aux.exists = true;
aux.message2 = expected;
};
}
];
};
in
(evaluated.config.aux.message == evaluated.config.aux.message2)
&& evaluated.config.aux.exists;
"nested submodules" = let
expected = "Hello, World!";
evaluated = lib.modules.run {
modules = [
{
options = {
aux = lib.options.create {
type = lib.types.submodule {
freeform = lib.types.any;
options.message = lib.options.create {
type = lib.types.string;
};
};
};
};
config = {
aux = args: {
options.message2 = lib.options.create {
type = lib.types.string;
};
config.message = expected;
};
};
}
{
config = {
aux.exists = true;
aux.message2 = expected;
};
}
];
};
in
(evaluated.config.aux.message == evaluated.config.aux.message2)
&& evaluated.config.aux.exists;
};
}

View file

@ -94,7 +94,7 @@ lib: {
typeSet = lib.attrs.when ((shared "type") && isTypeMergeable) {
type = mergedType;
};
files = builtins.map lib.modules.getFiles result.declarations;
files = result.declarations;
serializedFiles = builtins.concatStringsSep " and " files;
getSubModules = option.options.type.getSubModules or null;
submodules =

View file

@ -360,6 +360,19 @@ lib: {
## @type Attrs
port = lib.types.ints.u16;
## A type that allows a string value specifying a version number.
##
## @type Attrs
version = lib.types.create {
name = "Version";
description = "version";
check = value: let
parts = builtins.splitVersion value;
in
builtins.isString value && builtins.length parts > 0;
merge = lib.options.merge.equal;
};
## A type that allows a string value. The merged definitions must all be
## the same.
##
@ -743,19 +756,39 @@ lib: {
## with helpers like `lib.types.attrs.of` in order to produce more complex,
## dynamic types.
##
## @type { modules :: List Module, args? :: Attrs, description? :: String | Null } -> Attrs
## @type { modules :: List Module, args? :: Attrs, description? :: String | Null, shorthand? :: Bool } -> Attrs
of = settings @ {
modules,
args ? {},
description ? null,
shorthand ? true,
}: let
getModules = builtins.map (
definition:
if builtins.isAttrs definition
then {
__file__ = definition.__file__;
config = definition.value;
}
if shorthand && builtins.isAttrs definition.value
then let
# TODO: Figure out if we can apply additional attributes to the generated module.
# Currently this causes issues to do with redefined options.
rest =
builtins.removeAttrs
(lib.attrs.filter (name: value: builtins.elem name lib.modules.VALID_KEYS) definition.value)
["freeform"];
in
if definition.value ? config
then
rest
// {
__file__ = definition.__file__;
config = definition.value.config;
}
else let
config = builtins.removeAttrs definition.value lib.modules.VALID_KEYS;
in
rest
// {
__file__ = definition.__file__;
config = config;
}
else {
__file__ = definition.__file__;
includes = [definition.value];
@ -803,7 +836,7 @@ lib: {
getSubModules = modules;
withSubModules = modules:
lib.types.submodules.of {
inherit args description modules;
inherit args description modules shorthand;
};
children = lib.attrs.when (freeform != null) {
inherit freeform;
@ -813,7 +846,7 @@ lib: {
// {
type = lib.types.submodules.of;
payload = {
inherit modules args description;
inherit modules args description shorthand;
};
merge = x: y: {
modules = x.modules ++ y.modules;
@ -1038,72 +1071,72 @@ lib: {
inherit initial final;
};
};
};
dag = {
## Create a type that allows a DAG (Directed Acyclic Graph) of a given type.
##
## @type Attrs -> Attrs
of = type: let
resolved = lib.types.attrs.of (lib.types.dag.entry type);
in
lib.types.create {
name = "Dag";
description = "Dag of ${type.description}";
check = resolved.check;
merge = resolved.merge;
fallback = resolved.fallback;
getSubOptions = prefix: type.getSubOptions (prefix ++ ["<name>"]);
getSubModules = type.getSubModules;
withSubModules = modules: lib.types.dag.of (type.withSubModules modules);
functor = lib.types.functor "dag.of" // {wrapped = type;};
children = {
element = type;
resolved = resolved;
};
};
## Create a type that allows a DAG entry of a given type.
##
## @type Attrs -> Attrs
entry = type: let
submodule = lib.types.submodule ({name}: {
options = {
value = lib.options.create {
type = type;
};
before = lib.options.create {
type = lib.types.list.of lib.types.string;
};
after = lib.options.create {
type = lib.types.list.of lib.types.string;
};
};
});
normalize = definition: let
value =
if definition ? priority
then lib.modules.order definition.priority definition.value
else definition.value;
dag = {
## Create a type that allows a DAG (Directed Acyclic Graph) of a given type.
##
## @type Attrs -> Attrs
of = type: let
resolved = lib.types.attrs.of (lib.types.dag.entry type);
in
if lib.dag.validate.entry definition.value
then definition.value
else lib.dag.entry.anywhere value;
in
lib.types.create {
name = "DagEntry";
description = "DagEntry (${type.description})";
merge = location: definitions:
submodule.merge
location
(
builtins.map
(definition: {
__file__ = definition.__file__;
value = normalize definition;
})
definitions
);
};
lib.types.create {
name = "Dag";
description = "Dag of ${type.description}";
check = resolved.check;
merge = resolved.merge;
fallback = resolved.fallback;
getSubOptions = prefix: type.getSubOptions (prefix ++ ["<name>"]);
getSubModules = type.getSubModules;
withSubModules = modules: lib.types.dag.of (type.withSubModules modules);
functor = lib.types.functor "dag.of" // {wrapped = type;};
children = {
element = type;
resolved = resolved;
};
};
## Create a type that allows a DAG entry of a given type.
##
## @type Attrs -> Attrs
entry = type: let
submodule = lib.types.submodule ({name}: {
options = {
value = lib.options.create {
type = type;
};
before = lib.options.create {
type = lib.types.list.of lib.types.string;
};
after = lib.options.create {
type = lib.types.list.of lib.types.string;
};
};
});
normalize = definition: let
value =
if definition ? priority
then lib.modules.order definition.priority definition.value
else definition.value;
in
if lib.dag.validate.entry definition.value
then definition.value
else lib.dag.entry.anywhere value;
in
lib.types.create {
name = "DagEntry";
description = "DagEntry (${type.description})";
merge = location: definitions:
submodule.merge
location
(
builtins.map
(definition: {
__file__ = definition.__file__;
value = normalize definition;
})
definitions
);
};
};
};
}

View file

@ -1,33 +0,0 @@
{
lib ? import ./../lib,
foundation ? import ./../foundation {system = "i686-linux";},
}: let
modules = import ./src/modules.nix;
result = lib.modules.run {
modules =
(builtins.attrValues modules)
++ [
./src/export.nix
{
__file__ = "broken";
# options.foundation = lib.options.create {
# type = lib.types.attrs.of lib.types.derivation;
# };
# config.foundation = foundation;
config.packages.foundation =
builtins.mapAttrs (name: package: {
name = package.name;
inherit package;
meta = package.meta;
})
foundation;
}
];
};
in
result.config

View file

@ -1,14 +0,0 @@
# This file handles creating all of the exports for this project and is not
# exported itself.
{
lib,
config,
}: let
in {
config = {
exports = {
lib = config.lib;
modules = import ./modules.nix;
};
};
}

View file

@ -1,22 +0,0 @@
{
config,
lib,
}: let
lib' = config.lib;
in {
options = {
exports.packages = lib.options.create {
default.value = {};
};
exported.packages = lib.options.create {
default.value = {};
};
};
config = {
exported.packages = {
# i686-linux = config.packages.foundation;
};
};
}

View file

@ -1,471 +0,0 @@
{
lib,
config,
}: let
lib' = config.lib;
in {
config = {
lib.types = {
license = let
type = lib.types.submodule ({config}: {
options = {
name = {
full = lib.options.create {
type = lib.types.string;
description = "The full name of the license.";
};
short = lib.options.create {
type = lib.types.string;
description = "The short name of the license.";
};
};
spdx = lib.options.create {
type = lib.types.nullish lib.types.string;
default.value = null;
description = "The SPDX identifier for the license.";
};
url = lib.options.create {
type = lib.types.nullish lib.types.string;
description = "The URL for the license.";
};
free = lib.options.create {
type = lib.types.bool;
default.value = true;
description = "Whether the license is free.";
};
redistributable = lib.options.create {
type = lib.types.bool;
default = {
text = "config.free";
value = config.free;
};
description = "Whether the license is allows redistribution.";
};
};
});
in
lib.types.either type (lib.types.list.of type);
meta = lib.types.submodule {
options = {
name = lib.options.create {
type = lib.types.string;
description = "The name of the package.";
};
description = lib.options.create {
type = lib.types.nullish lib.types.string;
default.value = null;
description = "The description for the package.";
};
homepage = lib.options.create {
type = lib.types.nullish lib.types.string;
default.value = null;
description = "The homepage for the package.";
};
license = lib.options.create {
type = config.lib.types.license;
description = "The license for the package.";
};
free = lib.options.create {
type = lib.types.bool;
default.value = true;
description = "Whether the package is free.";
};
insecure = lib.options.create {
type = lib.types.bool;
default.value = false;
description = "Whether the package is insecure.";
};
broken = lib.options.create {
type = lib.types.bool;
default.value = false;
description = "Whether the package is broken.";
};
main = lib.options.create {
type = lib.types.nullish lib.types.string;
default.value = null;
description = "The main entry point for the package.";
};
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
default.value = [];
description = "The platforms the package supports.";
};
};
};
package = {
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;
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.string;
description = "The platform the package is built on.";
};
host = lib.options.create {
type = lib.types.string;
description = "The platform the package is run on.";
};
target = lib.options.create {
type = lib.types.string;
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.";
};
};
});
};
dependencies = lib.types.attrs.of (lib.types.nullish lib'.types.package);
packages = {
base = lib.types.attrs.of (lib.types.submodule {
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 {
freeform = lib.types.any;
options = {
build = lib.options.create {
type = lib.types.function lib.types.derivation;
description = "The function that creates the package derivation.";
};
};
};
};
};
}

View file

@ -1,27 +0,0 @@
{
lib,
config,
}: let
lib' = config.lib;
doubles = lib'.systems.doubles.all;
generic = builtins.removeAttrs config.packages ["targeted"];
in {
includes = [
# ./aux/foundation.nix
];
options = {
packages = lib.options.create {
default.value = {};
type = lib.types.attrs.of (lib.types.submodule {
freeform = lib.types.any;
});
};
};
config = {
packages.targeted.i686-linux = generic;
};
}

28
tidepool/README.md Normal file
View file

@ -0,0 +1,28 @@
# Aux Tidepool
Aux Tidepool is an initial package set built on top of [Aux Foundation](../foundation). Packages
are created and managed using [Aux Lib](../lib)'s module system to allow for highly dynamic and
extensible configuration.
## Usage
Packages can be imported both with and without Nix Flakes. To import them using Nix Flakes,
add this repository as an input.
```nix
inputs.tidepool.url = "https://git.auxolotl.org/auxolotl/labs/archive/main.tar.gz?dir=tidepool";
```
To import this library without using Nix Flakes, you will need to use `fetchTarball` and
import the library entrypoint.
```nix
let
labs = builtins.fetchTarball {
url = "https://git.auxolotl.org/auxolotl/labs/archive/main.tar.gz";
sha256 = "<sha256>";
};
tidepool = import "${labs}/tidepool" {};
in
# ...
```

27
tidepool/default.nix Normal file
View file

@ -0,0 +1,27 @@
{
lib ? import ./../lib,
foundation ? import ./../foundation {system = "i686-linux";},
}: let
modules = import ./src/modules.nix;
result = lib.modules.run {
modules =
(builtins.attrValues modules)
++ [
./src/export.nix
{
__file__ = ./default.nix;
options.foundation = lib.options.create {
type = lib.types.attrs.of lib.types.derivation;
};
config.foundation = foundation;
}
];
};
in
result.config.exported
// {
inherit (result) config;
}

View file

@ -8,10 +8,10 @@
},
"locked": {
"dir": "foundation",
"dirtyRev": "9c29945531c58ad81f05cd1f4958c8894a733216-dirty",
"dirtyShortRev": "9c29945-dirty",
"lastModified": 1718255029,
"narHash": "sha256-fmrDe4GfvVfXZ9lzaOt+tgBUMFCsyKr0Dlnm8aQwAXs=",
"dirtyRev": "0312e3c4cc261e2384fcf372c766a0cf245f3213-dirty",
"dirtyShortRev": "0312e3c-dirty",
"lastModified": 1718460525,
"narHash": "sha256-+ToaXY8ISWLx9AtO/CjfY/6SGuKu8A/d9ncqE4h2H20=",
"type": "git",
"url": "file:../?dir=foundation"
},
@ -24,10 +24,10 @@
"lib": {
"locked": {
"dir": "lib",
"dirtyRev": "9c29945531c58ad81f05cd1f4958c8894a733216-dirty",
"dirtyShortRev": "9c29945-dirty",
"lastModified": 1718255029,
"narHash": "sha256-fmrDe4GfvVfXZ9lzaOt+tgBUMFCsyKr0Dlnm8aQwAXs=",
"dirtyRev": "0312e3c4cc261e2384fcf372c766a0cf245f3213-dirty",
"dirtyShortRev": "0312e3c-dirty",
"lastModified": 1718460525,
"narHash": "sha256-+ToaXY8ISWLx9AtO/CjfY/6SGuKu8A/d9ncqE4h2H20=",
"type": "git",
"url": "file:../?dir=lib"
},

View file

@ -0,0 +1,80 @@
{
lib,
config,
}: let
cfg = config.builders.basic;
lib' = config.lib;
inherit (config) foundation;
in {
config.builders = {
basic = {
executable = "${foundation.stage2-bash}/bin/bash";
build = package: let
phases = package.phases;
sorted = lib.dag.sort.topographic phases;
script =
lib.strings.concatMapSep "\n" (
entry:
if builtins.isFunction entry.value
then entry.value package
else entry.value
)
sorted.result;
system = package.platform.build.double;
built = builtins.derivation (
package.env
// {
inherit (package) name;
inherit script system;
passAsFile = ["script"];
SHELL = cfg.executable;
PATH = let
bins = lib.paths.bin (
(lib'.packages.dependencies.getPackages package.deps.build.host)
++ [
foundation.stage2-bash
foundation.stage2-coreutils
]
);
in
builtins.concatStringsSep ":" ([bins] ++ (lib.lists.when (package.env ? PATH) [package.env.PATH]));
builder = cfg.executable;
args = [
"-e"
(builtins.toFile "bash-builder.sh" ''
export CONFIG_SHELL=$SHELL
# 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
# available CPU cores at run-time.
NIX_BUILD_CORES="''${NIX_BUILD_CORES:-1}"
if ((NIX_BUILD_CORES <= 0)); then
guess=$(nproc 2>/dev/null || true)
((NIX_BUILD_CORES = guess <= 0 ? 1 : guess))
fi
export NIX_BUILD_CORES
bash -eux $scriptPath
'')
];
}
);
in
built
// {
inherit (package) meta;
};
};
};
}

View file

@ -0,0 +1,18 @@
{
lib,
config,
}: let
lib' = config.lib;
in {
includes = [
./basic.nix
];
options = {
builders = lib.options.create {
description = "A set of builders that can be used to build packages.";
type = lib.types.attrs.of lib'.types.builder;
default.value = {};
};
};
}

34
tidepool/src/export.nix Normal file
View file

@ -0,0 +1,34 @@
# This file handles creating all of the exports for this project and is not
# exported itself.
{
lib,
config,
}: let
lib' = config.lib;
in {
freeform = lib.types.any;
config = {
exports = {
lib = config.lib;
modules = import ./modules.nix;
packages = {
# foundation-gcc-x86_64 =
# (config.packages.foundation.gcc.versions."13.2.0".extend (args: {
# config = {
# platform = {
# target = lib.modules.overrides.force "x86_64-linux";
# };
# };
# }))
# .config;
foundation-gcc = config.packages.foundation.gcc;
# example-x = config.packages.example.x;
# cross-example-x-x86_64-linux = config.packages.cross.x86_64-linux.example.x;
};
};
# exported.packages.i686-linux.cross-foundation-gcc-x86_64-linux = config.packages.cross.x86_64-linux.foundation.gcc.package;
};
}

View file

@ -1,6 +1,6 @@
{
config,
lib,
config,
}: let
in {
options = {

View file

@ -0,0 +1,53 @@
{
config,
lib,
}: let
lib' = config.lib;
in {
options = {
exports.packages = lib.options.create {
type = lib.types.attrs.of (lib'.types.raw);
default.value = {};
};
exported.packages = lib.options.create {
type = lib.types.attrs.of (lib.types.attrs.of lib.types.derivation);
default.value = {};
};
};
config = {
exported.packages = let
all = lib.attrs.generate lib'.systems.doubles.all (
system: let
all =
builtins.mapAttrs
(
name: package: let
result = lib'.packages.build package system system;
in
result
)
config.exports.packages;
available =
lib.attrs.filter
(name: package: builtins.elem system package.meta.platforms)
all;
packages =
builtins.mapAttrs
(name: package: package.package)
available;
in
packages
);
available =
lib.attrs.filter
(system: packages: builtins.length (builtins.attrNames packages) != 0)
all;
in
available;
};
}

View file

@ -6,6 +6,7 @@
in {
includes = [
./options.nix
./packages.nix
./systems.nix
./types.nix
];
@ -18,4 +19,8 @@ in {
apply = value: lib.extend (final: prev: prev.attrs.mergeRecursive prev value);
};
};
config = {
__module__.args.dynamic.lib' = config.lib;
};
}

View file

@ -0,0 +1,65 @@
{
lib,
lib',
config,
}: {
config = {
lib.packages = {
dependencies = {
getPackages = dependencies: let
available =
builtins.filter
(dependency: !(builtins.isNull dependency))
(builtins.attrValues dependencies);
in
builtins.map (dependency: dependency.package) available;
};
getLatest = alias: let
versions = builtins.attrNames alias.versions;
sorted = builtins.sort (lib.versions.gte) versions;
in
builtins.head sorted;
build = package: system: cross: let
resolved =
if package ? versions
then package.versions.${config.preferences.packages.version} or (package.versions.${lib'.packages.getLatest package})
else package;
buildDependencies = builtins.mapAttrs (name: dep: lib'.packages.build dep system cross);
result = resolved.extend ({config}: {
config = {
platform = {
build = system;
host = cross;
target = lib.modules.override 150 cross;
};
deps = {
build = {
only = buildDependencies resolved.deps.build.only;
build = buildDependencies resolved.deps.build.build;
host = buildDependencies resolved.deps.build.host;
target = buildDependencies resolved.deps.build.target;
};
host = {
only = buildDependencies resolved.deps.host.only;
host = buildDependencies resolved.deps.host.host;
target = buildDependencies resolved.deps.host.target;
};
target = {
only = buildDependencies resolved.deps.target.only;
target = buildDependencies resolved.deps.target.target;
};
};
package = config.builder.build config;
};
});
in
result.config;
};
};
}

View file

@ -1460,8 +1460,8 @@ in {
lib.strings.when
(kernel.name == "netbsd" && netbsdExec != kernel.exec)
kernel.exec.name;
abi = lib.strings.when (abi != types.abis.unknown) "-${abi.name}";
in "${cpu.name}-${vendor.name}-${kernelName}${exec}${abi}";
abi' = lib.strings.when (abi != types.abis.unknown) "-${abi.name}";
in "${cpu.name}-${vendor.name}-${kernelName}${exec}${abi'}";
};
create = components:
@ -1909,28 +1909,26 @@ in {
then {system = args;}
else args;
matchers = builtins.mapAttrs (name: match: match resolved.system) lib'.systems.match;
validators = builtins.mapAttrs (name: validate: validate (resolved.gcc.arch or "default")) lib'.systems.match.architecture;
platformInfo =
{
linux-kernel = settings.linux-kernel or {};
gcc = settings.gcc or {};
rustc = settings.rustc or {};
}
// lib'.systems.platforms.select resolved;
resolved =
matchers
// validators
// platformInfo
// {
{
system = lib'.systems.from.string (
if settings ? triple
then settings.triple
else settings.system
);
inherit
({
linux-kernel = settings.linux-kernel or {};
gcc = settings.gcc or {};
rustc = settings.rustc or {};
}
// lib'.systems.platforms.select resolved)
linux-kernel
gcc
rust
;
double = lib'.systems.into.double resolved.system;
triple = lib'.systems.into.triple resolved.system;
@ -2162,6 +2160,8 @@ in {
};
};
}
// builtins.mapAttrs (name: match: match resolved.system) lib'.systems.match
// builtins.mapAttrs (name: validate: validate (resolved.gcc.arch or "default")) lib'.systems.validate.architecture
// settings;
assertions =
@ -2178,7 +2178,7 @@ in {
true
(resolved.system.abi.assertions or []);
in
assert resolved.useAndroidPrebuild -> resolved.isAndroid;
assert resolved.useAndroidPrebuilt -> resolved.isAndroid;
assert assertions;
# And finally, return the generated system info.
resolved;

304
tidepool/src/lib/types.nix Normal file
View file

@ -0,0 +1,304 @@
{
lib,
lib',
config,
}: {
config = {
lib.types = {
license = let
type = lib.types.submodule ({config}: {
options = {
name = {
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;
};
};
spdx = lib.options.create {
description = "The SPDX identifier for the license.";
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);
builder = lib.types.submodule {
freeform = lib.types.any;
options = {
build = lib.options.create {
description = "The build function which takes a package definition and creates a derivation.";
type = lib.types.function lib.types.derivation;
};
};
};
packages = 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;
};
};
});
dependencies = lib.types.attrs.of (lib.types.nullish (lib.types.either lib'.types.alias lib'.types.package));
package = 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:
meta.extend {
modules =
if builtins.isAttrs value
then [{config = value;}]
else lib.lists.from.any value;
};
};
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;
};
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.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;
};
};
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;
};
};
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;
};
};
};
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 = 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 = {};
};
};
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 = {};
};
};
};
package = lib.options.create {
description = "The built derivation.";
type = lib.types.derivation;
default.value = config.builder.build config;
};
};
});
};
};
}

View file

@ -0,0 +1,5 @@
{
includes = [
./gnu.nix
];
}

View file

@ -0,0 +1,9 @@
{lib}: {
options.mirrors = {
gnu = lib.options.create {
description = "The GNU mirror to use";
type = lib.types.string;
default.value = "https://ftp.gnu.org/gnu";
};
};
}

View file

@ -1,5 +1,7 @@
{
builders = ./builders;
exports = ./exports;
lib = ./lib;
mirrors = ./mirrors;
packages = ./packages;
}

Some files were not shown because too many files have changed in this diff Show more