From 411e5ab0e88c0127a974e45394c166035f8c50ee Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 8 May 2023 22:49:12 +0200 Subject: [PATCH] Add class: imports "type checking" 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. --- extras/flakeModules.nix | 1 + lib.nix | 1 + modules/perSystem.nix | 1 + 3 files changed, 3 insertions(+) diff --git a/extras/flakeModules.nix b/extras/flakeModules.nix index b66ef9c..b14e9d6 100644 --- a/extras/flakeModules.nix +++ b/extras/flakeModules.nix @@ -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. diff --git a/lib.nix b/lib.nix index 64c35c1..fbd9ac1 100644 --- a/lib.nix +++ b/lib.nix @@ -120,6 +120,7 @@ let inputs = args.inputs or /* legacy, warned above */ self.inputs; } // specialArgs; modules = [ ./all-modules.nix (lib.setDefaultModuleLocation errorLocation module) ]; + class = "flake"; } ); diff --git a/modules/perSystem.nix b/modules/perSystem.nix index 499858a..25e6b33 100644 --- a/modules/perSystem.nix +++ b/modules/perSystem.nix @@ -126,6 +126,7 @@ in specialArgs = { inherit system; }; + class = "perSystem"; }).config; };