Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,13 @@ jobs:
run: cd test/integrity && ./bld.sh
format:
runs-on: ubuntu-latest
env:
NIX_PATH: nixpkgs=https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v28
- name: Code Format Check
run: eval "$(nix print-dev-env -f shell.nix)" && treefmt --fail-on-change
std-config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v28
- name: Std Library Config Test
run: cd test/std-import && ./import.sh > /dev/null
features:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v28
- name: Feature Parsing Test
run: cd test/features && ./resolve.sh > /dev/null
purity:
runs-on: ubuntu-latest
steps:
Expand Down
14 changes: 2 additions & 12 deletions atom-nix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,7 @@ name = "dev"
version = "0.1.0"
description = "Development environment"

[features]
default = []

[fetch.pkgs]
name = "nixpkgs"
import = true
args = [{}]
# TODO
```

## Usage (Unstable)
Expand All @@ -128,11 +122,7 @@ let
atom = builtins.fetchGit "https://github.com/ekala-project/atom";
importAtom = import "${atom}/atom-nix/core/importAtom.nix";
in
importAtom {
features = [
# enabled flags
];
} ./atom-nix/dev.toml
importAtom { path = ./atom-nix/dev; }
```

## Future Directions: Ekala Platform
Expand Down
106 changes: 16 additions & 90 deletions atom-nix/core/compose.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,40 +58,15 @@ let
core = import ./mod.nix;
in
{
src,
root,
config,
extern ? { },
features ? [ ],
# internal features of the composer function
stdFeatures ? core.stdToml.features.default or [ ],
coreFeatures ? core.coreToml.features.default,
# enable testing code paths
__internal__test ? false,
__isStd__ ? false,
cfg,
get ? { },
}:
let
par = (root + "/${src}");

std = core.importStd {
features = stdFeatures;
inherit __internal__test;
} (../. + "/std@.toml");

coreFeatures' = core.features.resolve core.coreToml.features coreFeatures;
stdFeatures' = core.features.resolve core.stdToml.features stdFeatures;

cfg = config // {
features = config.features or { } // {
resolved = {
atom = features;
core = coreFeatures';
std = stdFeatures';
};
};
};

msg = core.errors.debugMsg config;
std = core.importStd (../std);

msg = core.errors.debugMsg cfg;

f =
f: pre: dir:
Expand All @@ -105,8 +80,13 @@ let

scope =
let
scope' = with core; {
inherit cfg;
static = with core; {
inherit
cfg
std
atom
get
;
mod = modScope;
builtins = std;
import = errors.import;
Expand All @@ -118,35 +98,10 @@ let
__storePath = errors.storePath;
__getEnv = errors.getEnv "";
__getFlake = errors.import;
get = extern;
};

scope'' = core.set.inject scope' [
preOpt
{
_if = !__isStd__;
atom = atomScope;
_else.std = atomScope;
}
{
_if = !__isStd__ && l.elem "std" coreFeatures';
inherit std;
}
{
_if = __internal__test;
# information about the internal module system itself
# available to tests
__internal = {
# a copy of the global scope, for testing if values exist
# for our internal testing functions
scope = scope'';
inherit __isStd__ __internal__test;
src = core;
};
}
];
in
scope'';
core.set.inject static [ preOpt ];

Import = scopedImport scope;

Expand All @@ -164,7 +119,7 @@ let
{
${file.name} =
let
trace = core.errors.modPath par dir;
trace = core.errors.modPath root dir;
in
core.errors.context (msg "${trace}.${file.name}") member;
}
Expand All @@ -183,7 +138,7 @@ let
name = baseNameOf path;
}
);
trace = core.errors.modPath par dir;
trace = core.errors.modPath root dir;
in
assert core.modIsValid module dir;
core.filterMap g contents // (core.errors.context (msg trace) module);
Expand All @@ -195,35 +150,6 @@ let
# Base case: no module
{ };

atomScope = l.removeAttrs atom [
"atom"
(baseNameOf par)
];

atom =
let
fixed = core.fix f null par;
in
core.set.inject fixed [
({ _if = __isStd__; } // core.pureBuiltinsForStd fixed)
{
_if = __isStd__ && l.elem "lib" cfg.features.resolved.atom;
inherit (extern) lib;
}
{
_if = __isStd__ && __internal__test;
__internal = {
inherit __isStd__;
};
}
];
atom = core.fix f null root;
in
assert
!__internal__test
# older versions of Nix don't have the `warn` builtin
|| core.errors.warn ''
in ${toString ./default.nix}:
Internal testing functionality is enabled via the `__test` boolean.
This should never be `true` except in internal test runs.
'' true;
atom
65 changes: 0 additions & 65 deletions atom-nix/core/features.nix

This file was deleted.

Loading
Loading