diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6f810af34..f5d434834 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -335,6 +335,9 @@ Makefile @thiagokokada /modules/programs/topgrade.nix @msfjarvis /tests/modules/programs/topgrade @msfjarvis +/modules/programs/vim-vint.nix @tomodachi94 +/tests/modules/programs/vim-vint @tomodachi94 + /modules/programs/watson.nix @polykernel /tests/modules/programs/watson @polykernel diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 7aa1842af..267a42a38 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -360,4 +360,11 @@ keys = [{ fingerprint = "7944 74B7 D236 DAB9 C9EF E7F9 5CCE 6F14 66D4 7C9E"; }]; }; + tomodachi94 = { + email = "tomodachi94+nixpkgs@protonmail.com"; + matrix = "@tomodachi94:matrix.org"; + github = "tomodachi94"; + githubId = 68489118; + name = "tomodachi94"; + }; } diff --git a/modules/modules.nix b/modules/modules.nix index 0e71ea3a1..391ad5bd7 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -186,6 +186,7 @@ let ./programs/topgrade.nix ./programs/urxvt.nix ./programs/vim.nix + ./programs/vim-vint.nix ./programs/vscode.nix ./programs/vscode/haskell.nix ./programs/pywal.nix diff --git a/modules/programs/vim-vint.nix b/modules/programs/vim-vint.nix new file mode 100644 index 000000000..e44d96e4c --- /dev/null +++ b/modules/programs/vim-vint.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.vim-vint; + + yamlFormat = pkgs.formats.yaml { }; + +in { + meta.maintainers = [ maintainers.tomodachi94 ]; + + options = { + programs.vim-vint = { + enable = mkEnableOption "the Vint linter for Vimscript"; + package = mkPackageOption pkgs "vim-vint" { }; + + settings = mkOption { + type = yamlFormat.type; + default = { }; + description = '' + Configuration written to + $XDG_CONFIG_HOME/.vintrc.yaml + ''; + }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile.".vintrc.yaml".source = + yamlFormat.generate "vim-vint-config" cfg.settings; + }; +} diff --git a/tests/default.nix b/tests/default.nix index 295254b93..9bbdaebb1 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -122,6 +122,7 @@ import nmt { ./modules/programs/tmate ./modules/programs/tmux ./modules/programs/topgrade + ./modules/programs/vim-vint ./modules/programs/vscode ./modules/programs/watson ./modules/programs/wezterm diff --git a/tests/modules/programs/vim-vint/basic-configuration.nix b/tests/modules/programs/vim-vint/basic-configuration.nix new file mode 100644 index 000000000..59bfafa5a --- /dev/null +++ b/tests/modules/programs/vim-vint/basic-configuration.nix @@ -0,0 +1,27 @@ +{ config, pkgs, lib, xdg, ... }: + +{ + programs.vim-vint = { + enable = true; + settings = { + cmdargs = { + severity = "error"; + color = true; + env = { neovim = true; }; + }; + policies = { + ProhibitEqualTildeOperator.enabled = false; + ProhibitUsingUndeclaredVariable.enabled = false; + ProhibitAbbreviationOption.enabled = false; + ProhibitImplicitScopeVariable.enabled = false; + ProhibitSetNoCompatible.enabled = false; + }; + }; + }; + + nmt.script = '' + assertFileContent home-files/.config/.vintrc.yaml ${ + ./basic-configuration.yaml + } + ''; +} diff --git a/tests/modules/programs/vim-vint/basic-configuration.yaml b/tests/modules/programs/vim-vint/basic-configuration.yaml new file mode 100644 index 000000000..1273b14e9 --- /dev/null +++ b/tests/modules/programs/vim-vint/basic-configuration.yaml @@ -0,0 +1,16 @@ +cmdargs: + color: true + env: + neovim: true + severity: error +policies: + ProhibitAbbreviationOption: + enabled: false + ProhibitEqualTildeOperator: + enabled: false + ProhibitImplicitScopeVariable: + enabled: false + ProhibitSetNoCompatible: + enabled: false + ProhibitUsingUndeclaredVariable: + enabled: false diff --git a/tests/modules/programs/vim-vint/default.nix b/tests/modules/programs/vim-vint/default.nix new file mode 100644 index 000000000..0066eaf8f --- /dev/null +++ b/tests/modules/programs/vim-vint/default.nix @@ -0,0 +1 @@ +{ vim-vint-basic-configuration = ./basic-configuration.nix; }