Skip to content

Commit 5bb4284

Browse files
committed
devops: nix-checks
1 parent efcd924 commit 5bb4284

5 files changed

Lines changed: 58 additions & 8 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ on:
55
branches: [main]
66

77
jobs:
8+
nix-checks:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: cachix/install-nix-action@v31
13+
- run: nix flake check -Lv
14+
815
test:
916
runs-on: ubuntu-latest
1017
steps:

‎.luarc.json‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎.luarc.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"workspace": {
3+
"library": [
4+
"$VIMRUNTIME"
5+
]
6+
}
7+
}

‎.stylua.toml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
line_endings = "Unix"
2+
indent_type = "Tabs"
3+
indent_width = 2
4+
quote_style = "AutoPreferDouble"
5+
call_parentheses = "Always"
6+
collapse_simple_statement = "Never"

‎flake.nix‎

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
};
77
outputs =
88
{
9+
self,
910
nixpkgs,
1011
flake-utils,
1112
gen-luarc,
@@ -20,21 +21,51 @@
2021
gen-luarc.overlays.default
2122
];
2223
};
23-
luarc = pkgs.mk-luarc-json {
24+
luarc = pkgs.mk-luarc {
2425
plugins = with pkgs.vimPlugins; [
2526
mini-nvim
2627
];
2728
};
29+
luarc-json = pkgs.luarc-to-json (
30+
luarc
31+
// {
32+
diagnostics = luarc.diagnostics // {
33+
globals = [ "MiniTest" ];
34+
};
35+
}
36+
);
37+
type-check =
38+
pkgs.runCommand "type-check"
39+
{
40+
nativeBuildInputs = [ pkgs.lua-language-server ];
41+
}
42+
''
43+
export HOME="$(mktemp -d)"
44+
cp -r ${self} source
45+
cd source
46+
lua-language-server --configpath ${luarc-json} --logpath "$HOME/log" --check .
47+
touch $out
48+
'';
49+
stylua-check =
50+
pkgs.runCommand "stylua-check"
51+
{
52+
nativeBuildInputs = [ pkgs.stylua ];
53+
}
54+
''
55+
cd ${self}
56+
stylua --check .
57+
touch $out
58+
'';
2859
in
2960
{
3061
devShells.default = pkgs.mkShell {
3162
packages = with pkgs; [
3263
lua-language-server
64+
stylua
3365
];
34-
shellHook = # bash
35-
''
36-
ln -fs ${luarc} .luarc.json
37-
'';
66+
};
67+
checks = {
68+
inherit type-check stylua-check;
3869
};
3970
}
4071
);

‎lua/zen/init.lua‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ local function is_filetype(target, filetype)
6464
return false
6565
end
6666

67+
---@return integer
6768
local function get_side_buffer(position)
6869
local current_tabpage = vim.api.nvim_get_current_tabpage()
6970
if state[current_tabpage] and state[current_tabpage][position] then
@@ -250,8 +251,7 @@ local function setup(options)
250251
for _, integration in pairs(opts[position]) do
251252
---@diagnostic disable-next-line: undefined-field
252253
if type(integration) == "table" and integration.filetype == filetype then
253-
local new_width =
254-
math.max(opts[position].min_width, math.floor((vim.o.columns - opts.main.width) / 2))
254+
local new_width = math.max(opts[position].min_width, math.floor((vim.o.columns - opts.main.width) / 2))
255255
vim.api.nvim_win_set_width(buf_info[1].windows[1], new_width)
256256
return
257257
end

0 commit comments

Comments
 (0)