Open ehllie opened 1 year ago
Might be related: Since https://github.com/NixOS/nixpkgs/pull/197547 evalModules
function has a class
parameter which can be used to give a type to modules.
but they don't exactly align with the the config options when writing something like a
home-manager
ornix-darwin
module.
Currently NixOS options are extracted using a handcrafted Nix here and it's coupling with nixpkgs. I'm not sure if we could somehow extract options from the home-manager module in a similar way.
Might be related: Since NixOS/nixpkgs#197547
evalModules
function has aclass
parameter which can be used to give a type to modules.
It is just a string identifier. It cannot help with types.
I've noticed that in recent versions of
nil
, there is now inference for attributes inside module arguments likeconfig
:It's definitely very convenient when writing NixOS modules, but they don't exactly align with the the config options when writing something like a
home-manager
ornix-darwin
module. Trying to dynamically infer it might be possible, but I think it might be more difficult, and not always possible. That's why I suggest an introduction of a type comment syntax/system for annotating these things manually. That way one could write something along the lines of:This would obviously not be a small feature, since it would probably require a syntax for defining types, and also a method for flakes to export them, but in my opinion it would be a very useful feature.