Skip to content

Commit

Permalink
refactor(yants/types): enhance types check
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Nov 9, 2023
1 parent 959c9dd commit 64d6f3a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
7 changes: 4 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
POP.url = "github:divnix/POP";
POP.inputs.nixpkgs.follows = "";
POP.inputs.flake-compat.follows = "";
yants.url = "github:divnix/yants";
yants.url = "github:divnix/yants/?ref=refs/pull/5/head";

haumea.url = "github:nix-community/haumea";
haumea.inputs.nixpkgs.follows = "nixlib";
Expand Down
5 changes: 4 additions & 1 deletion local/cells/repo/configs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
{ inputs, cell }:
with inputs.std.inputs.dmerge; {
conform.data = {
commit.conventional.scopes = append [ "nixosModules" ];
commit.conventional.scopes = append [
"nixosModules"
"yants"
];
};
}
4 changes: 2 additions & 2 deletions src/haumea/pops.nix
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ let
defun
(
with types; [
(either haumeaInitLoadPop (attrs any))
(either haumeaLoadExtenderPop haumeaLoadExtender)
haumeaDefaultPop
]
)
Expand All @@ -165,7 +165,7 @@ let
defun
(
with types; [
(either (list haumeaInitLoadPop) (list (attrs any)))
(either (list haumeaLoadExtenderPop) (list haumeaLoadExtender))
haumeaDefaultPop
]
)
Expand Down
14 changes: 13 additions & 1 deletion src/haumea/structAttrs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ let

addExporters = function;
addExporter = function;
load = attrs any;
initLoad = struct "haumea.load" structAttrs.haumeaLoad;

outputs = function;
layouts = attrs any;
};

haumeaExporterPop = structAttrs.pop // {
Expand All @@ -52,7 +57,6 @@ let
setLoad = function;
setOutputs = function;
};

haumeaLoad = {
src = either path string;
transformer = either function (list any);
Expand All @@ -68,9 +72,17 @@ let
]
"type";
};

haumeaLoadExtender = {
load = structOption "haumea.load" structAttrs.haumeaLoad;
};

haumeaLoadExtenderPop = structAttrs.pop // structAttrs.haumeaInitLoadPop;

haumeaLoadPop = structAttrs.pop // structAttrs.haumeaLoad;
haumeaInitLoadPop = structAttrs.pop // rec {
initLoad = struct "haumea.load" structAttrs.haumeaLoad;
load = structAttrs.haumeaLoadExtender.load;
#list (either function any);
setInit = function;
};
Expand Down
6 changes: 5 additions & 1 deletion src/haumea/types.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@
root,
super,
}:
with (yants "flops");
with (yants "flops.haumea");
let
inherit (super.structAttrs)
haumeaLoadPop
haumeaExporterPop
haumeaInitLoadPop
haumeaDefaultPop
haumeaLoadExtender
haumeaLoadExtenderPop
pop
;
inherit (haumeaInitLoadPop) initLoad;
in
{
pop = openStruct pop;
haumeaLoadExtender = struct "loadPop" haumeaLoadExtender;
haumeaLoadExtenderPop = struct "loadExtenderPop" haumeaLoadExtenderPop;
haumeaLoadPop = openStruct haumeaLoadPop;
haumeaExporterPop = openStruct haumeaExporterPop;
haumeaDefaultPop = openStruct haumeaDefaultPop;
Expand Down

0 comments on commit 64d6f3a

Please sign in to comment.