Added IaC support

This commit is contained in:
Fred Drake
2024-10-10 15:52:36 -04:00
parent 654381910b
commit e349347a95
4 changed files with 71 additions and 2 deletions
+8 -2
View File
@@ -28,6 +28,7 @@ The default configuration performs editing without settings for any particular l
- Go `nix run github:fred-drake/neovim#golang`
- Python `nix run github:fred-drake/neovim#python`
- Javascript `nix run github:fred-drake/neovim#javascript`
- Infrastructure as Code `nix run github:fred-drake/neovim#ia
### Install Multiple Configurations
@@ -65,8 +66,8 @@ And add it to your home-manager imports:
| YAML | yamlfmt | yamllint, yamlls | | default |
| CSS | prettier | | | default |
| HTML | prettier | | | default |
| Javascript | prettier | | | default |
| Typescript | prettier | | | default |
| Javascript | prettier | | | javascript |
| Typescript | prettier | | | javascript |
| JSON | prettier | jsonls | | default |
| Markdown | prettier | marksman | | default |
| Ruby | rubyfmt | | | default |
@@ -77,3 +78,8 @@ And add it to your home-manager imports:
| Python | black, isort | flake8, jedi, pylint, rope, mccabe | dap-python | python |
| Rust | rustfmt | clippy | lldb | rust |
| Node | prettier | tsserver | vscode-js-debug | javascript |
| Ansible | yamlfmt | ansiblels | | iac |
| Terraform | tofu_fmt | terraformls | | iac |
| Nginx | | nginx-language-server | | iac |
| Helm | | helm-ls | | iac |
| Dockerfile | | dockerls | | iac |
+16
View File
@@ -0,0 +1,16 @@
let
# Read all files in the current directory
files = builtins.readDir ./.;
# Filter out default.nix and non-.nix files
nixFiles = builtins.filter
(name: name != "default.nix" && builtins.match ".*\\.nix" name != null)
(builtins.attrNames files);
# Create a list of import statements
imports = map (name: ./. + "/${name}") nixFiles;
in {
# Import all configuration modules automatically
imports = imports;
}
+33
View File
@@ -0,0 +1,33 @@
{pkgs, ...}: {
plugins = {
conform-nvim = {
enable = true;
settings = {
formatters_by_ft = {
terraform = ["tofu_fmt"];
tf = ["tofu_fmt"];
};
};
};
lsp.servers = {
ansiblels.enable = true;
dockerls.enable = true;
helm-ls.enable = true;
nginx-language-server.enable = true;
terraformls.enable = true;
};
};
extraPlugins = [
# Set ansible.yaml files
(pkgs.vimUtils.buildVimPlugin {
name = "nvim-ansible";
src = pkgs.fetchFromGitHub {
owner = "mfussenegger";
repo = "nvim-ansible";
rev = "9c3b4a771b8c8d7b4f2171466464d978cb3846f7";
hash = "sha256-N1yOL77WpP66A2zrKxi7IOO5uRzAaeGa0Y/yWaIFiws=";
};
})
];
}
+14
View File
@@ -89,6 +89,17 @@
};
extraSpecialArgs = {};
};
iacNixvimModule = {
inherit pkgs;
module = {pkgs, ...}: {
imports = [
./config
./config/iac
];
extraPackages = with pkgs; [sops ansible-lint];
};
extraSpecialArgs = {};
};
pkgs = import inputs.nixpkgs {
inherit system overlays;
config.allowUnfree = true;
@@ -99,6 +110,7 @@
goNvim = nixvim'.makeNixvimWithModule goNixvimModule;
pythonNvim = nixvim'.makeNixvimWithModule pythonNixvimModule;
javascriptNvim = nixvim'.makeNixvimWithModule javascriptNixvimModule;
iacNvim = nixvim'.makeNixvimWithModule iacNixvimModule;
in {
checks = {
# Run `nix flake check .` to verify that your config is not broken
@@ -117,6 +129,8 @@
python = pythonNvim;
# Lets you run `nix run .#javascript` to start nixvim with JS/TS configuration
javascript = javascriptNvim;
# Lets you run `nix run .#javascript` to start nixvim with IaC configuration
iac = iacNvim;
};
};
};