Skip to content

Commit

Permalink
vim-vint: add module (#3604)
Browse files Browse the repository at this point in the history
* vim-vint: add module

* vim-vint: add tests

* maintainers: add tomodachi94

* vim-vint: fix tests

---------

Co-authored-by: Naïm Favier <n@monade.li>
  • Loading branch information
tomodachi94 and ncfavier committed Feb 5, 2023
1 parent e716961 commit ffc022b
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions modules/lib/maintainers.nix
Expand Up @@ -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";
};
}
1 change: 1 addition & 0 deletions modules/modules.nix
Expand Up @@ -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
Expand Down
36 changes: 36 additions & 0 deletions 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
<filename>$XDG_CONFIG_HOME/.vintrc.yaml</filename>
'';
};
};
};

config = mkIf cfg.enable {
home.packages = [ cfg.package ];

xdg.configFile.".vintrc.yaml".source =
yamlFormat.generate "vim-vint-config" cfg.settings;
};
}
1 change: 1 addition & 0 deletions tests/default.nix
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions 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
}
'';
}
16 changes: 16 additions & 0 deletions 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
1 change: 1 addition & 0 deletions tests/modules/programs/vim-vint/default.nix
@@ -0,0 +1 @@
{ vim-vint-basic-configuration = ./basic-configuration.nix; }

0 comments on commit ffc022b

Please sign in to comment.