Skip to content

Commit

Permalink
Add class: imports "type checking"
Browse files Browse the repository at this point in the history
Initially this had some feature checking with lib.functionArgs, but
I don't think this is useful. The _class attribute is not supported
by long-unsupported Nixpkgs (<23.05) anyway, so let's keep it simple.
  • Loading branch information
roberth committed May 16, 2024
1 parent e5d10a2 commit 7ccb0c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions extras/flakeModules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let
_file = "${toString moduleLocation}#flakeModules.${k}";
key = "${toString moduleLocation}#flakeModules.${k}";
imports = [ v ];
_class = "flake";
});
description = ''
flake-parts modules for use by other flakes.
Expand Down
5 changes: 3 additions & 2 deletions lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ let
''

(module:
lib.evalModules {
lib.evalModules ({
specialArgs = {
inherit self flake-parts-lib moduleLocation;
inputs = args.inputs or /* legacy, warned above */ self.inputs;
} // specialArgs;
modules = [ ./all-modules.nix (lib.setDefaultModuleLocation errorLocation module) ];
}
class = "flake";
})
);

# Function to extract the default flakeModule from
Expand Down
5 changes: 3 additions & 2 deletions modules/perSystem.nix
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,14 @@ in
};
});
apply = modules: system:
(lib.evalModules {
(lib.evalModules ({
inherit modules;
prefix = [ "perSystem" system ];
specialArgs = {
inherit system;
};
}).config;
class = "perSystem";
})).config;
};

allSystems = mkOption {
Expand Down

0 comments on commit 7ccb0c8

Please sign in to comment.