diff --git a/.gitignore b/.gitignore index e4f3285..0401ab5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ result .direnv +.nixd.json # Never commit plaintext secrets *.dec.yaml diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..204bce0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,14 @@ +{ + "nix.enableLanguageServer": true, + "nix.serverPath": "nixd", + "nix.serverSettings": { + "nixd": { + "formatting": { + "command": ["nixfmt"] + }, + "nixpkgs": { + "expr": "import {}" + } + } + } +} diff --git a/Justfile b/Justfile index 249ad7f..99b3eb2 100644 --- a/Justfile +++ b/Justfile @@ -37,3 +37,14 @@ check: [linux] check: @nix eval .#nixosConfigurations.wsl.config.system.build.toplevel > /dev/null && echo "wsl: ok" + +# Generate .nixd.json for nixd LSP option completion +[macos] +nixd host: + @echo '{"options":{"nix-darwin":{"expr":"(builtins.getFlake (toString ./.)).darwinConfigurations.{{host}}.options"},"home-manager":{"expr":"(builtins.getFlake (toString ./.)).darwinConfigurations.{{host}}.options.home-manager.users.type.getSubOptions []"}}}' | jq . > .nixd.json + @echo "Generated .nixd.json for {{host}}" + +[linux] +nixd host="wsl": + @echo '{"options":{"nixos":{"expr":"(builtins.getFlake (toString ./.)).nixosConfigurations.{{host}}.options"},"home-manager":{"expr":"(builtins.getFlake (toString ./.)).nixosConfigurations.{{host}}.options.home-manager.users.type.getSubOptions []"}}}' | jq . > .nixd.json + @echo "Generated .nixd.json for {{host}}" diff --git a/opencode.jsonc b/opencode.jsonc index 559cd6a..871edf0 100644 --- a/opencode.jsonc +++ b/opencode.jsonc @@ -1,5 +1,11 @@ { "$schema": "https://opencode.ai/config.json", + "lsp": { + "just": { + "command": ["just-lsp"], + "extensions": [""] + } + }, "mcp": { "nixos": { "type": "local",