use providerType in aspects #2

open
opened by oeiuwq.com targeting main from provider
Changed files
+16 -17
.github
workflows
checkmate
nix
+2 -1
.github/workflows/test.yml
···
runs-on: ubuntu-latest
steps:
- uses: cachix/install-nix-action@v30
-
- run: nix flake check -L github:$GITHUB_REPOSITORY/$GITHUB_SHA?dir=checkmate --override-input target github:$GITHUB_REPOSITORY/$GITHUB_SHA
+
- uses: actions/checkout@v5
+
- run: nix flake check -L ./checkmate --override-input target .
+10 -6
checkmate/flake.lock
···
},
"target": {
"locked": {
-
"path": "..",
-
"type": "path"
+
"lastModified": 1763763502,
+
"narHash": "sha256-J78S02ZbBclWz7WKF8C+kHUca9/KdHtSeRgO/WF9LjY=",
+
"owner": "vic",
+
"repo": "flake-aspects",
+
"rev": "83c8e44186bc9631509a55cf5a053950ecd3dc30",
+
"type": "github"
},
"original": {
-
"path": "..",
-
"type": "path"
-
},
-
"parent": []
+
"owner": "vic",
+
"repo": "flake-aspects",
+
"type": "github"
+
}
},
"treefmt-nix": {
"inputs": {
+1 -1
checkmate/flake.nix
···
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules);
inputs = {
-
target.url = "path:..";
+
target.url = "github:vic/flake-aspects";
flake-parts = {
inputs.nixpkgs-lib.follows = "nixpkgs-lib";
url = "github:hercules-ci/flake-parts";
+3 -9
nix/types.nix
···
aspectsType = lib.types.submodule (
{ config, ... }:
{
-
freeformType = lib.types.attrsOf (lib.types.either aspectSubmoduleAttrs providerType);
+
freeformType = lib.types.attrsOf providerType;
config._module.args.aspects = config;
}
);
···
);
functionProviderType = lib.types.either functionToAspect (lib.types.functionTo providerType);
-
providerType = lib.types.either functionProviderType aspectSubmodule;
+
providerType = lib.types.either aspectSubmoduleAttrs functionProviderType;
aspectSubmoduleAttrs = lib.types.addCheck aspectSubmodule (
m: (!builtins.isFunction m) || (isAspectSubmoduleFn m)
···
options.provides = lib.mkOption {
description = "Providers of aspect for other aspects";
default = { };
-
type = lib.types.submodule (
-
{ config, ... }:
-
{
-
freeformType = lib.types.attrsOf providerType;
-
config._module.args.provides = config;
-
}
-
);
+
type = aspectsType;
};
options.__functor = lib.mkOption {
internal = true;