Skip to content

Automatically resolve simple aliases/variables #1110

@agowa

Description

@agowa

Hi,

when looking at e.g. nixpkgs.pkgs the defaultText uses a variable named "cfg". Within the packages declaring nix file it is more or less just an alias and also never gets redefined or anything.

So would it be possible to resolve such usages automatically and use their unaliased version?
https://github.com/NixOS/nixpkgs/blob/a672be65651c80d3f592a89b3945466584a22069/nixos/modules/misc/nixpkgs.nix#L9
https://github.com/NixOS/nixpkgs/blob/c97c47f2bac4fa59e2cbdeba289686ae615f8ed4/nixos/modules/misc/nixpkgs.nix#L119-L124

I fully understand that it would only work for very simple cases. However as this wasn't the first time I encountered such usages I at least wanted to ask if it'd be something worth considering to be added to the nixos search page even though it would only work for simple cases.

(In addition to this ticket I also opened a PR just now to change the defaultText of nixpkgs.pkgs to the unaliased version.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions