Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for completing nixosModules.default.options #590

Open
kjeremy opened this issue Sep 3, 2024 · 3 comments
Open

Add support for completing nixosModules.default.options #590

kjeremy opened this issue Sep 3, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@kjeremy
Copy link

kjeremy commented Sep 3, 2024

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

I would like completion for a module that I am exposing from a flake.

Describe the solution you'd like

This should expose my options but it doesn't seem to (or possibly this should just work).

"nix.serverSettings": {
        "nixd": {
            "options": {
                "my-cool-module": {
                    "expr": "(builtins.getFlake \"/home/jkolb/ara/ipd-nix\").nixosModules.default.options",
                }
            }
        }
    }

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@inclyc
Copy link
Member

inclyc commented Oct 26, 2024

I would like completion for a module that I am exposing from a flake.

Please show nix-repl for that module.

(builtins.getFlake \"/home/jkolb/ara/ipd-nix\").nixosModules.default.options

For example,

nix-repl> (builtins.getFlake "/home/jkolb/ara/ipd-nix").nixosModules.default.options

What is the result?

@inclyc inclyc added enhancement New feature or request and removed needs-triage labels Oct 26, 2024
@blindFS
Copy link

blindFS commented Dec 5, 2024

@inclyc I have similar issues with nix-darwin.
I'd like to have completion for its options as well as home-manager's darinmodule options
Not sure I'm using the correct way for it, but I can get only completions for package names working.
Here's my Neovim LSP config:

      lspconfig.nixd.setup({
        cmd = { "nixd" },
        filetypes = { "nix" },
        settings = {
          nixd = {
            formatting = {
              command = { "nixfmt" },
            },
            options = {
              darwin = {
                expr = string.format(
                  '(builtins.getFlake "%s/nix").darwinConfigurations.%s.options',
                  vim.env.HOME,
                  vim.loop.os_gethostname()
                ),
              },
            },
          },
        },
      })

The command in nix-repl generates following output:

[0.0 MiB DL]{
  _module = { ... };
  assertions = { ... };
  borders = { ... };
  documentation = { ... };
  environment = { ... };
  fonts = { ... };
  home-manager = { ... };
  homebrew = { ... };
  ids = { ... };
  launchd = { ... };
  lib = { ... };
  meta = { ... };
  networking = { ... };
  nix = { ... };
  nix-homebrew = { ... };
  nixpkgs = { ... };
  power = { ... };
  programs = { ... };
  security = { ... };
  services = { ... };
  system = { ... };
  time = { ... };
  users = { ... };
  warnings = { ... };
}

@blindFS
Copy link

blindFS commented Dec 5, 2024

Update: just found out that it works for me at top-level, but not in a module's config = {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants