forked from auxolotl/labs
refactor: format all nix code
This commit is contained in:
parent
3479354ec9
commit
a707b0f06b
|
@ -1,4 +1,6 @@
|
||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env nix-shell
|
||||||
#!nix-shell -i bash -I "nixpkgs=https://github.com/nixos/nixpkgs/archive/nixos-24.05.tar.gz" -p nixfmt-rfc-style
|
#!nix-shell -i bash -I "nixpkgs=https://github.com/nixos/nixpkgs/archive/nixos-24.05.tar.gz" -p nixfmt-rfc-style
|
||||||
|
|
||||||
nixfmt ${1:-"--verify"} ./**/*.nix
|
files=$(find . -name "*.nix" -type f)
|
||||||
|
|
||||||
|
nixfmt ${1:-"--verify"} ${files}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage0 = config.aux.foundation.stages.stage0;
|
stage0 = config.aux.foundation.stages.stage0;
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.builders.bash.boot = {
|
options.aux.foundation.builders.bash.boot = {
|
||||||
build = lib.options.create {
|
build = lib.options.create {
|
||||||
type = lib.types.function lib.types.derivation;
|
type = lib.types.function lib.types.derivation;
|
||||||
|
@ -17,7 +16,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.builders.bash.boot = {
|
aux.foundation.builders.bash.boot = {
|
||||||
build = settings @ {
|
build =
|
||||||
|
settings@{
|
||||||
name,
|
name,
|
||||||
script,
|
script,
|
||||||
meta ? { },
|
meta ? { },
|
||||||
|
@ -25,9 +25,17 @@ in {
|
||||||
env ? { },
|
env ? { },
|
||||||
deps ? { },
|
deps ? { },
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
package = builtins.derivation (
|
package = builtins.derivation (
|
||||||
(builtins.removeAttrs settings ["meta" "extras" "executable" "env" "deps" "script"])
|
(builtins.removeAttrs settings [
|
||||||
|
"meta"
|
||||||
|
"extras"
|
||||||
|
"executable"
|
||||||
|
"env"
|
||||||
|
"deps"
|
||||||
|
"script"
|
||||||
|
])
|
||||||
// env
|
// env
|
||||||
// {
|
// {
|
||||||
inherit name system script;
|
inherit name system script;
|
||||||
|
@ -68,10 +76,7 @@ in {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
package
|
package // { inherit meta extras; };
|
||||||
// {
|
|
||||||
inherit meta extras;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
includes = [
|
{
|
||||||
./boot.nix
|
includes = [ ./boot.nix ];
|
||||||
];
|
|
||||||
|
|
||||||
options.aux.foundation.builders.bash = {
|
options.aux.foundation.builders.bash = {
|
||||||
build = lib.options.create {
|
build = lib.options.create {
|
||||||
|
@ -20,7 +17,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.builders.bash = {
|
aux.foundation.builders.bash = {
|
||||||
build = settings @ {
|
build =
|
||||||
|
settings@{
|
||||||
name,
|
name,
|
||||||
script,
|
script,
|
||||||
meta ? { },
|
meta ? { },
|
||||||
|
@ -28,9 +26,17 @@ in {
|
||||||
env ? { },
|
env ? { },
|
||||||
deps ? { },
|
deps ? { },
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
package = builtins.derivation (
|
package = builtins.derivation (
|
||||||
(builtins.removeAttrs settings ["meta" "extras" "executable" "env" "deps" "script"])
|
(builtins.removeAttrs settings [
|
||||||
|
"meta"
|
||||||
|
"extras"
|
||||||
|
"executable"
|
||||||
|
"env"
|
||||||
|
"deps"
|
||||||
|
"script"
|
||||||
|
])
|
||||||
// env
|
// env
|
||||||
// {
|
// {
|
||||||
inherit name system script;
|
inherit name system script;
|
||||||
|
@ -70,10 +76,7 @@ in {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
package
|
package // { inherit meta extras; };
|
||||||
// {
|
|
||||||
inherit meta extras;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
|
|
||||||
stage0 = config.aux.foundation.stages.stage0;
|
stage0 = config.aux.foundation.stages.stage0;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.builders.file.text = {
|
options.aux.foundation.builders.file.text = {
|
||||||
build = lib.options.create {
|
build = lib.options.create {
|
||||||
type = lib.types.function lib.types.derivation;
|
type = lib.types.function lib.types.derivation;
|
||||||
|
@ -15,7 +14,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.builders.file.text = {
|
aux.foundation.builders.file.text = {
|
||||||
build = settings @ {
|
build =
|
||||||
|
settings@{
|
||||||
name,
|
name,
|
||||||
contents,
|
contents,
|
||||||
isExecutable ? false,
|
isExecutable ? false,
|
||||||
|
@ -23,7 +23,8 @@ in {
|
||||||
meta ? { },
|
meta ? { },
|
||||||
extras ? { },
|
extras ? { },
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
script =
|
script =
|
||||||
''
|
''
|
||||||
target=''${out}''${destination}
|
target=''${out}''${destination}
|
||||||
|
@ -38,9 +39,19 @@ in {
|
||||||
chmod 555 ''${target}
|
chmod 555 ''${target}
|
||||||
'';
|
'';
|
||||||
package = builtins.derivation (
|
package = builtins.derivation (
|
||||||
(builtins.removeAttrs settings ["meta" "extras" "executable" "isExecutable"])
|
(builtins.removeAttrs settings [
|
||||||
|
"meta"
|
||||||
|
"extras"
|
||||||
|
"executable"
|
||||||
|
"isExecutable"
|
||||||
|
])
|
||||||
// {
|
// {
|
||||||
inherit name system destination contents;
|
inherit
|
||||||
|
name
|
||||||
|
system
|
||||||
|
destination
|
||||||
|
contents
|
||||||
|
;
|
||||||
destinationDir = builtins.dirOf destination;
|
destinationDir = builtins.dirOf destination;
|
||||||
|
|
||||||
passAsFile = [ "contents" ];
|
passAsFile = [ "contents" ];
|
||||||
|
@ -54,16 +65,11 @@ in {
|
||||||
(builtins.toFile "write-text-to-file.kaem" script)
|
(builtins.toFile "write-text-to-file.kaem" script)
|
||||||
];
|
];
|
||||||
|
|
||||||
PATH = lib.paths.bin [
|
PATH = lib.paths.bin [ stage0.mescc-tools-extra.package ];
|
||||||
stage0.mescc-tools-extra.package
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
package
|
package // { inherit meta extras; };
|
||||||
// {
|
|
||||||
inherit meta extras;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage0 = config.aux.foundation.stages.stage0;
|
stage0 = config.aux.foundation.stages.stage0;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.builders.kaem = {
|
options.aux.foundation.builders.kaem = {
|
||||||
build = lib.options.create {
|
build = lib.options.create {
|
||||||
type = lib.types.function lib.types.derivation;
|
type = lib.types.function lib.types.derivation;
|
||||||
|
@ -16,7 +15,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.builders.kaem = {
|
aux.foundation.builders.kaem = {
|
||||||
build = settings @ {
|
build =
|
||||||
|
settings@{
|
||||||
name,
|
name,
|
||||||
script,
|
script,
|
||||||
meta ? { },
|
meta ? { },
|
||||||
|
@ -24,9 +24,17 @@ in {
|
||||||
env ? { },
|
env ? { },
|
||||||
deps ? { },
|
deps ? { },
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
package = builtins.derivation (
|
package = builtins.derivation (
|
||||||
(builtins.removeAttrs settings ["meta" "extras" "executable" "env" "deps" "script"])
|
(builtins.removeAttrs settings [
|
||||||
|
"meta"
|
||||||
|
"extras"
|
||||||
|
"executable"
|
||||||
|
"env"
|
||||||
|
"deps"
|
||||||
|
"script"
|
||||||
|
])
|
||||||
// env
|
// env
|
||||||
// {
|
// {
|
||||||
inherit name system;
|
inherit name system;
|
||||||
|
@ -37,12 +45,10 @@ in {
|
||||||
"--verbose"
|
"--verbose"
|
||||||
"--strict"
|
"--strict"
|
||||||
"--file"
|
"--file"
|
||||||
(
|
(builders.file.text.build {
|
||||||
builders.file.text.build {
|
|
||||||
name = "${name}-builder";
|
name = "${name}-builder";
|
||||||
contents = script;
|
contents = script;
|
||||||
}
|
})
|
||||||
)
|
|
||||||
];
|
];
|
||||||
|
|
||||||
PATH = lib.paths.bin (
|
PATH = lib.paths.bin (
|
||||||
|
@ -56,10 +62,7 @@ in {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
package
|
package // { inherit meta extras; };
|
||||||
// {
|
|
||||||
inherit meta extras;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.builders.raw = {
|
options.aux.foundation.builders.raw = {
|
||||||
build = lib.options.create {
|
build = lib.options.create {
|
||||||
type = lib.types.function lib.types.derivation;
|
type = lib.types.function lib.types.derivation;
|
||||||
|
@ -13,7 +12,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.builders.raw = {
|
aux.foundation.builders.raw = {
|
||||||
build = settings @ {
|
build =
|
||||||
|
settings@{
|
||||||
pname,
|
pname,
|
||||||
version,
|
version,
|
||||||
executable,
|
executable,
|
||||||
|
@ -21,11 +21,21 @@ in {
|
||||||
meta ? { },
|
meta ? { },
|
||||||
extras ? { },
|
extras ? { },
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
package = builtins.derivation (
|
package = builtins.derivation (
|
||||||
(builtins.removeAttrs settings ["meta" "extras" "executable"])
|
(builtins.removeAttrs settings [
|
||||||
|
"meta"
|
||||||
|
"extras"
|
||||||
|
"executable"
|
||||||
|
])
|
||||||
// {
|
// {
|
||||||
inherit version pname system args;
|
inherit
|
||||||
|
version
|
||||||
|
pname
|
||||||
|
system
|
||||||
|
args
|
||||||
|
;
|
||||||
|
|
||||||
name = "${pname}-${version}";
|
name = "${pname}-${version}";
|
||||||
|
|
||||||
|
@ -33,10 +43,7 @@ in {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
package
|
package // { inherit meta extras; };
|
||||||
// {
|
|
||||||
inherit meta extras;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
options = {
|
options = {
|
||||||
packages = lib.options.create {
|
packages = lib.options.create {
|
||||||
default.value = { };
|
default.value = { };
|
||||||
|
@ -14,7 +12,8 @@
|
||||||
type = lib.types.attrs.any;
|
type = lib.types.attrs.any;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
exports = {
|
exports = {
|
||||||
inherit (options) packages extras;
|
inherit (options) packages extras;
|
||||||
|
@ -27,19 +26,16 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
exports.resolved = {
|
exports.resolved = {
|
||||||
packages =
|
packages = builtins.mapAttrs (
|
||||||
builtins.mapAttrs (
|
|
||||||
name: value:
|
name: value:
|
||||||
lib.attrs.filter
|
lib.attrs.filter (
|
||||||
(
|
|
||||||
name: value:
|
name: value:
|
||||||
if value ? meta && value.meta ? platforms
|
if value ? meta && value.meta ? platforms then
|
||||||
then builtins.elem config.aux.system value.meta.platforms
|
builtins.elem config.aux.system value.meta.platforms
|
||||||
else true
|
else
|
||||||
)
|
true
|
||||||
value
|
) value
|
||||||
)
|
) config.exports.packages;
|
||||||
config.exports.packages;
|
|
||||||
|
|
||||||
extras = config.exports.extras;
|
extras = config.exports.extras;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{lib}: {
|
{ lib }:
|
||||||
|
{
|
||||||
options.aux.mirrors = {
|
options.aux.mirrors = {
|
||||||
gnu = lib.options.create {
|
gnu = lib.options.create {
|
||||||
type = lib.types.string;
|
type = lib.types.string;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
|
|
||||||
parts = lib.strings.split "-" system;
|
parts = lib.strings.split "-" system;
|
||||||
|
@ -285,7 +283,8 @@
|
||||||
family = "javascript";
|
family = "javascript";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.platform = {
|
options.aux.platform = {
|
||||||
name = lib.options.create {
|
name = lib.options.create {
|
||||||
type = lib.types.string;
|
type = lib.types.string;
|
||||||
|
@ -303,7 +302,10 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
endian = lib.options.create {
|
endian = lib.options.create {
|
||||||
type = lib.types.enum ["little" "big"];
|
type = lib.types.enum [
|
||||||
|
"little"
|
||||||
|
"big"
|
||||||
|
];
|
||||||
default.value = "big";
|
default.value = "big";
|
||||||
description = "Endianess of the platform";
|
description = "Endianess of the platform";
|
||||||
};
|
};
|
||||||
|
@ -332,12 +334,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.platform =
|
aux.platform = (platforms.${platform} or (builtins.throw "Unsupported platform: ${system}")) // {
|
||||||
(
|
|
||||||
platforms.${platform}
|
|
||||||
or (builtins.throw "Unsupported platform: ${system}")
|
|
||||||
)
|
|
||||||
// {
|
|
||||||
name = platform;
|
name = platform;
|
||||||
|
|
||||||
# These will only ever have `linux` as the target since we
|
# These will only ever have `linux` as the target since we
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
|
|
||||||
architecture =
|
architecture =
|
||||||
if system == "x86_64-linux"
|
if system == "x86_64-linux" then
|
||||||
then "AMD64"
|
"AMD64"
|
||||||
else if system == "aarch64-linux"
|
else if system == "aarch64-linux" then
|
||||||
then "AArch64"
|
"AArch64"
|
||||||
else if system == "i686-linux"
|
else if system == "i686-linux" then
|
||||||
then "x86"
|
"x86"
|
||||||
else builtins.throw "Unsupported system for stage0: ${system}";
|
else
|
||||||
in {
|
builtins.throw "Unsupported system for stage0: ${system}";
|
||||||
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.architecture = {
|
options.aux.foundation.stages.stage0.architecture = {
|
||||||
base = lib.options.create {
|
base = lib.options.create {
|
||||||
type = lib.types.string;
|
type = lib.types.string;
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0;
|
cfg = config.aux.foundation.stages.stage0;
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
architecture =
|
architecture =
|
||||||
if system == "x86_64-linux"
|
if system == "x86_64-linux" then
|
||||||
then "AMD64"
|
"AMD64"
|
||||||
else if system == "aarch64-linux"
|
else if system == "aarch64-linux" then
|
||||||
then "AArch64"
|
"AArch64"
|
||||||
else if system == "i686-linux"
|
else if system == "i686-linux" then
|
||||||
then "x86"
|
"x86"
|
||||||
else builtins.throw "Unsupported system for stage0: ${system}";
|
else
|
||||||
in {
|
builtins.throw "Unsupported system for stage0: ${system}";
|
||||||
|
in
|
||||||
|
{
|
||||||
includes = [
|
includes = [
|
||||||
./sources
|
./sources
|
||||||
./architecture
|
./architecture
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.kaem;
|
cfg = config.aux.foundation.stages.stage0.kaem;
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
|
@ -10,7 +8,8 @@
|
||||||
kaem-unwrapped = config.aux.foundation.stages.stage0.kaem-unwrapped;
|
kaem-unwrapped = config.aux.foundation.stages.stage0.kaem-unwrapped;
|
||||||
mescc-tools = config.aux.foundation.stages.stage0.mescc-tools;
|
mescc-tools = config.aux.foundation.stages.stage0.mescc-tools;
|
||||||
mescc-tools-extra = config.aux.foundation.stages.stage0.mescc-tools-extra;
|
mescc-tools-extra = config.aux.foundation.stages.stage0.mescc-tools-extra;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.kaem = {
|
options.aux.foundation.stages.stage0.kaem = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -47,7 +46,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.kaem = {
|
aux.foundation.stages.stage0.kaem = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "kaem";
|
pname = "kaem";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -64,7 +64,8 @@ in {
|
||||||
|
|
||||||
kaemUnwrapped = kaem-unwrapped.package;
|
kaemUnwrapped = kaem-unwrapped.package;
|
||||||
PATH = lib.paths.bin [ mescc-tools-extra.package ];
|
PATH = lib.paths.bin [ mescc-tools-extra.package ];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.mescc-tools-extra;
|
cfg = config.aux.foundation.stages.stage0.mescc-tools-extra;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
catm = config.aux.foundation.stages.stage0.catm;
|
catm = config.aux.foundation.stages.stage0.catm;
|
||||||
|
@ -18,7 +16,8 @@
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.mescc-tools-extra = {
|
options.aux.foundation.stages.stage0.mescc-tools-extra = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -55,7 +54,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.mescc-tools-extra = {
|
aux.foundation.stages.stage0.mescc-tools-extra = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "mescc-tools-tools";
|
pname = "mescc-tools-tools";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -75,7 +75,8 @@ in {
|
||||||
m2libcOS = "linux";
|
m2libcOS = "linux";
|
||||||
m2libcArch = architecture.m2libc;
|
m2libcArch = architecture.m2libc;
|
||||||
mesccTools = mescc-tools.package;
|
mesccTools = mescc-tools.package;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.mescc-tools;
|
cfg = config.aux.foundation.stages.stage0.mescc-tools;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
catm = config.aux.foundation.stages.stage0.catm;
|
catm = config.aux.foundation.stages.stage0.catm;
|
||||||
|
@ -18,24 +16,21 @@
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
|
|
||||||
bloodFlag =
|
bloodFlag = if config.aux.platform.bits == 64 then "--64" else " ";
|
||||||
if config.aux.platform.bits == 64
|
endianFlag = if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian";
|
||||||
then "--64"
|
|
||||||
else " ";
|
|
||||||
endianFlag =
|
|
||||||
if config.aux.platform.endian == "little"
|
|
||||||
then "--little-endian"
|
|
||||||
else "--big-endian";
|
|
||||||
baseAddress =
|
baseAddress =
|
||||||
if config.aux.system == "x86_64-linux"
|
if config.aux.system == "x86_64-linux" then
|
||||||
then "0x00600000"
|
"0x00600000"
|
||||||
else if config.aux.system == "aarch64-linux"
|
else if config.aux.system == "aarch64-linux" then
|
||||||
then "0x00600000"
|
"0x00600000"
|
||||||
else if config.aux.system == "i686-linux"
|
else if config.aux.system == "i686-linux" then
|
||||||
then "0x08048000"
|
"0x08048000"
|
||||||
else builtins.throw "Unsupported system: ${config.aux.system}";
|
else
|
||||||
|
builtins.throw "Unsupported system: ${config.aux.system}";
|
||||||
|
|
||||||
getExtraUtil = name: let
|
getExtraUtil =
|
||||||
|
name:
|
||||||
|
let
|
||||||
script = builtins.toFile "build-${name}.kaem" ''
|
script = builtins.toFile "build-${name}.kaem" ''
|
||||||
''${M2} --architecture ${architecture.m2libc} \
|
''${M2} --architecture ${architecture.m2libc} \
|
||||||
-f ''${m2libc}/sys/types.h \
|
-f ''${m2libc}/sys/types.h \
|
||||||
|
@ -104,7 +99,8 @@
|
||||||
endianFlag = endianFlag;
|
endianFlag = endianFlag;
|
||||||
baseAddress = baseAddress;
|
baseAddress = baseAddress;
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.mescc-tools = {
|
options.aux.foundation.stages.stage0.mescc-tools = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -141,7 +137,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.mescc-tools = {
|
aux.foundation.stages.stage0.mescc-tools = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "mescc-tools";
|
pname = "mescc-tools";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -176,7 +173,8 @@ in {
|
||||||
cp = getExtraUtil "cp";
|
cp = getExtraUtil "cp";
|
||||||
chmod = getExtraUtil "chmod";
|
chmod = getExtraUtil "chmod";
|
||||||
replace = getExtraUtil "replace";
|
replace = getExtraUtil "replace";
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.hex0;
|
cfg = config.aux.foundation.stages.stage0.hex0;
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
|
@ -9,14 +7,16 @@
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
|
||||||
architecture =
|
architecture =
|
||||||
if system == "x86_64-linux"
|
if system == "x86_64-linux" then
|
||||||
then "AMD64"
|
"AMD64"
|
||||||
else if system == "aarch64-linux"
|
else if system == "aarch64-linux" then
|
||||||
then "AArch64"
|
"AArch64"
|
||||||
else if system == "i686-linux"
|
else if system == "i686-linux" then
|
||||||
then "x86"
|
"x86"
|
||||||
else builtins.throw "Unsupported system for stage0: ${system}";
|
else
|
||||||
in {
|
builtins.throw "Unsupported system for stage0: ${system}";
|
||||||
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.hex0 = {
|
options.aux.foundation.stages.stage0.hex0 = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -66,7 +66,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.hex0 = {
|
aux.foundation.stages.stage0.hex0 = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "hex0";
|
pname = "hex0";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -82,24 +83,28 @@ in {
|
||||||
outputHashMode = "recursive";
|
outputHashMode = "recursive";
|
||||||
outputHashAlgo = "sha256";
|
outputHashAlgo = "sha256";
|
||||||
outputHash = cfg.hash;
|
outputHash = cfg.hash;
|
||||||
});
|
}
|
||||||
|
|
||||||
hash = lib.modules.overrides.default (
|
|
||||||
if system == "x86_64-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> {
|
hash = lib.modules.overrides.default (
|
||||||
|
if system == "x86_64-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";
|
name = "hex0-seed";
|
||||||
url = "https://github.com/oriansj/bootstrap-seeds/raw/b1263ff14a17835f4d12539226208c426ced4fba/POSIX/${architecture}/hex0-seed";
|
url = "https://github.com/oriansj/bootstrap-seeds/raw/b1263ff14a17835f4d12539226208c426ced4fba/POSIX/${architecture}/hex0-seed";
|
||||||
executable = true;
|
executable = true;
|
||||||
hash = cfg.hash;
|
hash = cfg.hash;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.hex1;
|
cfg = config.aux.foundation.stages.stage0.hex1;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
|
|
||||||
|
@ -9,7 +7,8 @@
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.hex1 = {
|
options.aux.foundation.stages.stage0.hex1 = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -46,7 +45,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.hex1 = {
|
aux.foundation.stages.stage0.hex1 = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "hex1";
|
pname = "hex1";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -58,7 +58,8 @@ in {
|
||||||
"${sources.base}/hex1_${architecture.base}.hex0"
|
"${sources.base}/hex1_${architecture.base}.hex0"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.hex2-0;
|
cfg = config.aux.foundation.stages.stage0.hex2-0;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
hex1 = config.aux.foundation.stages.stage0.hex1;
|
hex1 = config.aux.foundation.stages.stage0.hex1;
|
||||||
|
@ -10,7 +8,8 @@
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.hex2-0 = {
|
options.aux.foundation.stages.stage0.hex2-0 = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -47,7 +46,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.hex2-0 = {
|
aux.foundation.stages.stage0.hex2-0 = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "hex2-0";
|
pname = "hex2-0";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -59,7 +59,8 @@ in {
|
||||||
"${sources.base}/hex2_${architecture.base}.hex1"
|
"${sources.base}/hex2_${architecture.base}.hex1"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.catm;
|
cfg = config.aux.foundation.stages.stage0.catm;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
hex1 = config.aux.foundation.stages.stage0.hex1;
|
hex1 = config.aux.foundation.stages.stage0.hex1;
|
||||||
|
@ -11,7 +9,8 @@
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.catm = {
|
options.aux.foundation.stages.stage0.catm = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -48,28 +47,28 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.catm = {
|
aux.foundation.stages.stage0.catm = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "catm";
|
pname = "catm";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
meta = cfg.meta;
|
meta = cfg.meta;
|
||||||
|
|
||||||
executable =
|
executable = if architecture.base == "AArch64" then hex1.package else hex2-0.package;
|
||||||
if architecture.base == "AArch64"
|
|
||||||
then hex1.package
|
|
||||||
else hex2-0.package;
|
|
||||||
|
|
||||||
args =
|
args =
|
||||||
if architecture.base == "AArch64"
|
if architecture.base == "AArch64" then
|
||||||
then [
|
[
|
||||||
"${sources.base}/catm_${architecture.base}.hex1"
|
"${sources.base}/catm_${architecture.base}.hex1"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
]
|
]
|
||||||
else [
|
else
|
||||||
|
[
|
||||||
"${sources.base}/catm_${architecture.base}.hex2"
|
"${sources.base}/catm_${architecture.base}.hex2"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.M0;
|
cfg = config.aux.foundation.stages.stage0.M0;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||||
|
@ -11,7 +9,8 @@
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.M0 = {
|
options.aux.foundation.stages.stage0.M0 = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -48,7 +47,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.M0 = {
|
aux.foundation.stages.stage0.M0 = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "M0";
|
pname = "M0";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -56,7 +56,8 @@ in {
|
||||||
|
|
||||||
executable = hex2-0.package;
|
executable = hex2-0.package;
|
||||||
|
|
||||||
args = let
|
args =
|
||||||
|
let
|
||||||
M0_hex2-0 = builders.raw.build {
|
M0_hex2-0 = builders.raw.build {
|
||||||
pname = "M0_hex2-0";
|
pname = "M0_hex2-0";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
@ -71,11 +72,13 @@ in {
|
||||||
"${sources.base}/M0_${architecture.base}.hex2"
|
"${sources.base}/M0_${architecture.base}.hex2"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
M0_hex2-0
|
M0_hex2-0
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.cc_arch;
|
cfg = config.aux.foundation.stages.stage0.cc_arch;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||||
|
@ -12,7 +10,8 @@
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.cc_arch = {
|
options.aux.foundation.stages.stage0.cc_arch = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -49,7 +48,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.cc_arch = {
|
aux.foundation.stages.stage0.cc_arch = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "cc_arch";
|
pname = "cc_arch";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -57,7 +57,8 @@ in {
|
||||||
|
|
||||||
executable = hex2-0.package;
|
executable = hex2-0.package;
|
||||||
|
|
||||||
args = let
|
args =
|
||||||
|
let
|
||||||
cc_arch0_hex2-0 = builders.raw.build {
|
cc_arch0_hex2-0 = builders.raw.build {
|
||||||
pname = "cc_arch0_hex2-0";
|
pname = "cc_arch0_hex2-0";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
@ -85,11 +86,13 @@ in {
|
||||||
cc_arch0_hex2-0
|
cc_arch0_hex2-0
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
cc_arch1_hex2-0
|
cc_arch1_hex2-0
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.M2;
|
cfg = config.aux.foundation.stages.stage0.M2;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||||
|
@ -13,7 +11,8 @@
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.M2 = {
|
options.aux.foundation.stages.stage0.M2 = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -50,7 +49,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.M2 = {
|
aux.foundation.stages.stage0.M2 = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "M2";
|
pname = "M2";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -58,7 +58,8 @@ in {
|
||||||
|
|
||||||
executable = hex2-0.package;
|
executable = hex2-0.package;
|
||||||
|
|
||||||
args = let
|
args =
|
||||||
|
let
|
||||||
M2_c = builders.raw.build {
|
M2_c = builders.raw.build {
|
||||||
pname = "M2_c";
|
pname = "M2_c";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
@ -136,11 +137,13 @@ in {
|
||||||
M2_hex2-0
|
M2_hex2-0
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
M2_hex2-0'
|
M2_hex2-0'
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.blood-elf;
|
cfg = config.aux.foundation.stages.stage0.blood-elf;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||||
|
@ -14,7 +12,8 @@
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.blood-elf = {
|
options.aux.foundation.stages.stage0.blood-elf = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -51,7 +50,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.blood-elf = {
|
aux.foundation.stages.stage0.blood-elf = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "blood-elf";
|
pname = "blood-elf";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -59,7 +59,8 @@ in {
|
||||||
|
|
||||||
executable = hex2-0.package;
|
executable = hex2-0.package;
|
||||||
|
|
||||||
args = let
|
args =
|
||||||
|
let
|
||||||
blood-elf_M1 = builders.raw.build {
|
blood-elf_M1 = builders.raw.build {
|
||||||
pname = "blood-elf_M1";
|
pname = "blood-elf_M1";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
@ -126,11 +127,13 @@ in {
|
||||||
blood-elf_hex2-0
|
blood-elf_hex2-0
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
blood-elf_hex2-0'
|
blood-elf_hex2-0'
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.M1-0;
|
cfg = config.aux.foundation.stages.stage0.M1-0;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||||
|
@ -15,7 +13,8 @@
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.M1-0 = {
|
options.aux.foundation.stages.stage0.M1-0 = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -52,7 +51,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.M1-0 = {
|
aux.foundation.stages.stage0.M1-0 = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "M1-0";
|
pname = "M1-0";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -60,7 +60,8 @@ in {
|
||||||
|
|
||||||
executable = hex2-0.package;
|
executable = hex2-0.package;
|
||||||
|
|
||||||
args = let
|
args =
|
||||||
|
let
|
||||||
M1-macro-0_M1 = builders.raw.build {
|
M1-macro-0_M1 = builders.raw.build {
|
||||||
pname = "M1-macro-0_M1";
|
pname = "M1-macro-0_M1";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
@ -94,16 +95,10 @@ in {
|
||||||
|
|
||||||
executable = blood-elf.package;
|
executable = blood-elf.package;
|
||||||
|
|
||||||
args =
|
args = (lib.lists.when (config.aux.platform.bits == 64) "--64") ++ [
|
||||||
(lib.lists.when (config.aux.platform.bits == 64) "--64")
|
|
||||||
++ [
|
|
||||||
"-f"
|
"-f"
|
||||||
M1-macro-0_M1
|
M1-macro-0_M1
|
||||||
(
|
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||||
if config.aux.platform.endian == "little"
|
|
||||||
then "--little-endian"
|
|
||||||
else "--big-endian"
|
|
||||||
)
|
|
||||||
"-o"
|
"-o"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
|
@ -151,11 +146,13 @@ in {
|
||||||
M1-macro-0_hex2-0
|
M1-macro-0_hex2-0
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
M1-macro-0_hex2-0'
|
M1-macro-0_hex2-0'
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.hex2-1;
|
cfg = config.aux.foundation.stages.stage0.hex2-1;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||||
|
@ -16,7 +14,8 @@
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.hex2-1 = {
|
options.aux.foundation.stages.stage0.hex2-1 = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -53,7 +52,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.hex2-1 = {
|
aux.foundation.stages.stage0.hex2-1 = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "hex2-1";
|
pname = "hex2-1";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -61,7 +61,8 @@ in {
|
||||||
|
|
||||||
executable = hex2-0.package;
|
executable = hex2-0.package;
|
||||||
|
|
||||||
args = let
|
args =
|
||||||
|
let
|
||||||
hex2_linker_M1 = builders.raw.build {
|
hex2_linker_M1 = builders.raw.build {
|
||||||
pname = "hex2_linker_M1";
|
pname = "hex2_linker_M1";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
@ -114,16 +115,10 @@ in {
|
||||||
|
|
||||||
executable = blood-elf.package;
|
executable = blood-elf.package;
|
||||||
|
|
||||||
args =
|
args = (lib.lists.when (config.aux.platform.bits == 64) "--64") ++ [
|
||||||
(lib.lists.when (config.aux.platform.bits == 64) "--64")
|
|
||||||
++ [
|
|
||||||
"-f"
|
"-f"
|
||||||
hex2_linker_M1
|
hex2_linker_M1
|
||||||
(
|
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||||
if config.aux.platform.endian == "little"
|
|
||||||
then "--little-endian"
|
|
||||||
else "--big-endian"
|
|
||||||
)
|
|
||||||
"-o"
|
"-o"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
|
@ -139,11 +134,7 @@ in {
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
architecture.m2libc
|
architecture.m2libc
|
||||||
(
|
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||||
if config.aux.platform.endian == "little"
|
|
||||||
then "--little-endian"
|
|
||||||
else "--big-endian"
|
|
||||||
)
|
|
||||||
"-f"
|
"-f"
|
||||||
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||||
"-f"
|
"-f"
|
||||||
|
@ -170,11 +161,13 @@ in {
|
||||||
hex2_linker_hex2
|
hex2_linker_hex2
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
hex2_linker_hex2'
|
hex2_linker_hex2'
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.M1;
|
cfg = config.aux.foundation.stages.stage0.M1;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||||
|
@ -17,7 +15,8 @@
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.M1 = {
|
options.aux.foundation.stages.stage0.M1 = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -54,7 +53,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.M1 = {
|
aux.foundation.stages.stage0.M1 = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "M1";
|
pname = "M1";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -62,7 +62,8 @@ in {
|
||||||
|
|
||||||
executable = hex2-1.package;
|
executable = hex2-1.package;
|
||||||
|
|
||||||
args = let
|
args =
|
||||||
|
let
|
||||||
M1-macro_M1 = builders.raw.build {
|
M1-macro_M1 = builders.raw.build {
|
||||||
pname = "M1-macro_M1";
|
pname = "M1-macro_M1";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
@ -113,16 +114,10 @@ in {
|
||||||
|
|
||||||
executable = blood-elf.package;
|
executable = blood-elf.package;
|
||||||
|
|
||||||
args =
|
args = (lib.lists.when (config.aux.platform.bits == 64) "--64") ++ [
|
||||||
(lib.lists.when (config.aux.platform.bits == 64) "--64")
|
|
||||||
++ [
|
|
||||||
"-f"
|
"-f"
|
||||||
M1-macro_M1
|
M1-macro_M1
|
||||||
(
|
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||||
if config.aux.platform.endian == "little"
|
|
||||||
then "--little-endian"
|
|
||||||
else "--big-endian"
|
|
||||||
)
|
|
||||||
"-o"
|
"-o"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
|
@ -138,11 +133,7 @@ in {
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
architecture.m2libc
|
architecture.m2libc
|
||||||
(
|
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||||
if config.aux.platform.endian == "little"
|
|
||||||
then "--little-endian"
|
|
||||||
else "--big-endian"
|
|
||||||
)
|
|
||||||
"-f"
|
"-f"
|
||||||
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||||
"-f"
|
"-f"
|
||||||
|
@ -155,23 +146,21 @@ in {
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
"--architecture"
|
"--architecture"
|
||||||
architecture.m2libc
|
architecture.m2libc
|
||||||
(
|
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||||
if config.aux.platform.endian == "little"
|
|
||||||
then "--little-endian"
|
|
||||||
else "--big-endian"
|
|
||||||
)
|
|
||||||
"--base-address"
|
"--base-address"
|
||||||
(
|
(
|
||||||
if config.aux.system == "x86_64-linux"
|
if config.aux.system == "x86_64-linux" then
|
||||||
then "0x00600000"
|
"0x00600000"
|
||||||
else if config.aux.system == "aarch64-linux"
|
else if config.aux.system == "aarch64-linux" then
|
||||||
then "0x00600000"
|
"0x00600000"
|
||||||
else if config.aux.system == "i686-linux"
|
else if config.aux.system == "i686-linux" then
|
||||||
then "0x08048000"
|
"0x08048000"
|
||||||
else builtins.throw "Unsupported system: ${config.aux.system}"
|
else
|
||||||
|
builtins.throw "Unsupported system: ${config.aux.system}"
|
||||||
)
|
)
|
||||||
"-f"
|
"-f"
|
||||||
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
||||||
|
@ -180,7 +169,8 @@ in {
|
||||||
"-o"
|
"-o"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.hex2;
|
cfg = config.aux.foundation.stages.stage0.hex2;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
catm = config.aux.foundation.stages.stage0.catm;
|
catm = config.aux.foundation.stages.stage0.catm;
|
||||||
|
@ -16,7 +14,8 @@
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.hex2 = {
|
options.aux.foundation.stages.stage0.hex2 = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -53,7 +52,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.hex2 = {
|
aux.foundation.stages.stage0.hex2 = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "hex2";
|
pname = "hex2";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -61,7 +61,8 @@ in {
|
||||||
|
|
||||||
executable = hex2-1.package;
|
executable = hex2-1.package;
|
||||||
|
|
||||||
args = let
|
args =
|
||||||
|
let
|
||||||
hex2_linker_M1 = builders.raw.build {
|
hex2_linker_M1 = builders.raw.build {
|
||||||
pname = "hex2_linker_M1";
|
pname = "hex2_linker_M1";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
@ -114,16 +115,10 @@ in {
|
||||||
|
|
||||||
executable = blood-elf.package;
|
executable = blood-elf.package;
|
||||||
|
|
||||||
args =
|
args = (lib.lists.when (config.aux.platform.bits == 64) "--64") ++ [
|
||||||
(lib.lists.when (config.aux.platform.bits == 64) "--64")
|
|
||||||
++ [
|
|
||||||
"-f"
|
"-f"
|
||||||
hex2_linker_M1
|
hex2_linker_M1
|
||||||
(
|
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||||
if config.aux.platform.endian == "little"
|
|
||||||
then "--little-endian"
|
|
||||||
else "--big-endian"
|
|
||||||
)
|
|
||||||
"-o"
|
"-o"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
|
@ -139,11 +134,7 @@ in {
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
architecture.m2libc
|
architecture.m2libc
|
||||||
(
|
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||||
if config.aux.platform.endian == "little"
|
|
||||||
then "--little-endian"
|
|
||||||
else "--big-endian"
|
|
||||||
)
|
|
||||||
"-f"
|
"-f"
|
||||||
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||||
"-f"
|
"-f"
|
||||||
|
@ -156,23 +147,21 @@ in {
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
"--architecture"
|
"--architecture"
|
||||||
architecture.m2libc
|
architecture.m2libc
|
||||||
(
|
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||||
if config.aux.platform.endian == "little"
|
|
||||||
then "--little-endian"
|
|
||||||
else "--big-endian"
|
|
||||||
)
|
|
||||||
"--base-address"
|
"--base-address"
|
||||||
(
|
(
|
||||||
if config.aux.system == "x86_64-linux"
|
if config.aux.system == "x86_64-linux" then
|
||||||
then "0x00600000"
|
"0x00600000"
|
||||||
else if config.aux.system == "aarch64-linux"
|
else if config.aux.system == "aarch64-linux" then
|
||||||
then "0x00600000"
|
"0x00600000"
|
||||||
else if config.aux.system == "i686-linux"
|
else if config.aux.system == "i686-linux" then
|
||||||
then "0x08048000"
|
"0x08048000"
|
||||||
else builtins.throw "Unsupported system: ${config.aux.system}"
|
else
|
||||||
|
builtins.throw "Unsupported system: ${config.aux.system}"
|
||||||
)
|
)
|
||||||
"-f"
|
"-f"
|
||||||
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
||||||
|
@ -181,7 +170,8 @@ in {
|
||||||
"-o"
|
"-o"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage0.kaem-unwrapped;
|
cfg = config.aux.foundation.stages.stage0.kaem-unwrapped;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||||
catm = config.aux.foundation.stages.stage0.catm;
|
catm = config.aux.foundation.stages.stage0.catm;
|
||||||
|
@ -16,7 +14,8 @@
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
sources = config.aux.foundation.stages.stage0.sources;
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.kaem-unwrapped = {
|
options.aux.foundation.stages.stage0.kaem-unwrapped = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -53,7 +52,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage0.kaem-unwrapped = {
|
aux.foundation.stages.stage0.kaem-unwrapped = {
|
||||||
package = lib.modules.overrides.default (builders.raw.build {
|
package = lib.modules.overrides.default (
|
||||||
|
builders.raw.build {
|
||||||
pname = "kaem-unwrapped";
|
pname = "kaem-unwrapped";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
|
@ -61,7 +61,8 @@ in {
|
||||||
|
|
||||||
executable = hex2.package;
|
executable = hex2.package;
|
||||||
|
|
||||||
args = let
|
args =
|
||||||
|
let
|
||||||
kaem_M1 = builders.raw.build {
|
kaem_M1 = builders.raw.build {
|
||||||
pname = "kaem_M1";
|
pname = "kaem_M1";
|
||||||
version = "1.6.0";
|
version = "1.6.0";
|
||||||
|
@ -116,16 +117,10 @@ in {
|
||||||
|
|
||||||
executable = blood-elf.package;
|
executable = blood-elf.package;
|
||||||
|
|
||||||
args =
|
args = (lib.lists.when (config.aux.platform.bits == 64) "--64") ++ [
|
||||||
(lib.lists.when (config.aux.platform.bits == 64) "--64")
|
|
||||||
++ [
|
|
||||||
"-f"
|
"-f"
|
||||||
kaem_M1
|
kaem_M1
|
||||||
(
|
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||||
if config.aux.platform.endian == "little"
|
|
||||||
then "--little-endian"
|
|
||||||
else "--big-endian"
|
|
||||||
)
|
|
||||||
"-o"
|
"-o"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
|
@ -141,11 +136,7 @@ in {
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
architecture.m2libc
|
architecture.m2libc
|
||||||
(
|
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||||
if config.aux.platform.endian == "little"
|
|
||||||
then "--little-endian"
|
|
||||||
else "--big-endian"
|
|
||||||
)
|
|
||||||
"-f"
|
"-f"
|
||||||
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||||
"-f"
|
"-f"
|
||||||
|
@ -158,23 +149,21 @@ in {
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
"--architecture"
|
"--architecture"
|
||||||
architecture.m2libc
|
architecture.m2libc
|
||||||
(
|
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||||
if config.aux.platform.endian == "little"
|
|
||||||
then "--little-endian"
|
|
||||||
else "--big-endian"
|
|
||||||
)
|
|
||||||
"--base-address"
|
"--base-address"
|
||||||
(
|
(
|
||||||
if config.aux.system == "x86_64-linux"
|
if config.aux.system == "x86_64-linux" then
|
||||||
then "0x00600000"
|
"0x00600000"
|
||||||
else if config.aux.system == "aarch64-linux"
|
else if config.aux.system == "aarch64-linux" then
|
||||||
then "0x00600000"
|
"0x00600000"
|
||||||
else if config.aux.system == "i686-linux"
|
else if config.aux.system == "i686-linux" then
|
||||||
then "0x08048000"
|
"0x08048000"
|
||||||
else builtins.throw "Unsupported system: ${config.aux.system}"
|
else
|
||||||
|
builtins.throw "Unsupported system: ${config.aux.system}"
|
||||||
)
|
)
|
||||||
"-f"
|
"-f"
|
||||||
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
||||||
|
@ -183,7 +172,8 @@ in {
|
||||||
"-o"
|
"-o"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
|
|
||||||
architecture = config.aux.foundation.stages.stage0.architecture.base;
|
architecture = config.aux.foundation.stages.stage0.architecture.base;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage0.sources = {
|
options.aux.foundation.stages.stage0.sources = {
|
||||||
base = lib.options.create {
|
base = lib.options.create {
|
||||||
type = lib.types.string;
|
type = lib.types.string;
|
||||||
|
@ -44,27 +43,25 @@ in {
|
||||||
# fetching that, we are instead fetching each submodule directly. The central repository is located
|
# fetching that, we are instead fetching each submodule directly. The central repository is located
|
||||||
# here: https://github.com/oriansj/stage0-posix
|
# here: https://github.com/oriansj/stage0-posix
|
||||||
base =
|
base =
|
||||||
if architecture == "AMD64"
|
if architecture == "AMD64" then
|
||||||
then
|
|
||||||
builtins.fetchTarball {
|
builtins.fetchTarball {
|
||||||
url = "https://github.com/oriansj/stage0-posix-amd64/archive/93fbe4c08772d8df1412e2554668e24cf604088c.tar.gz";
|
url = "https://github.com/oriansj/stage0-posix-amd64/archive/93fbe4c08772d8df1412e2554668e24cf604088c.tar.gz";
|
||||||
sha256 = "10d1xnjzqplpfip3pm89bydd501x1bcgkg7lkkadyq5bqpad5flp";
|
sha256 = "10d1xnjzqplpfip3pm89bydd501x1bcgkg7lkkadyq5bqpad5flp";
|
||||||
}
|
}
|
||||||
else if architecture == "AArch64"
|
else if architecture == "AArch64" then
|
||||||
then
|
|
||||||
# FIXME: We may need to patch the aarch64 variant.
|
# FIXME: We may need to patch the aarch64 variant.
|
||||||
# https://github.com/oriansj/M2libc/pull/17
|
# https://github.com/oriansj/M2libc/pull/17
|
||||||
builtins.fetchTarball {
|
builtins.fetchTarball {
|
||||||
url = "https://github.com/oriansj/stage0-posix-aarch64/archive/39a43f803d572b53f95d42507202152eeda18361.tar.gz";
|
url = "https://github.com/oriansj/stage0-posix-aarch64/archive/39a43f803d572b53f95d42507202152eeda18361.tar.gz";
|
||||||
sha256 = "1x607hr3n5j89394d156r23igpx8hifjd14ygksx7902rlwrrry2";
|
sha256 = "1x607hr3n5j89394d156r23igpx8hifjd14ygksx7902rlwrrry2";
|
||||||
}
|
}
|
||||||
else if architecture == "x86"
|
else if architecture == "x86" then
|
||||||
then
|
|
||||||
builtins.fetchTarball {
|
builtins.fetchTarball {
|
||||||
url = "https://github.com/oriansj/stage0-posix-x86/archive/e86bf7d304bae5ce5ccc88454bb60cf0837e941f.tar.gz";
|
url = "https://github.com/oriansj/stage0-posix-x86/archive/e86bf7d304bae5ce5ccc88454bb60cf0837e941f.tar.gz";
|
||||||
sha256 = "1c1fk793yzq8zbg60n2zd22fsmirc3zr26fj0iskap456g84nxv8";
|
sha256 = "1c1fk793yzq8zbg60n2zd22fsmirc3zr26fj0iskap456g84nxv8";
|
||||||
}
|
}
|
||||||
else builtins.throw "Unsupported architecture for stage0: ${architecture}";
|
else
|
||||||
|
builtins.throw "Unsupported architecture for stage0: ${architecture}";
|
||||||
|
|
||||||
m2libc = builtins.fetchTarball {
|
m2libc = builtins.fetchTarball {
|
||||||
url = "https://github.com/oriansj/M2libc/archive/de7c75f144176c3b9be77695d9bf94440445aeae.tar.gz";
|
url = "https://github.com/oriansj/M2libc/archive/de7c75f144176c3b9be77695d9bf94440445aeae.tar.gz";
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.bash.boot;
|
cfg = config.aux.foundation.stages.stage1.bash.boot;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.bash.boot = {
|
options.aux.foundation.stages.stage1.bash.boot = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -61,7 +60,8 @@ in {
|
||||||
sha256 = "1r1z2qdw3rz668nxrzwa14vk2zcn00hw7mpjn384picck49d80xs";
|
sha256 = "1r1z2qdw3rz668nxrzwa14vk2zcn00hw7mpjn384picck49d80xs";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
# Thanks to the live-bootstrap project!
|
# Thanks to the live-bootstrap project!
|
||||||
# See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/bash-2.05b/bash-2.05b.kaem
|
# See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/bash-2.05b/bash-2.05b.kaem
|
||||||
liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/bash-2.05b";
|
liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/bash-2.05b";
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.bash;
|
cfg = config.aux.foundation.stages.stage1.bash;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
includes = [
|
{
|
||||||
./boot.nix
|
includes = [ ./boot.nix ];
|
||||||
];
|
|
||||||
|
|
||||||
options.aux.foundation.stages.stage1.bash = {
|
options.aux.foundation.stages.stage1.bash = {
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -72,7 +69,8 @@ in {
|
||||||
sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk";
|
sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
patches = [
|
patches = [
|
||||||
# flush output for generated code
|
# flush output for generated code
|
||||||
./patches/mksignames-flush.patch
|
./patches/mksignames-flush.patch
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.binutils;
|
cfg = config.aux.foundation.stages.stage1.binutils;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.binutils = {
|
options.aux.foundation.stages.stage1.binutils = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -62,7 +61,8 @@ in {
|
||||||
sha256 = "rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA=";
|
sha256 = "rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
patches = [
|
patches = [
|
||||||
# Make binutils output deterministic by default.
|
# Make binutils output deterministic by default.
|
||||||
./patches/deterministic.patch
|
./patches/deterministic.patch
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.bison;
|
cfg = config.aux.foundation.stages.stage1.bison;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.bison = {
|
options.aux.foundation.stages.stage1.bison = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.bzip2;
|
cfg = config.aux.foundation.stages.stage1.bzip2;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.bzip2 = {
|
options.aux.foundation.stages.stage1.bzip2 = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.coreutils.boot;
|
cfg = config.aux.foundation.stages.stage1.coreutils.boot;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.coreutils.boot = {
|
options.aux.foundation.stages.stage1.coreutils.boot = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
@ -34,7 +33,8 @@ in {
|
||||||
sha256 = "10wq6k66i8adr4k08p0xmg87ff4ypiazvwzlmi7myib27xgffz62";
|
sha256 = "10wq6k66i8adr4k08p0xmg87ff4ypiazvwzlmi7myib27xgffz62";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
# Thanks to the live-bootstrap project!
|
# Thanks to the live-bootstrap project!
|
||||||
# See https://github.com/fosslinux/live-bootstrap/blob/a8752029f60217a5c41c548b16f5cdd2a1a0e0db/sysa/coreutils-5.0/coreutils-5.0.kaem
|
# See https://github.com/fosslinux/live-bootstrap/blob/a8752029f60217a5c41c548b16f5cdd2a1a0e0db/sysa/coreutils-5.0/coreutils-5.0.kaem
|
||||||
liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/a8752029f60217a5c41c548b16f5cdd2a1a0e0db/sysa/coreutils-5.0";
|
liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/a8752029f60217a5c41c548b16f5cdd2a1a0e0db/sysa/coreutils-5.0";
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.coreutils;
|
cfg = config.aux.foundation.stages.stage1.coreutils;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
includes = [
|
{
|
||||||
./boot.nix
|
includes = [ ./boot.nix ];
|
||||||
];
|
|
||||||
|
|
||||||
options.aux.foundation.stages.stage1.coreutils = {
|
options.aux.foundation.stages.stage1.coreutils = {
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -66,7 +63,8 @@ in {
|
||||||
sha256 = "X2ANkJOXOwr+JTk9m8GMRPIjJlf0yg2V6jHHAutmtzk=";
|
sha256 = "X2ANkJOXOwr+JTk9m8GMRPIjJlf0yg2V6jHHAutmtzk=";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"--prefix=${builtins.placeholder "out"}"
|
"--prefix=${builtins.placeholder "out"}"
|
||||||
"--build=${platform.build}"
|
"--build=${platform.build}"
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1;
|
cfg = config.aux.foundation.stages.stage1;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
includes = [
|
includes = [
|
||||||
./nyacc
|
./nyacc
|
||||||
./mes
|
./mes
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.diffutils;
|
cfg = config.aux.foundation.stages.stage1.diffutils;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.diffutils = {
|
options.aux.foundation.stages.stage1.diffutils = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.findutils;
|
cfg = config.aux.foundation.stages.stage1.findutils;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.findutils = {
|
options.aux.foundation.stages.stage1.findutils = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gawk.boot;
|
cfg = config.aux.foundation.stages.stage1.gawk.boot;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.gawk.boot = {
|
options.aux.foundation.stages.stage1.gawk.boot = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
@ -35,7 +34,8 @@ in {
|
||||||
sha256 = "1z4bibjm7ldvjwq3hmyifyb429rs2d9bdwkvs0r171vv1khpdwmb";
|
sha256 = "1z4bibjm7ldvjwq3hmyifyb429rs2d9bdwkvs0r171vv1khpdwmb";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
patches = [
|
patches = [
|
||||||
# for reproducibility don't generate date stamp
|
# for reproducibility don't generate date stamp
|
||||||
./patches/no-stamp.patch
|
./patches/no-stamp.patch
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gawk;
|
cfg = config.aux.foundation.stages.stage1.gawk;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
includes = [
|
{
|
||||||
./boot.nix
|
includes = [ ./boot.nix ];
|
||||||
];
|
|
||||||
|
|
||||||
options.aux.foundation.stages.stage1.gawk = {
|
options.aux.foundation.stages.stage1.gawk = {
|
||||||
meta = {
|
meta = {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gcc;
|
cfg = config.aux.foundation.stages.stage1.gcc;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
includes = [
|
includes = [
|
||||||
./v4.6.nix
|
./v4.6.nix
|
||||||
./v4.6.cxx.nix
|
./v4.6.cxx.nix
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gcc.v46.cxx;
|
cfg = config.aux.foundation.stages.stage1.gcc.v46.cxx;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.gcc.v46.cxx = {
|
options.aux.foundation.stages.stage1.gcc.v46.cxx = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
@ -112,7 +111,8 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
patches = [
|
patches = [
|
||||||
# Remove hardcoded NATIVE_SYSTEM_HEADER_DIR
|
# Remove hardcoded NATIVE_SYSTEM_HEADER_DIR
|
||||||
./patches/no-system-headers.patch
|
./patches/no-system-headers.patch
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gcc.v46;
|
cfg = config.aux.foundation.stages.stage1.gcc.v46;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.gcc.v46 = {
|
options.aux.foundation.stages.stage1.gcc.v46 = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
@ -112,7 +111,8 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
patches = [
|
patches = [
|
||||||
# Remove hardcoded NATIVE_SYSTEM_HEADER_DIR
|
# Remove hardcoded NATIVE_SYSTEM_HEADER_DIR
|
||||||
./patches/no-system-headers.patch
|
./patches/no-system-headers.patch
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gcc.v8;
|
cfg = config.aux.foundation.stages.stage1.gcc.v8;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.gcc.v8 = {
|
options.aux.foundation.stages.stage1.gcc.v8 = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gnugrep;
|
cfg = config.aux.foundation.stages.stage1.gnugrep;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.gnugrep = {
|
options.aux.foundation.stages.stage1.gnugrep = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -67,7 +66,8 @@ in {
|
||||||
sha256 = "05iayw5sfclc476vpviz67hdy03na0pz2kb5csa50232nfx34853";
|
sha256 = "05iayw5sfclc476vpviz67hdy03na0pz2kb5csa50232nfx34853";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
# Thanks to the live-bootstrap project!
|
# Thanks to the live-bootstrap project!
|
||||||
# See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/grep-2.4
|
# See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/grep-2.4
|
||||||
makefile = builtins.fetchurl {
|
makefile = builtins.fetchurl {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gnum4;
|
cfg = config.aux.foundation.stages.stage1.gnum4;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.gnum4 = {
|
options.aux.foundation.stages.stage1.gnum4 = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gnumake.boot;
|
cfg = config.aux.foundation.stages.stage1.gnumake.boot;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.gnumake.boot = {
|
options.aux.foundation.stages.stage1.gnumake.boot = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
@ -34,7 +33,8 @@ in {
|
||||||
sha256 = "1cwgcmwdn7gqn5da2ia91gkyiqs9birr10sy5ykpkaxzcwfzn5nx";
|
sha256 = "1cwgcmwdn7gqn5da2ia91gkyiqs9birr10sy5ykpkaxzcwfzn5nx";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
patches = [
|
patches = [
|
||||||
# Replaces /bin/sh with sh, see patch file for reasoning
|
# Replaces /bin/sh with sh, see patch file for reasoning
|
||||||
./patches/0001-No-impure-bin-sh.patch
|
./patches/0001-No-impure-bin-sh.patch
|
||||||
|
@ -114,8 +114,7 @@ in {
|
||||||
"-Dvfork=fork"
|
"-Dvfork=fork"
|
||||||
];
|
];
|
||||||
|
|
||||||
cflags =
|
cflags = [
|
||||||
[
|
|
||||||
"-I./src"
|
"-I./src"
|
||||||
"-I./lib"
|
"-I./lib"
|
||||||
"-DHAVE_CONFIG_H"
|
"-DHAVE_CONFIG_H"
|
||||||
|
@ -127,8 +126,7 @@ in {
|
||||||
"-DNO_OUTPUT_SYNC=1"
|
"-DNO_OUTPUT_SYNC=1"
|
||||||
# mes-libc doesn't define O_TMPFILE
|
# mes-libc doesn't define O_TMPFILE
|
||||||
"-DO_TMPFILE=020000000"
|
"-DO_TMPFILE=020000000"
|
||||||
]
|
] ++ config;
|
||||||
++ config;
|
|
||||||
|
|
||||||
sources = {
|
sources = {
|
||||||
# Maintenance note: list of source files derived from Basic.mk
|
# Maintenance note: list of source files derived from Basic.mk
|
||||||
|
@ -166,27 +164,14 @@ in {
|
||||||
"lib/fnmatch.c"
|
"lib/fnmatch.c"
|
||||||
"lib/glob.c"
|
"lib/glob.c"
|
||||||
];
|
];
|
||||||
remote = [
|
remote = [ "src/remote-stub.c" ];
|
||||||
"src/remote-stub.c"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
files =
|
files = sources.make ++ sources.glob ++ sources.remote ++ [ "src/posixos.c" ];
|
||||||
sources.make
|
|
||||||
++ sources.glob
|
|
||||||
++ sources.remote
|
|
||||||
++ [
|
|
||||||
"src/posixos.c"
|
|
||||||
];
|
|
||||||
|
|
||||||
objects =
|
objects = builtins.map (
|
||||||
builtins.map
|
value: builtins.replaceStrings [ ".c" ] [ ".o" ] (builtins.baseNameOf value)
|
||||||
(
|
) files;
|
||||||
value:
|
|
||||||
builtins.replaceStrings [".c"] [".o"]
|
|
||||||
(builtins.baseNameOf value)
|
|
||||||
)
|
|
||||||
files;
|
|
||||||
in
|
in
|
||||||
builders.kaem.build {
|
builders.kaem.build {
|
||||||
name = "gnumake-${cfg.version}";
|
name = "gnumake-${cfg.version}";
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gnumake;
|
cfg = config.aux.foundation.stages.stage1.gnumake;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
includes = [
|
{
|
||||||
./boot.nix
|
includes = [ ./boot.nix ];
|
||||||
];
|
|
||||||
|
|
||||||
options.aux.foundation.stages.stage1.gnumake = {
|
options.aux.foundation.stages.stage1.gnumake = {
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -66,7 +63,8 @@ in {
|
||||||
sha256 = "3Rb7HWe/q3mnL16DkHNcSePo5wtJRaFasfgd23hlj7M=";
|
sha256 = "3Rb7HWe/q3mnL16DkHNcSePo5wtJRaFasfgd23hlj7M=";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
patches = [
|
patches = [
|
||||||
# Replaces /bin/sh with sh, see patch file for reasoning
|
# Replaces /bin/sh with sh, see patch file for reasoning
|
||||||
./patches/0001-No-impure-bin-sh.patch
|
./patches/0001-No-impure-bin-sh.patch
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gnupatch;
|
cfg = config.aux.foundation.stages.stage1.gnupatch;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.gnupatch = {
|
options.aux.foundation.stages.stage1.gnupatch = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -61,7 +60,8 @@ in {
|
||||||
sha256 = "12nv7jx3gxfp50y11nxzlnmqqrpicjggw6pcsq0wyavkkm3cddgc";
|
sha256 = "12nv7jx3gxfp50y11nxzlnmqqrpicjggw6pcsq0wyavkkm3cddgc";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
# Thanks to the live-bootstrap project!
|
# Thanks to the live-bootstrap project!
|
||||||
# https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/patch-2.5.9/mk/main.mk
|
# https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/patch-2.5.9/mk/main.mk
|
||||||
cflags = [
|
cflags = [
|
||||||
|
@ -110,23 +110,14 @@ in {
|
||||||
"xmalloc.c"
|
"xmalloc.c"
|
||||||
];
|
];
|
||||||
|
|
||||||
sources =
|
sources = files ++ [
|
||||||
files
|
|
||||||
++ [
|
|
||||||
# mes-libc doesn't implement `error()`
|
# mes-libc doesn't implement `error()`
|
||||||
"error.c"
|
"error.c"
|
||||||
];
|
];
|
||||||
|
|
||||||
objects =
|
objects = builtins.map (
|
||||||
builtins.map
|
value: builtins.replaceStrings [ ".c" ] [ ".o" ] (builtins.baseNameOf value)
|
||||||
(
|
) sources;
|
||||||
value:
|
|
||||||
builtins.replaceStrings
|
|
||||||
[".c"]
|
|
||||||
[".o"]
|
|
||||||
(builtins.baseNameOf value)
|
|
||||||
)
|
|
||||||
sources;
|
|
||||||
in
|
in
|
||||||
builders.kaem.build {
|
builders.kaem.build {
|
||||||
name = "gnupatch-${cfg.version}";
|
name = "gnupatch-${cfg.version}";
|
||||||
|
@ -134,9 +125,7 @@ in {
|
||||||
meta = cfg.meta;
|
meta = cfg.meta;
|
||||||
src = cfg.src;
|
src = cfg.src;
|
||||||
|
|
||||||
deps.build.host = [
|
deps.build.host = [ stage1.tinycc.mes.compiler.package ];
|
||||||
stage1.tinycc.mes.compiler.package
|
|
||||||
];
|
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
# Unpack
|
# Unpack
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gnused.boot;
|
cfg = config.aux.foundation.stages.stage1.gnused.boot;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.gnused.boot = {
|
options.aux.foundation.stages.stage1.gnused.boot = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
@ -34,7 +33,8 @@ in {
|
||||||
sha256 = "0006gk1dw2582xsvgx6y6rzs9zw8b36rhafjwm288zqqji3qfrf3";
|
sha256 = "0006gk1dw2582xsvgx6y6rzs9zw8b36rhafjwm288zqqji3qfrf3";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
# Thanks to the live-bootstrap project!
|
# Thanks to the live-bootstrap project!
|
||||||
# See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/sed-4.0.9.kaem
|
# See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/sed-4.0.9.kaem
|
||||||
makefile = builtins.fetchurl {
|
makefile = builtins.fetchurl {
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gnused;
|
cfg = config.aux.foundation.stages.stage1.gnused;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
includes = [
|
{
|
||||||
./boot.nix
|
includes = [ ./boot.nix ];
|
||||||
];
|
|
||||||
|
|
||||||
options.aux.foundation.stages.stage1.gnused = {
|
options.aux.foundation.stages.stage1.gnused = {
|
||||||
meta = {
|
meta = {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gnutar.boot;
|
cfg = config.aux.foundation.stages.stage1.gnutar.boot;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.gnutar.boot = {
|
options.aux.foundation.stages.stage1.gnutar.boot = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
@ -35,7 +34,8 @@ in {
|
||||||
sha256 = "02m6gajm647n8l9a5bnld6fnbgdpyi4i3i83p7xcwv0kif47xhy6";
|
sha256 = "02m6gajm647n8l9a5bnld6fnbgdpyi4i3i83p7xcwv0kif47xhy6";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
in
|
in
|
||||||
builders.bash.boot.build {
|
builders.bash.boot.build {
|
||||||
name = "gnutar-boot-${cfg.version}";
|
name = "gnutar-boot-${cfg.version}";
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gnutar;
|
cfg = config.aux.foundation.stages.stage1.gnutar;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
includes = [
|
includes = [
|
||||||
./boot.nix
|
./boot.nix
|
||||||
./musl.nix
|
./musl.nix
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gnutar.musl;
|
cfg = config.aux.foundation.stages.stage1.gnutar.musl;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.gnutar.musl = {
|
options.aux.foundation.stages.stage1.gnutar.musl = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.gzip;
|
cfg = config.aux.foundation.stages.stage1.gzip;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.gzip = {
|
options.aux.foundation.stages.stage1.gzip = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -61,7 +60,8 @@ in {
|
||||||
sha256 = "0ryr5b00qz3xcdcv03qwjdfji8pasp0007ay3ppmk71wl8c1i90w";
|
sha256 = "0ryr5b00qz3xcdcv03qwjdfji8pasp0007ay3ppmk71wl8c1i90w";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
in
|
in
|
||||||
builders.bash.boot.build {
|
builders.bash.boot.build {
|
||||||
name = "gzip-${cfg.version}";
|
name = "gzip-${cfg.version}";
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.heirloom;
|
cfg = config.aux.foundation.stages.stage1.heirloom;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
|
@ -9,10 +7,9 @@
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
stage2 = config.aux.foundation.stages.stage2;
|
stage2 = config.aux.foundation.stages.stage2;
|
||||||
in {
|
in
|
||||||
includes = [
|
{
|
||||||
./devtools.nix
|
includes = [ ./devtools.nix ];
|
||||||
];
|
|
||||||
|
|
||||||
options.aux.foundation.stages.stage1.heirloom = {
|
options.aux.foundation.stages.stage1.heirloom = {
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -77,7 +74,8 @@ in {
|
||||||
sha256 = "6zP3C8wBmx0OCkHx11UtRcV6FicuThxIY07D5ESWow8=";
|
sha256 = "6zP3C8wBmx0OCkHx11UtRcV6FicuThxIY07D5ESWow8=";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
patches = [
|
patches = [
|
||||||
# we pre-generate nawk's proctab.c as meslibc is not capable of running maketab
|
# we pre-generate nawk's proctab.c as meslibc is not capable of running maketab
|
||||||
# during build time (insufficient sscanf support)
|
# during build time (insufficient sscanf support)
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.heirloom.devtools;
|
cfg = config.aux.foundation.stages.stage1.heirloom.devtools;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
|
@ -10,7 +8,8 @@
|
||||||
stage0 = config.aux.foundation.stages.stage0;
|
stage0 = config.aux.foundation.stages.stage0;
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
stage2 = config.aux.foundation.stages.stage2;
|
stage2 = config.aux.foundation.stages.stage2;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.heirloom.devtools = {
|
options.aux.foundation.stages.stage1.heirloom.devtools = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
@ -68,7 +67,8 @@ in {
|
||||||
sha256 = "9f233d8b78e4351fe9dd2d50d83958a0e5af36f54e9818521458a08e058691ba";
|
sha256 = "9f233d8b78e4351fe9dd2d50d83958a0e5af36f54e9818521458a08e058691ba";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
# Thanks to the live-bootstrap project!
|
# Thanks to the live-bootstrap project!
|
||||||
# See https://github.com/fosslinux/live-bootstrap/blob/d918b984ad6fe4fc7680f3be060fd82f8c9fddd9/sysa/heirloom-devtools-070527/heirloom-devtools-070527.kaem
|
# See https://github.com/fosslinux/live-bootstrap/blob/d918b984ad6fe4fc7680f3be060fd82f8c9fddd9/sysa/heirloom-devtools-070527/heirloom-devtools-070527.kaem
|
||||||
liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/d918b984ad6fe4fc7680f3be060fd82f8c9fddd9/sysa/heirloom-devtools-070527";
|
liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/d918b984ad6fe4fc7680f3be060fd82f8c9fddd9/sysa/heirloom-devtools-070527";
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.linux-headers;
|
cfg = config.aux.foundation.stages.stage1.linux-headers;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.linux-headers = {
|
options.aux.foundation.stages.stage1.linux-headers = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.ln-boot;
|
cfg = config.aux.foundation.stages.stage1.ln-boot;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage0 = config.aux.foundation.stages.stage0;
|
stage0 = config.aux.foundation.stages.stage0;
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.ln-boot = {
|
options.aux.foundation.stages.stage1.ln-boot = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.mes.compiler;
|
cfg = config.aux.foundation.stages.stage1.mes.compiler;
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
|
@ -9,7 +7,8 @@
|
||||||
|
|
||||||
stage0 = config.aux.foundation.stages.stage0;
|
stage0 = config.aux.foundation.stages.stage0;
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.mes.compiler = {
|
options.aux.foundation.stages.stage1.mes.compiler = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -46,8 +45,11 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage1.mes.compiler = {
|
aux.foundation.stages.stage1.mes.compiler = {
|
||||||
package = let
|
package =
|
||||||
compile = path: let
|
let
|
||||||
|
compile =
|
||||||
|
path:
|
||||||
|
let
|
||||||
file = builtins.baseNameOf path;
|
file = builtins.baseNameOf path;
|
||||||
fileWithoutExtension = builtins.replaceStrings [ ".c" ] [ "" ] file;
|
fileWithoutExtension = builtins.replaceStrings [ ".c" ] [ "" ] file;
|
||||||
|
|
||||||
|
@ -79,11 +81,9 @@ in {
|
||||||
|
|
||||||
sources = import ./sources.nix;
|
sources = import ./sources.nix;
|
||||||
|
|
||||||
files =
|
files = lib.strings.concatMapSep " " (getSourcePath ".o") (
|
||||||
lib.strings.concatMapSep
|
builtins.map compile sources.x86.linux.mescc.mes
|
||||||
" "
|
);
|
||||||
(getSourcePath ".o")
|
|
||||||
(builtins.map compile sources.x86.linux.mescc.mes);
|
|
||||||
in
|
in
|
||||||
builders.kaem.build {
|
builders.kaem.build {
|
||||||
name = "mes-${stage1.mes.version}";
|
name = "mes-${stage1.mes.version}";
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.mes;
|
cfg = config.aux.foundation.stages.stage1.mes;
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
includes = [
|
includes = [
|
||||||
./compiler.nix
|
./compiler.nix
|
||||||
./libs.nix
|
./libs.nix
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.mes.libc;
|
cfg = config.aux.foundation.stages.stage1.mes.libc;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.mes.libc = {
|
options.aux.foundation.stages.stage1.mes.libc = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -44,7 +43,8 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage1.mes.libc = {
|
aux.foundation.stages.stage1.mes.libc = {
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
sources = import ./sources.nix;
|
sources = import ./sources.nix;
|
||||||
|
|
||||||
libtcc1 = sources.x86.linux.gcc.libtcc1;
|
libtcc1 = sources.x86.linux.gcc.libtcc1;
|
||||||
|
@ -57,9 +57,7 @@ in {
|
||||||
|
|
||||||
meta = cfg.meta;
|
meta = cfg.meta;
|
||||||
|
|
||||||
deps.build.host = [
|
deps.build.host = [ stage1.ln-boot.package ];
|
||||||
stage1.ln-boot.package
|
|
||||||
];
|
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
cd ${stage1.mes.libs.prefix}
|
cd ${stage1.mes.libs.prefix}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.mes.libs;
|
cfg = config.aux.foundation.stages.stage1.mes.libs;
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
|
@ -9,7 +7,8 @@
|
||||||
|
|
||||||
stage0 = config.aux.foundation.stages.stage0;
|
stage0 = config.aux.foundation.stages.stage0;
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.mes.libs = {
|
options.aux.foundation.stages.stage1.mes.libs = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -58,7 +57,8 @@ in {
|
||||||
aux.foundation.stages.stage1.mes.libs = {
|
aux.foundation.stages.stage1.mes.libs = {
|
||||||
prefix = "${cfg.src.out}/mes-${stage1.mes.version}";
|
prefix = "${cfg.src.out}/mes-${stage1.mes.version}";
|
||||||
|
|
||||||
src = let
|
src =
|
||||||
|
let
|
||||||
config_h = builtins.toFile "config.h" ''
|
config_h = builtins.toFile "config.h" ''
|
||||||
#undef SYSTEM_LIBC
|
#undef SYSTEM_LIBC
|
||||||
#define MES_VERSION "${stage1.mes.version}"
|
#define MES_VERSION "${stage1.mes.version}"
|
||||||
|
@ -140,8 +140,11 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
compile = path: let
|
let
|
||||||
|
compile =
|
||||||
|
path:
|
||||||
|
let
|
||||||
file = builtins.baseNameOf path;
|
file = builtins.baseNameOf path;
|
||||||
fileWithoutExtension = builtins.replaceStrings [ ".c" ] [ "" ] file;
|
fileWithoutExtension = builtins.replaceStrings [ ".c" ] [ "" ] file;
|
||||||
|
|
||||||
|
@ -171,10 +174,16 @@ in {
|
||||||
|
|
||||||
getSourcePath = suffix: source: "${source}/${source.name}${suffix}";
|
getSourcePath = suffix: source: "${source}/${source.name}${suffix}";
|
||||||
|
|
||||||
archive = destination: sources: "catm ${destination} ${lib.strings.concatMapSep " " (getSourcePath ".o") sources}";
|
archive =
|
||||||
source = destination: sources: "catm ${destination} ${lib.strings.concatMapSep " " (getSourcePath ".s") sources}";
|
destination: sources:
|
||||||
|
"catm ${destination} ${lib.strings.concatMapSep " " (getSourcePath ".o") sources}";
|
||||||
|
source =
|
||||||
|
destination: sources:
|
||||||
|
"catm ${destination} ${lib.strings.concatMapSep " " (getSourcePath ".s") sources}";
|
||||||
|
|
||||||
createLib = name: sources: let
|
createLib =
|
||||||
|
name: sources:
|
||||||
|
let
|
||||||
compiled = builtins.map compile sources;
|
compiled = builtins.map compile sources;
|
||||||
in
|
in
|
||||||
builders.kaem.build {
|
builders.kaem.build {
|
||||||
|
@ -199,11 +208,13 @@ in {
|
||||||
libc-mini = createLib "libc-mini" sources.x86.linux.mescc.libc_mini;
|
libc-mini = createLib "libc-mini" sources.x86.linux.mescc.libc_mini;
|
||||||
libmescc = createLib "libmescc" sources.x86.linux.mescc.libmescc;
|
libmescc = createLib "libmescc" sources.x86.linux.mescc.libmescc;
|
||||||
libc = createLib "libc" sources.x86.linux.mescc.libc;
|
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.
|
# We need `symlink` support for `ln-boot` to work.
|
||||||
"lib/linux/symlink.c"
|
"lib/linux/symlink.c"
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
in
|
in
|
||||||
builders.kaem.build {
|
builders.kaem.build {
|
||||||
name = "mes-m2-libs-${stage1.mes.version}";
|
name = "mes-m2-libs-${stage1.mes.version}";
|
||||||
|
|
|
@ -18,9 +18,7 @@
|
||||||
"lib/mes/globals.c"
|
"lib/mes/globals.c"
|
||||||
"lib/linux/x86-mes-mescc/syscall-internal.c"
|
"lib/linux/x86-mes-mescc/syscall-internal.c"
|
||||||
];
|
];
|
||||||
libtcc1 = [
|
libtcc1 = [ "lib/libtcc1.c" ];
|
||||||
"lib/libtcc1.c"
|
|
||||||
];
|
|
||||||
libc = [
|
libc = [
|
||||||
"lib/mes/__init_io.c"
|
"lib/mes/__init_io.c"
|
||||||
"lib/mes/eputs.c"
|
"lib/mes/eputs.c"
|
||||||
|
@ -546,9 +544,7 @@
|
||||||
"lib/mes/globals.c"
|
"lib/mes/globals.c"
|
||||||
"lib/linux/x86-mes-gcc/syscall-internal.c"
|
"lib/linux/x86-mes-gcc/syscall-internal.c"
|
||||||
];
|
];
|
||||||
libtcc1 = [
|
libtcc1 = [ "lib/libtcc1.c" ];
|
||||||
"lib/libtcc1.c"
|
|
||||||
];
|
|
||||||
libc = [
|
libc = [
|
||||||
"lib/mes/__init_io.c"
|
"lib/mes/__init_io.c"
|
||||||
"lib/mes/eputs.c"
|
"lib/mes/eputs.c"
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.musl.boot;
|
cfg = config.aux.foundation.stages.stage1.musl.boot;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.musl.boot = {
|
options.aux.foundation.stages.stage1.musl.boot = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
type = lib.types.derivation;
|
type = lib.types.derivation;
|
||||||
|
@ -35,7 +34,8 @@ in {
|
||||||
sha256 = "E3DJqBKyzyp9koAlEMygBYzDfmanvt1wBR8KNAFQIqM=";
|
sha256 = "E3DJqBKyzyp9koAlEMygBYzDfmanvt1wBR8KNAFQIqM=";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
# Thanks to the live-bootstrap project!
|
# Thanks to the live-bootstrap project!
|
||||||
# See https://github.com/fosslinux/live-bootstrap/blob/d98f97e21413efc32c770d0356f1feda66025686/sysa/musl-1.1.24/musl-1.1.24.sh
|
# See https://github.com/fosslinux/live-bootstrap/blob/d98f97e21413efc32c770d0356f1feda66025686/sysa/musl-1.1.24/musl-1.1.24.sh
|
||||||
liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/d98f97e21413efc32c770d0356f1feda66025686/sysa/musl-1.1.24";
|
liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/d98f97e21413efc32c770d0356f1feda66025686/sysa/musl-1.1.24";
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.musl;
|
cfg = config.aux.foundation.stages.stage1.musl;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
includes = [
|
{
|
||||||
./boot.nix
|
includes = [ ./boot.nix ];
|
||||||
];
|
|
||||||
|
|
||||||
options.aux.foundation.stages.stage1.musl = {
|
options.aux.foundation.stages.stage1.musl = {
|
||||||
meta = {
|
meta = {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.nyacc;
|
cfg = config.aux.foundation.stages.stage1.nyacc;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
@ -10,7 +8,8 @@
|
||||||
|
|
||||||
pname = "nyacc";
|
pname = "nyacc";
|
||||||
version = "1.00.2";
|
version = "1.00.2";
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.nyacc = {
|
options.aux.foundation.stages.stage1.nyacc = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.python;
|
cfg = config.aux.foundation.stages.stage1.python;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.python = {
|
options.aux.foundation.stages.stage1.python = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -62,7 +61,8 @@ in {
|
||||||
sha256 = "eVw09E30Wg6blxDIxxwVxnGHFSTNQSyhTe8hLozLFV0=";
|
sha256 = "eVw09E30Wg6blxDIxxwVxnGHFSTNQSyhTe8hLozLFV0=";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
patches = [
|
patches = [
|
||||||
# Disable the use of ldconfig in ctypes.util.find_library (since
|
# Disable the use of ldconfig in ctypes.util.find_library (since
|
||||||
# ldconfig doesn't work on NixOS), and don't use
|
# ldconfig doesn't work on NixOS), and don't use
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
args @ {
|
args@{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.tinycc.boot;
|
cfg = config.aux.foundation.stages.stage1.tinycc.boot;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
@ -11,7 +9,8 @@ args @ {
|
||||||
pname = "tinycc-boot";
|
pname = "tinycc-boot";
|
||||||
|
|
||||||
helpers = lib.fp.withDynamicArgs (import ./helpers.nix) args;
|
helpers = lib.fp.withDynamicArgs (import ./helpers.nix) args;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.tinycc.boot = {
|
options.aux.foundation.stages.stage1.tinycc.boot = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -36,7 +35,10 @@ in {
|
||||||
platforms = lib.options.create {
|
platforms = lib.options.create {
|
||||||
type = lib.types.list.of lib.types.string;
|
type = lib.types.list.of lib.types.string;
|
||||||
description = "Platforms the package supports.";
|
description = "Platforms the package supports.";
|
||||||
default.value = ["x86_64-linux" "i686-linux"];
|
default.value = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"i686-linux"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,8 +68,10 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage1.tinycc.boot = let
|
aux.foundation.stages.stage1.tinycc.boot =
|
||||||
tinycc-boot = let
|
let
|
||||||
|
tinycc-boot =
|
||||||
|
let
|
||||||
tinycc-mes-bootstrappable = helpers.createBoot {
|
tinycc-mes-bootstrappable = helpers.createBoot {
|
||||||
pname = "tinycc-mes-bootstrappable";
|
pname = "tinycc-mes-bootstrappable";
|
||||||
version = stage1.tinycc.version;
|
version = stage1.tinycc.version;
|
||||||
|
@ -82,9 +86,7 @@ in {
|
||||||
"-D HAVE_LONG_LONG_STUB=1"
|
"-D HAVE_LONG_LONG_STUB=1"
|
||||||
"-D HAVE_SETJMP=1"
|
"-D HAVE_SETJMP=1"
|
||||||
];
|
];
|
||||||
lib.args = [
|
lib.args = [ "-D HAVE_LONG_LONG_STUB=1" ];
|
||||||
"-D HAVE_LONG_LONG_STUB=1"
|
|
||||||
];
|
|
||||||
boot = tinycc-mes-bootstrappable;
|
boot = tinycc-mes-bootstrappable;
|
||||||
meta = cfg.meta;
|
meta = cfg.meta;
|
||||||
};
|
};
|
||||||
|
@ -98,9 +100,7 @@ in {
|
||||||
"-D HAVE_LONG_LONG=1"
|
"-D HAVE_LONG_LONG=1"
|
||||||
"-D HAVE_SETJMP=1"
|
"-D HAVE_SETJMP=1"
|
||||||
];
|
];
|
||||||
lib.args = [
|
lib.args = [ "-D HAVE_LONG_LONG=1" ];
|
||||||
"-D HAVE_LONG_LONG=1"
|
|
||||||
];
|
|
||||||
boot = tinycc-boot0;
|
boot = tinycc-boot0;
|
||||||
meta = cfg.meta;
|
meta = cfg.meta;
|
||||||
};
|
};
|
||||||
|
@ -158,13 +158,15 @@ in {
|
||||||
boot = tinycc-boot3;
|
boot = tinycc-boot3;
|
||||||
meta = cfg.meta;
|
meta = cfg.meta;
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
revision = "80114c4da6b17fbaabb399cc29f427e368309bc8";
|
revision = "80114c4da6b17fbaabb399cc29f427e368309bc8";
|
||||||
|
|
||||||
libs.package = tinycc-boot.libs;
|
libs.package = tinycc-boot.libs;
|
||||||
compiler.package = tinycc-boot.compiler;
|
compiler.package = tinycc-boot.compiler;
|
||||||
|
|
||||||
src = let
|
src =
|
||||||
|
let
|
||||||
tarball = builtins.fetchurl {
|
tarball = builtins.fetchurl {
|
||||||
url = "https://gitlab.com/janneke/tinycc/-/archive/${cfg.revision}/tinycc-${cfg.revision}.tar.gz";
|
url = "https://gitlab.com/janneke/tinycc/-/archive/${cfg.revision}/tinycc-${cfg.revision}.tar.gz";
|
||||||
sha256 = "1a0cw9a62qc76qqn5sjmp3xrbbvsz2dxrw21lrnx9q0s74mwaxbq";
|
sha256 = "1a0cw9a62qc76qqn5sjmp3xrbbvsz2dxrw21lrnx9q0s74mwaxbq";
|
||||||
|
@ -188,7 +190,8 @@ in {
|
||||||
replace --file libtcc.c --output libtcc.c --match-on "s->ms_extensions = 1;" --replace-with "s->ms_extensions = 1; s->static_link = 1;"
|
replace --file libtcc.c --output libtcc.c --match-on "s->ms_extensions = 1;" --replace-with "s->ms_extensions = 1; s->static_link = 1;"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in "${patched}/tinycc-${cfg.revision}";
|
in
|
||||||
|
"${patched}/tinycc-${cfg.revision}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.tinycc;
|
cfg = config.aux.foundation.stages.stage1.tinycc;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
includes = [
|
includes = [
|
||||||
./boot.nix
|
./boot.nix
|
||||||
./mes.nix
|
./mes.nix
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.tinycc.boot;
|
cfg = config.aux.foundation.stages.stage1.tinycc.boot;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
@ -9,11 +7,13 @@
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
cflags = stage1.mes.libc.package.extras.CFLAGS;
|
cflags = stage1.mes.libc.package.extras.CFLAGS;
|
||||||
|
|
||||||
createBoot = {
|
createBoot =
|
||||||
|
{
|
||||||
pname,
|
pname,
|
||||||
version,
|
version,
|
||||||
src,
|
src,
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
compiler = builders.kaem.build {
|
compiler = builders.kaem.build {
|
||||||
name = "${pname}-${version}";
|
name = "${pname}-${version}";
|
||||||
|
|
||||||
|
@ -57,9 +57,13 @@
|
||||||
args = cflags;
|
args = cflags;
|
||||||
tinycc = compiler;
|
tinycc = compiler;
|
||||||
};
|
};
|
||||||
in {inherit compiler libs;};
|
in
|
||||||
|
{
|
||||||
|
inherit compiler libs;
|
||||||
|
};
|
||||||
|
|
||||||
createTinyccMes = {
|
createTinyccMes =
|
||||||
|
{
|
||||||
pname,
|
pname,
|
||||||
version,
|
version,
|
||||||
src,
|
src,
|
||||||
|
@ -67,7 +71,8 @@
|
||||||
boot,
|
boot,
|
||||||
lib ? { },
|
lib ? { },
|
||||||
meta,
|
meta,
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
compiler = builders.kaem.build {
|
compiler = builders.kaem.build {
|
||||||
name = "${pname}-${version}";
|
name = "${pname}-${version}";
|
||||||
|
|
||||||
|
@ -108,28 +113,33 @@
|
||||||
libs = createLibc {
|
libs = createLibc {
|
||||||
inherit pname version src;
|
inherit pname version src;
|
||||||
|
|
||||||
args =
|
args = builtins.concatStringsSep " " (
|
||||||
builtins.concatStringsSep
|
[
|
||||||
" "
|
"-c"
|
||||||
(
|
"-D"
|
||||||
["-c" "-D" "TCC_TARGET_I386=1"]
|
"TCC_TARGET_I386=1"
|
||||||
|
]
|
||||||
++ (lib.args or [ ])
|
++ (lib.args or [ ])
|
||||||
);
|
);
|
||||||
|
|
||||||
tinycc = compiler;
|
tinycc = compiler;
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
inherit compiler libs boot;
|
inherit compiler libs boot;
|
||||||
};
|
};
|
||||||
|
|
||||||
createLibc = {
|
createLibc =
|
||||||
|
{
|
||||||
pname,
|
pname,
|
||||||
version,
|
version,
|
||||||
src,
|
src,
|
||||||
args,
|
args,
|
||||||
tinycc,
|
tinycc,
|
||||||
}: let
|
}:
|
||||||
createLibrary = name: args: source:
|
let
|
||||||
|
createLibrary =
|
||||||
|
name: args: source:
|
||||||
builders.kaem.build {
|
builders.kaem.build {
|
||||||
name = "${name}.a";
|
name = "${name}.a";
|
||||||
|
|
||||||
|
@ -167,10 +177,7 @@
|
||||||
cp ${libgetopt} ''${out}/lib/libgetopt.a
|
cp ${libgetopt} ''${out}/lib/libgetopt.a
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
inherit
|
{
|
||||||
createBoot
|
inherit createBoot createTinyccMes createLibc;
|
||||||
createTinyccMes
|
|
||||||
createLibc
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
args @ {
|
args@{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.tinycc.mes;
|
cfg = config.aux.foundation.stages.stage1.tinycc.mes;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
@ -11,7 +9,8 @@ args @ {
|
||||||
pname = "tinycc-mes";
|
pname = "tinycc-mes";
|
||||||
|
|
||||||
helpers = lib.fp.withDynamicArgs (import ./helpers.nix) args;
|
helpers = lib.fp.withDynamicArgs (import ./helpers.nix) args;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.tinycc.mes = {
|
options.aux.foundation.stages.stage1.tinycc.mes = {
|
||||||
compiler = {
|
compiler = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -39,8 +38,10 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage1.tinycc.mes = let
|
aux.foundation.stages.stage1.tinycc.mes =
|
||||||
tinycc-mes = let
|
let
|
||||||
|
tinycc-mes =
|
||||||
|
let
|
||||||
tccdefs = builders.kaem.build {
|
tccdefs = builders.kaem.build {
|
||||||
name = "tccdefs-${stage1.tinycc.version}";
|
name = "tccdefs-${stage1.tinycc.version}";
|
||||||
|
|
||||||
|
@ -106,13 +107,15 @@ in {
|
||||||
boot = tinycc-mes-boot;
|
boot = tinycc-mes-boot;
|
||||||
meta = stage1.tinycc.meta;
|
meta = stage1.tinycc.meta;
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
revision = "86f3d8e33105435946383aee52487b5ddf918140";
|
revision = "86f3d8e33105435946383aee52487b5ddf918140";
|
||||||
|
|
||||||
libs.package = tinycc-mes.libs;
|
libs.package = tinycc-mes.libs;
|
||||||
compiler.package = tinycc-mes.compiler;
|
compiler.package = tinycc-mes.compiler;
|
||||||
|
|
||||||
src = let
|
src =
|
||||||
|
let
|
||||||
tarball = builtins.fetchurl {
|
tarball = builtins.fetchurl {
|
||||||
url = "https://repo.or.cz/tinycc.git/snapshot/${cfg.revision}.tar.gz";
|
url = "https://repo.or.cz/tinycc.git/snapshot/${cfg.revision}.tar.gz";
|
||||||
sha256 = "11idrvbwfgj1d03crv994mpbbbyg63j1k64lw1gjy7mkiifw2xap";
|
sha256 = "11idrvbwfgj1d03crv994mpbbbyg63j1k64lw1gjy7mkiifw2xap";
|
||||||
|
@ -136,7 +139,8 @@ in {
|
||||||
replace --file libtcc.c --output libtcc.c --match-on "s->ms_extensions = 1;" --replace-with "s->ms_extensions = 1; s->static_link = 1;"
|
replace --file libtcc.c --output libtcc.c --match-on "s->ms_extensions = 1;" --replace-with "s->ms_extensions = 1; s->static_link = 1;"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in "${patched}/tinycc-${builtins.substring 0 7 cfg.revision}";
|
in
|
||||||
|
"${patched}/tinycc-${builtins.substring 0 7 cfg.revision}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
args @ {
|
args@{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.tinycc.musl;
|
cfg = config.aux.foundation.stages.stage1.tinycc.musl;
|
||||||
|
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
@ -11,7 +9,8 @@ args @ {
|
||||||
pname = "tinycc-musl";
|
pname = "tinycc-musl";
|
||||||
|
|
||||||
helpers = lib.fp.withDynamicArgs (import ./helpers.nix) args;
|
helpers = lib.fp.withDynamicArgs (import ./helpers.nix) args;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.tinycc.musl = {
|
options.aux.foundation.stages.stage1.tinycc.musl = {
|
||||||
compiler = {
|
compiler = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -39,7 +38,8 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
aux.foundation.stages.stage1.tinycc.musl = let
|
aux.foundation.stages.stage1.tinycc.musl =
|
||||||
|
let
|
||||||
patches = [
|
patches = [
|
||||||
./patches/ignore-duplicate-symbols.patch
|
./patches/ignore-duplicate-symbols.patch
|
||||||
./patches/ignore-static-inside-array.patch
|
./patches/ignore-static-inside-array.patch
|
||||||
|
@ -141,7 +141,8 @@ in {
|
||||||
install -Dm444 libtcc1.a $out/lib/libtcc1.a
|
install -Dm444 libtcc1.a $out/lib/libtcc1.a
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
revision = "fd6d2180c5c801bb0b4c5dde27d61503059fc97d";
|
revision = "fd6d2180c5c801bb0b4c5dde27d61503059fc97d";
|
||||||
|
|
||||||
src = builtins.fetchurl {
|
src = builtins.fetchurl {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.xz;
|
cfg = config.aux.foundation.stages.stage1.xz;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.xz = {
|
options.aux.foundation.stages.stage1.xz = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage1.zlib;
|
cfg = config.aux.foundation.stages.stage1.zlib;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage1.zlib = {
|
options.aux.foundation.stages.stage1.zlib = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.bash;
|
cfg = config.aux.foundation.stages.stage2.bash;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.bash = {
|
options.aux.foundation.stages.stage2.bash = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.binutils;
|
cfg = config.aux.foundation.stages.stage2.binutils;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.binutils = {
|
options.aux.foundation.stages.stage2.binutils = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -62,7 +61,8 @@ in {
|
||||||
sha256 = "rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA=";
|
sha256 = "rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
patches = [
|
patches = [
|
||||||
# Make binutils output deterministic by default.
|
# Make binutils output deterministic by default.
|
||||||
./patches/deterministic.patch
|
./patches/deterministic.patch
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.busybox;
|
cfg = config.aux.foundation.stages.stage2.busybox;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
|
@ -9,7 +7,8 @@
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
stage2 = config.aux.foundation.stages.stage2;
|
stage2 = config.aux.foundation.stages.stage2;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.busybox = {
|
options.aux.foundation.stages.stage2.busybox = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -63,10 +62,9 @@ in {
|
||||||
sha256 = "uMwkyVdNgJ5yecO+NJeVxdXOtv3xnKcJ+AzeUOR94xQ=";
|
sha256 = "uMwkyVdNgJ5yecO+NJeVxdXOtv3xnKcJ+AzeUOR94xQ=";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
patches = [
|
let
|
||||||
./patches/busybox-in-store.patch
|
patches = [ ./patches/busybox-in-store.patch ];
|
||||||
];
|
|
||||||
|
|
||||||
busyboxConfig = [
|
busyboxConfig = [
|
||||||
"CC=musl-gcc"
|
"CC=musl-gcc"
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.bzip2;
|
cfg = config.aux.foundation.stages.stage2.bzip2;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.bzip2 = {
|
options.aux.foundation.stages.stage2.bzip2 = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.coreutils;
|
cfg = config.aux.foundation.stages.stage2.coreutils;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.coreutils = {
|
options.aux.foundation.stages.stage2.coreutils = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -62,7 +61,8 @@ in {
|
||||||
sha256 = "X2ANkJOXOwr+JTk9m8GMRPIjJlf0yg2V6jHHAutmtzk=";
|
sha256 = "X2ANkJOXOwr+JTk9m8GMRPIjJlf0yg2V6jHHAutmtzk=";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"--prefix=${builtins.placeholder "out"}"
|
"--prefix=${builtins.placeholder "out"}"
|
||||||
"--build=${platform.build}"
|
"--build=${platform.build}"
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
stage2 = config.aux.foundation.stages.stage2;
|
stage2 = config.aux.foundation.stages.stage2;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
includes = [
|
includes = [
|
||||||
./bash
|
./bash
|
||||||
./binutils
|
./binutils
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.diffutils;
|
cfg = config.aux.foundation.stages.stage2.diffutils;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.diffutils = {
|
options.aux.foundation.stages.stage2.diffutils = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.findutils;
|
cfg = config.aux.foundation.stages.stage2.findutils;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.findutils = {
|
options.aux.foundation.stages.stage2.findutils = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.gawk;
|
cfg = config.aux.foundation.stages.stage2.gawk;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.gawk = {
|
options.aux.foundation.stages.stage2.gawk = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.gcc;
|
cfg = config.aux.foundation.stages.stage2.gcc;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.gcc = {
|
options.aux.foundation.stages.stage2.gcc = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.glibc;
|
cfg = config.aux.foundation.stages.stage2.glibc;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
|
@ -9,7 +7,8 @@
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
stage2 = config.aux.foundation.stages.stage2;
|
stage2 = config.aux.foundation.stages.stage2;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.glibc = {
|
options.aux.foundation.stages.stage2.glibc = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.gnugrep;
|
cfg = config.aux.foundation.stages.stage2.gnugrep;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.gnugrep = {
|
options.aux.foundation.stages.stage2.gnugrep = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.gnumake;
|
cfg = config.aux.foundation.stages.stage2.gnumake;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
|
@ -9,7 +7,8 @@
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
stage2 = config.aux.foundation.stages.stage2;
|
stage2 = config.aux.foundation.stages.stage2;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.gnumake = {
|
options.aux.foundation.stages.stage2.gnumake = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
@ -63,7 +62,8 @@ in {
|
||||||
sha256 = "3Rb7HWe/q3mnL16DkHNcSePo5wtJRaFasfgd23hlj7M=";
|
sha256 = "3Rb7HWe/q3mnL16DkHNcSePo5wtJRaFasfgd23hlj7M=";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = let
|
package =
|
||||||
|
let
|
||||||
patches = [
|
patches = [
|
||||||
# Replaces /bin/sh with sh, see patch file for reasoning
|
# Replaces /bin/sh with sh, see patch file for reasoning
|
||||||
./patches/0001-No-impure-bin-sh.patch
|
./patches/0001-No-impure-bin-sh.patch
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.gnupatch;
|
cfg = config.aux.foundation.stages.stage2.gnupatch;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.gnupatch = {
|
options.aux.foundation.stages.stage2.gnupatch = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.gnused;
|
cfg = config.aux.foundation.stages.stage2.gnused;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.gnused = {
|
options.aux.foundation.stages.stage2.gnused = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.gnutar;
|
cfg = config.aux.foundation.stages.stage2.gnutar;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.gnutar = {
|
options.aux.foundation.stages.stage2.gnutar = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.gzip;
|
cfg = config.aux.foundation.stages.stage2.gzip;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.gzip = {
|
options.aux.foundation.stages.stage2.gzip = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{
|
{ lib, config }:
|
||||||
lib,
|
let
|
||||||
config,
|
|
||||||
}: let
|
|
||||||
cfg = config.aux.foundation.stages.stage2.patchelf;
|
cfg = config.aux.foundation.stages.stage2.patchelf;
|
||||||
|
|
||||||
platform = config.aux.platform;
|
platform = config.aux.platform;
|
||||||
|
@ -9,7 +7,8 @@
|
||||||
|
|
||||||
stage1 = config.aux.foundation.stages.stage1;
|
stage1 = config.aux.foundation.stages.stage1;
|
||||||
stage2 = config.aux.foundation.stages.stage2;
|
stage2 = config.aux.foundation.stages.stage2;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.aux.foundation.stages.stage2.patchelf = {
|
options.aux.foundation.stages.stage2.patchelf = {
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{lib}: {
|
{ lib }:
|
||||||
|
{
|
||||||
options.aux = {
|
options.aux = {
|
||||||
system = lib.options.create {
|
system = lib.options.create {
|
||||||
type = lib.types.string;
|
type = lib.types.string;
|
||||||
|
|
|
@ -10,66 +10,76 @@ lib: {
|
||||||
## from `y` first if it exists and then `x` otherwise.
|
## from `y` first if it exists and then `x` otherwise.
|
||||||
##
|
##
|
||||||
## @type Attrs a b c => (String -> Any -> Any -> Bool) -> a -> b -> c
|
## @type Attrs a b c => (String -> Any -> Any -> Bool) -> a -> b -> c
|
||||||
mergeRecursiveUntil = predicate: x: y: let
|
mergeRecursiveUntil =
|
||||||
process = path:
|
predicate: x: y:
|
||||||
|
let
|
||||||
|
process =
|
||||||
|
path:
|
||||||
builtins.zipAttrsWith (
|
builtins.zipAttrsWith (
|
||||||
name: values: let
|
name: values:
|
||||||
|
let
|
||||||
currentPath = path ++ [ name ];
|
currentPath = path ++ [ name ];
|
||||||
isSingleValue = builtins.length values == 1;
|
isSingleValue = builtins.length values == 1;
|
||||||
isComplete =
|
isComplete = predicate currentPath (builtins.elemAt values 1) (builtins.elemAt values 0);
|
||||||
predicate currentPath
|
|
||||||
(builtins.elemAt values 1)
|
|
||||||
(builtins.elemAt values 0);
|
|
||||||
in
|
in
|
||||||
if isSingleValue
|
if isSingleValue then
|
||||||
then builtins.elemAt values 0
|
builtins.elemAt values 0
|
||||||
else if isComplete
|
else if isComplete then
|
||||||
then builtins.elemAt values 1
|
builtins.elemAt values 1
|
||||||
else process currentPath values
|
else
|
||||||
|
process currentPath values
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
process [] [x y];
|
process [ ] [
|
||||||
|
x
|
||||||
|
y
|
||||||
|
];
|
||||||
|
|
||||||
## Merge two attribute sets recursively. Any values that are _not_ attribute sets
|
## Merge two attribute sets recursively. Any values that are _not_ attribute sets
|
||||||
## will be overridden with the value from `y` first if it exists and then `x`
|
## will be overridden with the value from `y` first if it exists and then `x`
|
||||||
## otherwise.
|
## otherwise.
|
||||||
##
|
##
|
||||||
## @type Attrs a b c => a -> b -> c
|
## @type Attrs a b c => a -> b -> c
|
||||||
mergeRecursive =
|
mergeRecursive = lib.attrs.mergeRecursiveUntil (
|
||||||
lib.attrs.mergeRecursiveUntil
|
path: x: y:
|
||||||
(path: x: y:
|
!(builtins.isAttrs x && builtins.isAttrs y)
|
||||||
!(builtins.isAttrs x && builtins.isAttrs y));
|
);
|
||||||
|
|
||||||
## Get a value from an attribute set by a path. If the path does not exist,
|
## Get a value from an attribute set by a path. If the path does not exist,
|
||||||
## a fallback value will be returned instead.
|
## a fallback value will be returned instead.
|
||||||
##
|
##
|
||||||
## @type (List String) -> a -> Attrs -> a | b
|
## @type (List String) -> a -> Attrs -> a | b
|
||||||
select = path: fallback: target: let
|
select =
|
||||||
|
path: fallback: target:
|
||||||
|
let
|
||||||
name = builtins.head path;
|
name = builtins.head path;
|
||||||
rest = builtins.tail path;
|
rest = builtins.tail path;
|
||||||
in
|
in
|
||||||
if path == []
|
if path == [ ] then
|
||||||
then target
|
target
|
||||||
else if target ? ${name}
|
else if target ? ${name} then
|
||||||
then lib.attrs.select rest fallback target.${name}
|
lib.attrs.select rest fallback target.${name}
|
||||||
else fallback;
|
else
|
||||||
|
fallback;
|
||||||
|
|
||||||
## Get a value from an attribute set by a path. If the path does not exist,
|
## Get a value from an attribute set by a path. If the path does not exist,
|
||||||
## an error will be thrown.
|
## an error will be thrown.
|
||||||
##
|
##
|
||||||
## @type (List String) -> Attrs -> a
|
## @type (List String) -> Attrs -> a
|
||||||
selectOrThrow = path: target: let
|
selectOrThrow =
|
||||||
|
path: target:
|
||||||
|
let
|
||||||
pathAsString = builtins.concatStringsSep "." path;
|
pathAsString = builtins.concatStringsSep "." path;
|
||||||
error = builtins.throw "Path not found in attribute set: ${pathAsString}";
|
error = builtins.throw "Path not found in attribute set: ${pathAsString}";
|
||||||
in
|
in
|
||||||
if lib.attrs.has path target
|
if lib.attrs.has path target then lib.attrs.select path null target else error;
|
||||||
then lib.attrs.select path null target
|
|
||||||
else error;
|
|
||||||
|
|
||||||
## Zip specific attributes from a list of attribute sets.
|
## Zip specific attributes from a list of attribute sets.
|
||||||
##
|
##
|
||||||
## @type List String -> (List Any -> Any) -> List Attrs -> Attrs
|
## @type List String -> (List Any -> Any) -> List Attrs -> Attrs
|
||||||
zipWithNames = names: f: list: let
|
zipWithNames =
|
||||||
|
names: f: list:
|
||||||
|
let
|
||||||
transform = name: {
|
transform = name: {
|
||||||
inherit name;
|
inherit name;
|
||||||
value = f name (builtins.catAttrs name list);
|
value = f name (builtins.catAttrs name list);
|
||||||
|
@ -81,18 +91,26 @@ lib: {
|
||||||
## Match an attribute set against a pattern.
|
## Match an attribute set against a pattern.
|
||||||
##
|
##
|
||||||
## @type Attrs -> Attrs -> Bool
|
## @type Attrs -> Attrs -> Bool
|
||||||
match = pattern: value: let
|
match =
|
||||||
process = name: values: let
|
pattern: value:
|
||||||
|
let
|
||||||
|
process =
|
||||||
|
name: values:
|
||||||
|
let
|
||||||
first = builtins.elemAt values 0;
|
first = builtins.elemAt values 0;
|
||||||
second = builtins.elemAt values 1;
|
second = builtins.elemAt values 1;
|
||||||
in
|
in
|
||||||
if builtins.length values == 1
|
if builtins.length values == 1 then
|
||||||
then false
|
false
|
||||||
else if builtins.isAttrs first
|
else if builtins.isAttrs first then
|
||||||
then builtins.isAttrs second && lib.attrs.match first second
|
builtins.isAttrs second && lib.attrs.match first second
|
||||||
else first == second;
|
else
|
||||||
|
first == second;
|
||||||
|
|
||||||
result = lib.attrs.zipWithNames (builtins.attrNames pattern) process [pattern value];
|
result = lib.attrs.zipWithNames (builtins.attrNames pattern) process [
|
||||||
|
pattern
|
||||||
|
value
|
||||||
|
];
|
||||||
in
|
in
|
||||||
assert lib.errors.trace (builtins.isAttrs pattern) "Pattern must be an attribute set";
|
assert lib.errors.trace (builtins.isAttrs pattern) "Pattern must be an attribute set";
|
||||||
assert lib.errors.trace (builtins.isAttrs value) "Value must be an attribute set";
|
assert lib.errors.trace (builtins.isAttrs value) "Value must be an attribute set";
|
||||||
|
@ -101,62 +119,62 @@ lib: {
|
||||||
## Create a nested attribute set with a value as the leaf node.
|
## Create a nested attribute set with a value as the leaf node.
|
||||||
##
|
##
|
||||||
## @type (List String) -> a -> Attrs
|
## @type (List String) -> a -> Attrs
|
||||||
set = path: value: let
|
set =
|
||||||
|
path: value:
|
||||||
|
let
|
||||||
length = builtins.length path;
|
length = builtins.length path;
|
||||||
process = depth:
|
process =
|
||||||
if depth == length
|
depth: if depth == length then value else { ${builtins.elemAt path depth} = process (depth + 1); };
|
||||||
then value
|
|
||||||
else {
|
|
||||||
${builtins.elemAt path depth} = process (depth + 1);
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
process 0;
|
process 0;
|
||||||
|
|
||||||
## Check if a path exists in an attribute set.
|
## Check if a path exists in an attribute set.
|
||||||
##
|
##
|
||||||
## @type (List String) -> Attrs -> Bool
|
## @type (List String) -> Attrs -> Bool
|
||||||
has = path: target: let
|
has =
|
||||||
|
path: target:
|
||||||
|
let
|
||||||
name = builtins.head path;
|
name = builtins.head path;
|
||||||
rest = builtins.tail path;
|
rest = builtins.tail path;
|
||||||
in
|
in
|
||||||
if path == []
|
if path == [ ] then
|
||||||
then true
|
true
|
||||||
else if target ? ${name}
|
else if target ? ${name} then
|
||||||
then lib.attrs.has rest target.${name}
|
lib.attrs.has rest target.${name}
|
||||||
else false;
|
else
|
||||||
|
false;
|
||||||
|
|
||||||
## Depending on a given condition, either use the given value or an empty
|
## Depending on a given condition, either use the given value or an empty
|
||||||
## attribute set.
|
## attribute set.
|
||||||
##
|
##
|
||||||
## @type Attrs a b => Bool -> a -> a | b
|
## @type Attrs a b => Bool -> a -> a | b
|
||||||
when = condition: value:
|
when = condition: value: if condition then value else { };
|
||||||
if condition
|
|
||||||
then value
|
|
||||||
else {};
|
|
||||||
|
|
||||||
## Map an attribute set's names and values to a list.
|
## Map an attribute set's names and values to a list.
|
||||||
##
|
##
|
||||||
## @type Any a => (String -> Any -> a) -> Attrs -> List a
|
## @type Any a => (String -> Any -> a) -> Attrs -> List a
|
||||||
mapToList = f: target:
|
mapToList = f: target: builtins.map (name: f name target.${name}) (builtins.attrNames target);
|
||||||
builtins.map (name: f name target.${name}) (builtins.attrNames target);
|
|
||||||
|
|
||||||
## Map an attribute set recursively. Only non-set leaf nodes will be mapped.
|
## Map an attribute set recursively. Only non-set leaf nodes will be mapped.
|
||||||
##
|
##
|
||||||
## @type (List String -> Any -> Any) -> Attrs -> Attrs
|
## @type (List String -> Any -> Any) -> Attrs -> Attrs
|
||||||
mapRecursive = f: target:
|
mapRecursive = f: target: lib.attrs.mapRecursiveWhen (lib.fp.const true) f target;
|
||||||
lib.attrs.mapRecursiveWhen (lib.fp.const true) f target;
|
|
||||||
|
|
||||||
## Map an attribute set recursively when a given predicate returns true.
|
## Map an attribute set recursively when a given predicate returns true.
|
||||||
## Only leaf nodes according to the predicate will be mapped.
|
## Only leaf nodes according to the predicate will be mapped.
|
||||||
##
|
##
|
||||||
## @type (Attrs -> Bool) -> (List String -> Any -> Any) -> Attrs -> Attrs
|
## @type (Attrs -> Bool) -> (List String -> Any -> Any) -> Attrs -> Attrs
|
||||||
mapRecursiveWhen = predicate: f: target: let
|
mapRecursiveWhen =
|
||||||
process = path:
|
predicate: f: target:
|
||||||
|
let
|
||||||
|
process =
|
||||||
|
path:
|
||||||
builtins.mapAttrs (
|
builtins.mapAttrs (
|
||||||
name: value:
|
name: value:
|
||||||
if builtins.isAttrs value && predicate value
|
if builtins.isAttrs value && predicate value then
|
||||||
then process (path ++ [name]) value
|
process (path ++ [ name ]) value
|
||||||
else f (path ++ [name]) value
|
else
|
||||||
|
f (path ++ [ name ]) value
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
process [ ] target;
|
process [ ] target;
|
||||||
|
@ -165,14 +183,16 @@ lib: {
|
||||||
## on the base level of the attribute set.
|
## on the base level of the attribute set.
|
||||||
##
|
##
|
||||||
## @type (String -> Any -> Bool) -> Attrs -> Attrs
|
## @type (String -> Any -> Bool) -> Attrs -> Attrs
|
||||||
filter = predicate: target: let
|
filter =
|
||||||
|
predicate: target:
|
||||||
|
let
|
||||||
names = builtins.attrNames target;
|
names = builtins.attrNames target;
|
||||||
process = name: let
|
process =
|
||||||
|
name:
|
||||||
|
let
|
||||||
value = target.${name};
|
value = target.${name};
|
||||||
in
|
in
|
||||||
if predicate name value
|
if predicate name value then [ { inherit name value; } ] else [ ];
|
||||||
then [{inherit name value;}]
|
|
||||||
else [];
|
|
||||||
valid = builtins.concatMap process names;
|
valid = builtins.concatMap process names;
|
||||||
in
|
in
|
||||||
builtins.listToAttrs valid;
|
builtins.listToAttrs valid;
|
||||||
|
@ -181,13 +201,13 @@ lib: {
|
||||||
## applied to each name.
|
## applied to each name.
|
||||||
##
|
##
|
||||||
## @type (List String) -> (String -> Any) -> Attrs
|
## @type (List String) -> (String -> Any) -> Attrs
|
||||||
generate = names: f: let
|
generate =
|
||||||
pairs =
|
names: f:
|
||||||
builtins.map (name: {
|
let
|
||||||
|
pairs = builtins.map (name: {
|
||||||
inherit name;
|
inherit name;
|
||||||
value = f name;
|
value = f name;
|
||||||
})
|
}) names;
|
||||||
names;
|
|
||||||
in
|
in
|
||||||
builtins.listToAttrs pairs;
|
builtins.listToAttrs pairs;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
let
|
let
|
||||||
lib = import ./../default.nix;
|
lib = import ./../default.nix;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
"merge" = {
|
"merge" = {
|
||||||
"merges two shallow sets" = let
|
"merges two shallow sets" =
|
||||||
|
let
|
||||||
expected = {
|
expected = {
|
||||||
x = 1;
|
x = 1;
|
||||||
y = 2;
|
y = 2;
|
||||||
|
@ -12,7 +14,8 @@ in {
|
||||||
in
|
in
|
||||||
expected == actual;
|
expected == actual;
|
||||||
|
|
||||||
"overwrites values from the first set" = let
|
"overwrites values from the first set" =
|
||||||
|
let
|
||||||
expected = {
|
expected = {
|
||||||
x = 2;
|
x = 2;
|
||||||
};
|
};
|
||||||
|
@ -20,7 +23,8 @@ in {
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"does not merge nested sets" = let
|
"does not merge nested sets" =
|
||||||
|
let
|
||||||
expected = {
|
expected = {
|
||||||
x.y = 2;
|
x.y = 2;
|
||||||
};
|
};
|
||||||
|
@ -30,25 +34,29 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"mergeRecursiveUntil" = {
|
"mergeRecursiveUntil" = {
|
||||||
"merges with predicate" = let
|
"merges with predicate" =
|
||||||
|
let
|
||||||
expected = {
|
expected = {
|
||||||
x.y.z = 1;
|
x.y.z = 1;
|
||||||
};
|
};
|
||||||
actual =
|
actual = lib.attrs.mergeRecursiveUntil (
|
||||||
lib.attrs.mergeRecursiveUntil
|
path: x: y:
|
||||||
(path: x: y: lib.lists.last path == "z")
|
lib.lists.last path == "z"
|
||||||
{x.y.z = 2;}
|
) { x.y.z = 2; } { x.y.z = 1; };
|
||||||
{x.y.z = 1;};
|
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"handles shallow merges" = let
|
"handles shallow merges" =
|
||||||
|
let
|
||||||
expected = {
|
expected = {
|
||||||
x.y.z = 1;
|
x.y.z = 1;
|
||||||
};
|
};
|
||||||
actual =
|
actual =
|
||||||
lib.attrs.mergeRecursiveUntil
|
lib.attrs.mergeRecursiveUntil
|
||||||
(path: x: y: true)
|
(
|
||||||
|
path: x: y:
|
||||||
|
true
|
||||||
|
)
|
||||||
{
|
{
|
||||||
x = {
|
x = {
|
||||||
y.z = 2;
|
y.z = 2;
|
||||||
|
@ -62,32 +70,30 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"mergeRecursive" = {
|
"mergeRecursive" = {
|
||||||
"merges two sets deeply" = let
|
"merges two sets deeply" =
|
||||||
|
let
|
||||||
expected = {
|
expected = {
|
||||||
x.y.z = 1;
|
x.y.z = 1;
|
||||||
};
|
};
|
||||||
actual =
|
actual = lib.attrs.mergeRecursive { x.y.z = 2; } { x.y.z = 1; };
|
||||||
lib.attrs.mergeRecursive
|
|
||||||
{x.y.z = 2;}
|
|
||||||
{x.y.z = 1;};
|
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
};
|
};
|
||||||
|
|
||||||
"select" = {
|
"select" = {
|
||||||
"selects a nested value" = let
|
"selects a nested value" =
|
||||||
|
let
|
||||||
expected = "value";
|
expected = "value";
|
||||||
actual =
|
actual = lib.attrs.select [
|
||||||
lib.attrs.select
|
"x"
|
||||||
["x" "y" "z"]
|
"y"
|
||||||
null
|
"z"
|
||||||
{
|
] null { x.y.z = expected; };
|
||||||
x.y.z = expected;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"handles empty path" = let
|
"handles empty path" =
|
||||||
|
let
|
||||||
expected = {
|
expected = {
|
||||||
x = {
|
x = {
|
||||||
y = {
|
y = {
|
||||||
|
@ -95,11 +101,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
actual =
|
actual = lib.attrs.select [ ] null {
|
||||||
lib.attrs.select
|
|
||||||
[]
|
|
||||||
null
|
|
||||||
{
|
|
||||||
x = {
|
x = {
|
||||||
y = {
|
y = {
|
||||||
z = 1;
|
z = 1;
|
||||||
|
@ -109,30 +111,32 @@ in {
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"handles fallback value" = let
|
"handles fallback value" =
|
||||||
|
let
|
||||||
expected = "fallback";
|
expected = "fallback";
|
||||||
actual =
|
actual = lib.attrs.select [
|
||||||
lib.attrs.select
|
"x"
|
||||||
["x" "y" "z"]
|
"y"
|
||||||
expected
|
"z"
|
||||||
{};
|
] expected { };
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
};
|
};
|
||||||
|
|
||||||
"selectOrThrow" = {
|
"selectOrThrow" = {
|
||||||
"selects a nested value" = let
|
"selects a nested value" =
|
||||||
|
let
|
||||||
expected = "value";
|
expected = "value";
|
||||||
actual =
|
actual = lib.attrs.selectOrThrow [
|
||||||
lib.attrs.selectOrThrow
|
"x"
|
||||||
["x" "y" "z"]
|
"y"
|
||||||
{
|
"z"
|
||||||
x.y.z = expected;
|
] { x.y.z = expected; };
|
||||||
};
|
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"handles empty path" = let
|
"handles empty path" =
|
||||||
|
let
|
||||||
expected = {
|
expected = {
|
||||||
x = {
|
x = {
|
||||||
y = {
|
y = {
|
||||||
|
@ -140,10 +144,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
actual =
|
actual = lib.attrs.selectOrThrow [ ] {
|
||||||
lib.attrs.selectOrThrow
|
|
||||||
[]
|
|
||||||
{
|
|
||||||
x = {
|
x = {
|
||||||
y = {
|
y = {
|
||||||
z = 1;
|
z = 1;
|
||||||
|
@ -153,11 +154,13 @@ in {
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"throws on nonexistent path" = let
|
"throws on nonexistent path" =
|
||||||
actual =
|
let
|
||||||
lib.attrs.selectOrThrow
|
actual = lib.attrs.selectOrThrow [
|
||||||
["x" "y" "z"]
|
"x"
|
||||||
{};
|
"y"
|
||||||
|
"z"
|
||||||
|
] { };
|
||||||
|
|
||||||
evaluated = builtins.tryEval (builtins.deepSeq actual actual);
|
evaluated = builtins.tryEval (builtins.deepSeq actual actual);
|
||||||
in
|
in
|
||||||
|
@ -165,7 +168,8 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"set" = {
|
"set" = {
|
||||||
"creates a nested set" = let
|
"creates a nested set" =
|
||||||
|
let
|
||||||
expected = {
|
expected = {
|
||||||
x = {
|
x = {
|
||||||
y = {
|
y = {
|
||||||
|
@ -173,11 +177,16 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
actual = lib.attrs.set ["x" "y" "z"] 1;
|
actual = lib.attrs.set [
|
||||||
|
"x"
|
||||||
|
"y"
|
||||||
|
"z"
|
||||||
|
] 1;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"handles empty path" = let
|
"handles empty path" =
|
||||||
|
let
|
||||||
expected = 1;
|
expected = 1;
|
||||||
actual = lib.attrs.set [ ] 1;
|
actual = lib.attrs.set [ ] 1;
|
||||||
in
|
in
|
||||||
|
@ -185,30 +194,43 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"has" = {
|
"has" = {
|
||||||
"returns true for a nested value" = let
|
"returns true for a nested value" =
|
||||||
exists = lib.attrs.has ["x" "y" "z"] {x.y.z = 1;};
|
let
|
||||||
|
exists = lib.attrs.has [
|
||||||
|
"x"
|
||||||
|
"y"
|
||||||
|
"z"
|
||||||
|
] { x.y.z = 1; };
|
||||||
in
|
in
|
||||||
exists;
|
exists;
|
||||||
|
|
||||||
"returns false for a nonexistent value" = let
|
"returns false for a nonexistent value" =
|
||||||
exists = lib.attrs.has ["x" "y" "z"] {};
|
let
|
||||||
|
exists = lib.attrs.has [
|
||||||
|
"x"
|
||||||
|
"y"
|
||||||
|
"z"
|
||||||
|
] { };
|
||||||
in
|
in
|
||||||
!exists;
|
!exists;
|
||||||
|
|
||||||
"handles empty path" = let
|
"handles empty path" =
|
||||||
|
let
|
||||||
exists = lib.attrs.has [ ] { };
|
exists = lib.attrs.has [ ] { };
|
||||||
in
|
in
|
||||||
exists;
|
exists;
|
||||||
};
|
};
|
||||||
|
|
||||||
"when" = {
|
"when" = {
|
||||||
"returns the value when condition is true" = let
|
"returns the value when condition is true" =
|
||||||
|
let
|
||||||
expected = "value";
|
expected = "value";
|
||||||
actual = lib.attrs.when true expected;
|
actual = lib.attrs.when true expected;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"returns an empty set when condition is false" = let
|
"returns an empty set when condition is false" =
|
||||||
|
let
|
||||||
expected = { };
|
expected = { };
|
||||||
actual = lib.attrs.when false "value";
|
actual = lib.attrs.when false "value";
|
||||||
in
|
in
|
||||||
|
@ -216,7 +238,8 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"mapToList" = {
|
"mapToList" = {
|
||||||
"converts a set to a list" = let
|
"converts a set to a list" =
|
||||||
|
let
|
||||||
expected = [
|
expected = [
|
||||||
{
|
{
|
||||||
name = "x";
|
name = "x";
|
||||||
|
@ -227,10 +250,7 @@ in {
|
||||||
value = 2;
|
value = 2;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
actual =
|
actual = lib.attrs.mapToList (name: value: { inherit name value; }) {
|
||||||
lib.attrs.mapToList
|
|
||||||
(name: value: {inherit name value;})
|
|
||||||
{
|
|
||||||
x = 1;
|
x = 1;
|
||||||
y = 2;
|
y = 2;
|
||||||
};
|
};
|
||||||
|
@ -239,7 +259,8 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"mapRecursiveWhen" = {
|
"mapRecursiveWhen" = {
|
||||||
"maps a set recursively" = let
|
"maps a set recursively" =
|
||||||
|
let
|
||||||
expected = {
|
expected = {
|
||||||
x = {
|
x = {
|
||||||
y = {
|
y = {
|
||||||
|
@ -247,11 +268,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
actual =
|
actual = lib.attrs.mapRecursiveWhen (value: true) (path: value: value + 1) {
|
||||||
lib.attrs.mapRecursiveWhen
|
|
||||||
(value: true)
|
|
||||||
(path: value: value + 1)
|
|
||||||
{
|
|
||||||
x = {
|
x = {
|
||||||
y = {
|
y = {
|
||||||
z = 1;
|
z = 1;
|
||||||
|
@ -261,7 +278,8 @@ in {
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"maps a set given a condition" = let
|
"maps a set given a condition" =
|
||||||
|
let
|
||||||
expected = {
|
expected = {
|
||||||
x = {
|
x = {
|
||||||
y = {
|
y = {
|
||||||
|
@ -270,13 +288,12 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
actual =
|
actual =
|
||||||
lib.attrs.mapRecursiveWhen
|
lib.attrs.mapRecursiveWhen (value: !(value ? z))
|
||||||
(value: !(value ? z))
|
(
|
||||||
(path: value:
|
path: value:
|
||||||
# We map before we get to a non-set value
|
# We map before we get to a non-set value
|
||||||
if builtins.isAttrs value
|
if builtins.isAttrs value then value else value + 1
|
||||||
then value
|
)
|
||||||
else value + 1)
|
|
||||||
{
|
{
|
||||||
x = {
|
x = {
|
||||||
y = {
|
y = {
|
||||||
|
@ -289,7 +306,8 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"mapRecursive" = {
|
"mapRecursive" = {
|
||||||
"maps a set recursively" = let
|
"maps a set recursively" =
|
||||||
|
let
|
||||||
expected = {
|
expected = {
|
||||||
x = {
|
x = {
|
||||||
y = {
|
y = {
|
||||||
|
@ -297,10 +315,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
actual =
|
actual = lib.attrs.mapRecursive (path: value: value + 1) {
|
||||||
lib.attrs.mapRecursive
|
|
||||||
(path: value: value + 1)
|
|
||||||
{
|
|
||||||
x = {
|
x = {
|
||||||
y = {
|
y = {
|
||||||
z = 1;
|
z = 1;
|
||||||
|
@ -312,14 +327,12 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"filter" = {
|
"filter" = {
|
||||||
"filters a set" = let
|
"filters a set" =
|
||||||
|
let
|
||||||
expected = {
|
expected = {
|
||||||
y = 2;
|
y = 2;
|
||||||
};
|
};
|
||||||
actual =
|
actual = lib.attrs.filter (name: value: name == "y") {
|
||||||
lib.attrs.filter
|
|
||||||
(name: value: name == "y")
|
|
||||||
{
|
|
||||||
x = 1;
|
x = 1;
|
||||||
y = 2;
|
y = 2;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,28 +4,21 @@ lib: {
|
||||||
## Convert a boolean value into a string.
|
## Convert a boolean value into a string.
|
||||||
##
|
##
|
||||||
## @type Bool -> String
|
## @type Bool -> String
|
||||||
string = value:
|
string = value: if value then "true" else "false";
|
||||||
if value
|
|
||||||
then "true"
|
|
||||||
else "false";
|
|
||||||
|
|
||||||
## Convert a boolean into either the string "yes" or "no".
|
## Convert a boolean into either the string "yes" or "no".
|
||||||
##
|
##
|
||||||
## @type Bool -> String
|
## @type Bool -> String
|
||||||
yesno = value:
|
yesno = value: if value then "yes" else "no";
|
||||||
if value
|
|
||||||
then "yes"
|
|
||||||
else "no";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
## Choose between two values based on a condition. When true, the first value
|
## Choose between two values based on a condition. When true, the first value
|
||||||
## is returned, otherwise the second value is returned.
|
## is returned, otherwise the second value is returned.
|
||||||
##
|
##
|
||||||
## @type Bool -> a -> b -> a | b
|
## @type Bool -> a -> b -> a | b
|
||||||
when = condition: x: y:
|
when =
|
||||||
if condition
|
condition: x: y:
|
||||||
then x
|
if condition then x else y;
|
||||||
else y;
|
|
||||||
|
|
||||||
## Perform a logical AND operation on two values.
|
## Perform a logical AND operation on two values.
|
||||||
##
|
##
|
||||||
|
@ -35,9 +28,7 @@ lib: {
|
||||||
## Perform a logical AND operation on two functions being applied to a value.
|
## Perform a logical AND operation on two functions being applied to a value.
|
||||||
##
|
##
|
||||||
## @type (a -> Bool) -> (a -> Bool) -> a -> Bool
|
## @type (a -> Bool) -> (a -> Bool) -> a -> Bool
|
||||||
and' = f: g: (
|
and' = f: g: (x: (f x) && (g x));
|
||||||
x: (f x) && (g x)
|
|
||||||
);
|
|
||||||
|
|
||||||
## Perform a logical OR operation on two values.
|
## Perform a logical OR operation on two values.
|
||||||
##
|
##
|
||||||
|
@ -47,9 +38,7 @@ lib: {
|
||||||
## Perform a logical OR operation on two functions being applied to a value.
|
## Perform a logical OR operation on two functions being applied to a value.
|
||||||
##
|
##
|
||||||
## @type (a -> Bool) -> (a -> Bool) -> a -> Bool
|
## @type (a -> Bool) -> (a -> Bool) -> a -> Bool
|
||||||
or' = f: g: (
|
or' = f: g: (x: (f x) || (g x));
|
||||||
x: (f x) || (g x)
|
|
||||||
);
|
|
||||||
|
|
||||||
## Perform a logical NOT operation on a value.
|
## Perform a logical NOT operation on a value.
|
||||||
##
|
##
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
let
|
let
|
||||||
lib = import ./../default.nix;
|
lib = import ./../default.nix;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
"into" = {
|
"into" = {
|
||||||
"string" = {
|
"string" = {
|
||||||
"handles true" = let
|
"handles true" =
|
||||||
|
let
|
||||||
expected = "true";
|
expected = "true";
|
||||||
actual = lib.bools.into.string true;
|
actual = lib.bools.into.string true;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"handles false" = let
|
"handles false" =
|
||||||
|
let
|
||||||
expected = "false";
|
expected = "false";
|
||||||
actual = lib.bools.into.string false;
|
actual = lib.bools.into.string false;
|
||||||
in
|
in
|
||||||
|
@ -17,12 +20,14 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"yesno" = {
|
"yesno" = {
|
||||||
"handles true" = let
|
"handles true" =
|
||||||
|
let
|
||||||
expected = "yes";
|
expected = "yes";
|
||||||
actual = lib.bools.into.yesno true;
|
actual = lib.bools.into.yesno true;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
"handles false" = let
|
"handles false" =
|
||||||
|
let
|
||||||
expected = "no";
|
expected = "no";
|
||||||
actual = lib.bools.into.yesno false;
|
actual = lib.bools.into.yesno false;
|
||||||
in
|
in
|
||||||
|
@ -31,13 +36,15 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"when" = {
|
"when" = {
|
||||||
"returns first value when true" = let
|
"returns first value when true" =
|
||||||
|
let
|
||||||
expected = "foo";
|
expected = "foo";
|
||||||
actual = lib.bools.when true expected "bar";
|
actual = lib.bools.when true expected "bar";
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"returns second value when false" = let
|
"returns second value when false" =
|
||||||
|
let
|
||||||
expected = "bar";
|
expected = "bar";
|
||||||
actual = lib.bools.when false "foo" expected;
|
actual = lib.bools.when false "foo" expected;
|
||||||
in
|
in
|
||||||
|
@ -45,51 +52,61 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"and" = {
|
"and" = {
|
||||||
"returns true when both are true" = let
|
"returns true when both are true" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.bools.and true true;
|
actual = lib.bools.and true true;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
"returns false when first is false" = let
|
"returns false when first is false" =
|
||||||
|
let
|
||||||
expected = false;
|
expected = false;
|
||||||
actual = lib.bools.and false true;
|
actual = lib.bools.and false true;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
"returns false when second is false" = let
|
"returns false when second is false" =
|
||||||
|
let
|
||||||
expected = false;
|
expected = false;
|
||||||
actual = lib.bools.and true false;
|
actual = lib.bools.and true false;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
"returns false when both are false" = let
|
"returns false when both are false" =
|
||||||
|
let
|
||||||
expected = false;
|
expected = false;
|
||||||
actual = lib.bools.and false false;
|
actual = lib.bools.and false false;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
};
|
};
|
||||||
|
|
||||||
"and'" = let
|
"and'" =
|
||||||
|
let
|
||||||
getTrue = _: true;
|
getTrue = _: true;
|
||||||
getFalse = _: false;
|
getFalse = _: false;
|
||||||
in {
|
in
|
||||||
"returns true when both are true" = let
|
{
|
||||||
|
"returns true when both are true" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.bools.and' getTrue getTrue null;
|
actual = lib.bools.and' getTrue getTrue null;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"returns false when first is false" = let
|
"returns false when first is false" =
|
||||||
|
let
|
||||||
expected = false;
|
expected = false;
|
||||||
actual = lib.bools.and' getFalse getTrue null;
|
actual = lib.bools.and' getFalse getTrue null;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"returns false when second is false" = let
|
"returns false when second is false" =
|
||||||
|
let
|
||||||
expected = false;
|
expected = false;
|
||||||
actual = lib.bools.and' getTrue getFalse null;
|
actual = lib.bools.and' getTrue getFalse null;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"returns false when both are false" = let
|
"returns false when both are false" =
|
||||||
|
let
|
||||||
expected = false;
|
expected = false;
|
||||||
actual = lib.bools.and' getFalse getFalse null;
|
actual = lib.bools.and' getFalse getFalse null;
|
||||||
in
|
in
|
||||||
|
@ -97,48 +114,58 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"or" = {
|
"or" = {
|
||||||
"returns true when both are true" = let
|
"returns true when both are true" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.bools.or true true;
|
actual = lib.bools.or true true;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
"returns true when first is true" = let
|
"returns true when first is true" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.bools.or true false;
|
actual = lib.bools.or true false;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
"returns true when second is true" = let
|
"returns true when second is true" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.bools.or false true;
|
actual = lib.bools.or false true;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
"returns false when both are false" = let
|
"returns false when both are false" =
|
||||||
|
let
|
||||||
expected = false;
|
expected = false;
|
||||||
actual = lib.bools.or false false;
|
actual = lib.bools.or false false;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
};
|
};
|
||||||
|
|
||||||
"or'" = let
|
"or'" =
|
||||||
|
let
|
||||||
getTrue = _: true;
|
getTrue = _: true;
|
||||||
getFalse = _: false;
|
getFalse = _: false;
|
||||||
in {
|
in
|
||||||
"returns true when both are true" = let
|
{
|
||||||
|
"returns true when both are true" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.bools.or' getTrue getTrue null;
|
actual = lib.bools.or' getTrue getTrue null;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
"returns true when first is true" = let
|
"returns true when first is true" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.bools.or' getTrue getFalse null;
|
actual = lib.bools.or' getTrue getFalse null;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
"returns true when second is true" = let
|
"returns true when second is true" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.bools.or' getFalse getTrue null;
|
actual = lib.bools.or' getFalse getTrue null;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
"returns false when both are false" = let
|
"returns false when both are false" =
|
||||||
|
let
|
||||||
expected = false;
|
expected = false;
|
||||||
actual = lib.bools.or' getFalse getFalse null;
|
actual = lib.bools.or' getFalse getFalse null;
|
||||||
in
|
in
|
||||||
|
@ -146,13 +173,15 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"not" = {
|
"not" = {
|
||||||
"returns false when true" = let
|
"returns false when true" =
|
||||||
|
let
|
||||||
expected = false;
|
expected = false;
|
||||||
actual = lib.bools.not true;
|
actual = lib.bools.not true;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"returns true when false" = let
|
"returns true when false" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.bools.not false;
|
actual = lib.bools.not false;
|
||||||
in
|
in
|
||||||
|
|
|
@ -4,31 +4,30 @@ lib: {
|
||||||
## Check that a value is a DAG entry.
|
## Check that a value is a DAG entry.
|
||||||
##
|
##
|
||||||
## @type a -> Bool
|
## @type a -> Bool
|
||||||
entry = value:
|
entry = value: (value ? value) && (value ? before) && (value ? after);
|
||||||
(value ? value)
|
|
||||||
&& (value ? before)
|
|
||||||
&& (value ? after);
|
|
||||||
|
|
||||||
## Check that a value is a DAG.
|
## Check that a value is a DAG.
|
||||||
##
|
##
|
||||||
## @type a -> Bool
|
## @type a -> Bool
|
||||||
graph = value: let
|
graph =
|
||||||
|
value:
|
||||||
|
let
|
||||||
isContentsValid = builtins.all lib.dag.validate.entry (builtins.attrValues value);
|
isContentsValid = builtins.all lib.dag.validate.entry (builtins.attrValues value);
|
||||||
in
|
in
|
||||||
builtins.isAttrs value
|
builtins.isAttrs value && isContentsValid;
|
||||||
&& isContentsValid;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sort = {
|
sort = {
|
||||||
## Apply a topological sort to a DAG.
|
## Apply a topological sort to a DAG.
|
||||||
##
|
##
|
||||||
## @type Dag a -> { result :: List a } | { cycle :: List a, loops :: List a }
|
## @type Dag a -> { result :: List a } | { cycle :: List a, loops :: List a }
|
||||||
topographic = graph: let
|
topographic =
|
||||||
getEntriesBefore = graph: name: let
|
graph:
|
||||||
before =
|
let
|
||||||
lib.attrs.filter
|
getEntriesBefore =
|
||||||
(key: value: builtins.elem name value.before)
|
graph: name:
|
||||||
graph;
|
let
|
||||||
|
before = lib.attrs.filter (key: value: builtins.elem name value.before) graph;
|
||||||
in
|
in
|
||||||
builtins.attrNames before;
|
builtins.attrNames before;
|
||||||
|
|
||||||
|
@ -46,16 +45,15 @@ lib: {
|
||||||
|
|
||||||
sorted = lib.lists.sort.topographic isBefore entries;
|
sorted = lib.lists.sort.topographic isBefore entries;
|
||||||
in
|
in
|
||||||
if sorted ? result
|
if sorted ? result then
|
||||||
then {
|
{
|
||||||
result =
|
result = builtins.map (value: {
|
||||||
builtins.map (value: {
|
|
||||||
name = value.name;
|
name = value.name;
|
||||||
value = value.value;
|
value = value.value;
|
||||||
})
|
}) sorted.result;
|
||||||
sorted.result;
|
|
||||||
}
|
}
|
||||||
else sorted;
|
else
|
||||||
|
sorted;
|
||||||
};
|
};
|
||||||
|
|
||||||
apply = {
|
apply = {
|
||||||
|
@ -63,15 +61,14 @@ lib: {
|
||||||
## and any entries that do exist are given the appropriate `before` and `after` values.
|
## and any entries that do exist are given the appropriate `before` and `after` values.
|
||||||
##
|
##
|
||||||
## @type Dag a -> Dag a -> Dag a
|
## @type Dag a -> Dag a -> Dag a
|
||||||
defaults = graph: defaults: let
|
defaults =
|
||||||
result =
|
graph: defaults:
|
||||||
builtins.mapAttrs
|
let
|
||||||
(
|
result = builtins.mapAttrs (
|
||||||
name: entry:
|
name: entry:
|
||||||
if defaults ? ${name}
|
if defaults ? ${name} then
|
||||||
then
|
if builtins.isString entry then
|
||||||
if builtins.isString entry
|
{
|
||||||
then {
|
|
||||||
value = entry;
|
value = entry;
|
||||||
before = defaults.${name}.before or [ ];
|
before = defaults.${name}.before or [ ];
|
||||||
after = defaults.${name}.after or [ ];
|
after = defaults.${name}.after or [ ];
|
||||||
|
@ -82,9 +79,9 @@ lib: {
|
||||||
before = (entry.before or [ ]) ++ (defaults.${name}.before or [ ]);
|
before = (entry.before or [ ]) ++ (defaults.${name}.before or [ ]);
|
||||||
after = (entry.after or [ ]) ++ (defaults.${name}.after or [ ]);
|
after = (entry.after or [ ]) ++ (defaults.${name}.after or [ ]);
|
||||||
}
|
}
|
||||||
else entry
|
else
|
||||||
)
|
entry
|
||||||
graph;
|
) graph;
|
||||||
in
|
in
|
||||||
defaults // result;
|
defaults // result;
|
||||||
};
|
};
|
||||||
|
@ -92,21 +89,13 @@ lib: {
|
||||||
## Map over the entries in a DAG and modify their values.
|
## Map over the entries in a DAG and modify their values.
|
||||||
##
|
##
|
||||||
## @type (String -> a -> b) -> Dag a -> Dag b
|
## @type (String -> a -> b) -> Dag a -> Dag b
|
||||||
map = f:
|
map = f: builtins.mapAttrs (name: value: value // { value = f name value.value; });
|
||||||
builtins.mapAttrs
|
|
||||||
(name: value:
|
|
||||||
value
|
|
||||||
// {
|
|
||||||
value = f name value.value;
|
|
||||||
});
|
|
||||||
|
|
||||||
entry = {
|
entry = {
|
||||||
## Create a new DAG entry.
|
## Create a new DAG entry.
|
||||||
##
|
##
|
||||||
## @type List String -> List String -> a -> { before :: List String, after :: List String, value :: a }
|
## @type List String -> List String -> a -> { before :: List String, after :: List String, value :: a }
|
||||||
between = before: after: value: {
|
between = before: after: value: { inherit before after value; };
|
||||||
inherit before after value;
|
|
||||||
};
|
|
||||||
|
|
||||||
## Create a new DAG entry with no dependencies.
|
## Create a new DAG entry with no dependencies.
|
||||||
##
|
##
|
||||||
|
@ -128,25 +117,22 @@ lib: {
|
||||||
## Create a DAG from a list of entries, prefixed with a tag.
|
## Create a DAG from a list of entries, prefixed with a tag.
|
||||||
##
|
##
|
||||||
## @type String -> List String -> List String -> List a -> Dag a
|
## @type String -> List String -> List String -> List a -> Dag a
|
||||||
between = tag: let
|
between =
|
||||||
process = i: before: after: entries: let
|
tag:
|
||||||
|
let
|
||||||
|
process =
|
||||||
|
i: before: after: entries:
|
||||||
|
let
|
||||||
name = "${tag}-${builtins.toString i}";
|
name = "${tag}-${builtins.toString i}";
|
||||||
entry = builtins.head entries;
|
entry = builtins.head entries;
|
||||||
rest = builtins.tail entries;
|
rest = builtins.tail entries;
|
||||||
in
|
in
|
||||||
if builtins.length entries == 0
|
if builtins.length entries == 0 then
|
||||||
then {}
|
{ }
|
||||||
else if builtins.length entries == 1
|
else if builtins.length entries == 1 then
|
||||||
then {
|
{ "${name}" = lib.dag.entry.between before after entry; }
|
||||||
"${name}" = lib.dag.entry.between before after entry;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{ "${name}" = lib.dag.entry.after after entry; } // (process (i + 1) before [ name ] rest);
|
||||||
"${name}" = lib.dag.entry.after after entry;
|
|
||||||
}
|
|
||||||
// (
|
|
||||||
process (i + 1) before [name] rest
|
|
||||||
);
|
|
||||||
in
|
in
|
||||||
process 0;
|
process 0;
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
let
|
let
|
||||||
lib = import ./../default.nix;
|
lib = import ./../default.nix;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
"validate" = {
|
"validate" = {
|
||||||
"entry" = {
|
"entry" = {
|
||||||
"invalid value" = let
|
"invalid value" =
|
||||||
|
let
|
||||||
expected = false;
|
expected = false;
|
||||||
actual = lib.dag.validate.entry { };
|
actual = lib.dag.validate.entry { };
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"a manually created value" = let
|
"a manually created value" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.dag.validate.entry {
|
actual = lib.dag.validate.entry {
|
||||||
value = null;
|
value = null;
|
||||||
|
@ -19,25 +22,29 @@ in {
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"entry.between" = let
|
"entry.between" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.dag.validate.entry (lib.dag.entry.between [ ] [ ] null);
|
actual = lib.dag.validate.entry (lib.dag.entry.between [ ] [ ] null);
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"entry.anywhere" = let
|
"entry.anywhere" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.dag.validate.entry (lib.dag.entry.anywhere null);
|
actual = lib.dag.validate.entry (lib.dag.entry.anywhere null);
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"entry.before" = let
|
"entry.before" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.dag.validate.entry (lib.dag.entry.before [ ] null);
|
actual = lib.dag.validate.entry (lib.dag.entry.before [ ] null);
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"entry.after" = let
|
"entry.after" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.dag.validate.entry (lib.dag.entry.after [ ] null);
|
actual = lib.dag.validate.entry (lib.dag.entry.after [ ] null);
|
||||||
in
|
in
|
||||||
|
@ -45,15 +52,15 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"graph" = {
|
"graph" = {
|
||||||
"invalid value" = let
|
"invalid value" =
|
||||||
|
let
|
||||||
expected = false;
|
expected = false;
|
||||||
actual = lib.dag.validate.graph {
|
actual = lib.dag.validate.graph { x = { }; };
|
||||||
x = {};
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"a manually created value" = let
|
"a manually created value" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
actual = lib.dag.validate.graph {
|
actual = lib.dag.validate.graph {
|
||||||
x = {
|
x = {
|
||||||
|
@ -65,30 +72,46 @@ in {
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"entries.between" = let
|
"entries.between" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
graph = lib.dag.entries.between "example" [] [] [null null];
|
graph = lib.dag.entries.between "example" [ ] [ ] [
|
||||||
|
null
|
||||||
|
null
|
||||||
|
];
|
||||||
actual = lib.dag.validate.graph graph;
|
actual = lib.dag.validate.graph graph;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"entries.anywhere" = let
|
"entries.anywhere" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
graph = lib.dag.entries.anywhere "example" [null null];
|
graph = lib.dag.entries.anywhere "example" [
|
||||||
|
null
|
||||||
|
null
|
||||||
|
];
|
||||||
actual = lib.dag.validate.graph graph;
|
actual = lib.dag.validate.graph graph;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"entries.before" = let
|
"entries.before" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
graph = lib.dag.entries.before "example" [] [null null];
|
graph = lib.dag.entries.before "example" [ ] [
|
||||||
|
null
|
||||||
|
null
|
||||||
|
];
|
||||||
actual = lib.dag.validate.graph graph;
|
actual = lib.dag.validate.graph graph;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
|
||||||
"entries.after" = let
|
"entries.after" =
|
||||||
|
let
|
||||||
expected = true;
|
expected = true;
|
||||||
graph = lib.dag.entries.after "example" [] [null null];
|
graph = lib.dag.entries.after "example" [ ] [
|
||||||
|
null
|
||||||
|
null
|
||||||
|
];
|
||||||
actual = lib.dag.validate.graph graph;
|
actual = lib.dag.validate.graph graph;
|
||||||
in
|
in
|
||||||
actual == expected;
|
actual == expected;
|
||||||
|
@ -97,13 +120,15 @@ in {
|
||||||
|
|
||||||
"sort" = {
|
"sort" = {
|
||||||
"topographic" = {
|
"topographic" = {
|
||||||
"handles an empty graph" = let
|
"handles an empty graph" =
|
||||||
|
let
|
||||||
expected = [ ];
|
expected = [ ];
|
||||||
actual = lib.dag.sort.topographic { };
|
actual = lib.dag.sort.topographic { };
|
||||||
in
|
in
|
||||||
actual.result == expected;
|
actual.result == expected;
|
||||||
|
|
||||||
"sorts a graph" = let
|
"sorts a graph" =
|
||||||
|
let
|
||||||
expected = [
|
expected = [
|
||||||
{
|
{
|
||||||
name = "a";
|
name = "a";
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue