Skip to content

User-defined Idioms #844

Description

@kylechui

Is your feature request related to a problem? Please describe.

Right now, it seems like there is no static analysis inside callback functions being used for overriding certain packages/attributes in a derivation or derivation set. For example, if we want to override some of the pkgs.vimPlugins, then it seems like the fixed-point function we pass to pkgs.vimPlugins.extend does not get statically analyzed to recognize the oldAttrs and finalAttrs as "the same shape" as pkgs.vimPlugins.

Describe the solution you'd like

Would it be possible for the language server to do a bit more inference for these fixpoint functions?

Maybe a different way to get around things: I did some snooping in the codebase, and my understanding is that pkgs and lib are hard-coded constants, where variables with those names are assumed to follow the format of the nixpkgs field in settings.nixd.nixpkgs.expr. Could it be possible to have more user-defined mappings, so I could define e.g. oldVimAttrs to point to (import <nixpkgs> { }).vimPlugins or something like that?

Describe alternatives you've considered

I tried looking around the existing issues but did not find anything that seemed super-related to this ask.

Additional context

Thanks a bunch for your work on this project! I also understand that since Nix is dynamically-typed, a lot of these static analyses may not be possible---feel free to close this issue if that ends up being the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions