Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/neovim-plugin: Add lazyLoad option to plugins #1

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0f76a8c
plugins/glow: init
getchoo Jul 7, 2024
2911802
plugins/treesitter: Adapt nixvim queries to 0.10
traxys Jul 8, 2024
023dc1c
plugins/treesitter: Add a treesitter injection query for raw lua
traxys Jul 8, 2024
a5e9dbd
plugins/bufdelete: init
MattSturgeon Jul 9, 2024
7e3d629
flake/generate-files: add `--commit` command + fixes
MattSturgeon Jul 9, 2024
abc409c
github: refactor `update` CI workflow
MattSturgeon Jul 9, 2024
497ce47
maintainers: remove MattSturgeon
MattSturgeon Jul 9, 2024
34c3c02
tests: add check for nixpkgs maintainers
MattSturgeon Jul 9, 2024
123c102
plugin/rustaceanvim: Handle rust-analyzer settings rename
traxys Jul 10, 2024
ca01a64
flake/dev/formatting: run ruff format in isolated mode
GaetanLepage Jul 11, 2024
53e85da
plugins/intellitab: fix treesitter option usage
ForsakenHarmony Jul 11, 2024
dc1559f
plugins/rustaceanvim: fix deprecation in test
khaneliman Jul 12, 2024
1385953
plugins/treesitter: fix parser_install_dir default
khaneliman Jul 11, 2024
89d74cd
plugins/treesitter: fix folding
khaneliman Jul 12, 2024
195978e
plugins/treesitter: fix `ensure_installed` to allow `"all"`
MattSturgeon Jul 13, 2024
d8f3113
plugins/none-ls: refactor using `mkSourcePlugin`
MattSturgeon Jul 11, 2024
4f3cd9f
plugins/none-ls: combine packaged+unpackaged lists
MattSturgeon Jul 11, 2024
06a44e9
plugins/none-ls: rename `servers.nix` to `sources.nix`
MattSturgeon Jul 11, 2024
c029f17
flake.lock: Update
github-actions[bot] Jul 8, 2024
0d95fc6
plugins/telescope/extensions/undo: deprecate option diff_context_lines
GaetanLepage Jul 10, 2024
94bea51
tests/efmls-configs: update test excludes
GaetanLepage Jul 13, 2024
ac9a1cb
generated: Updated rust-analyzer.nix
github-actions[bot] Jul 13, 2024
433d2f2
plugins/treesitter: disable folding by default
SuperSandro2000 Jul 14, 2024
bd1ddda
github/update: run `update` on the respective branch
MattSturgeon Jul 14, 2024
cff06c8
github/update: improve summary for generated files
MattSturgeon Jul 15, 2024
c1feced
dev: fix `--commit` when the worktree is dirty
MattSturgeon Jul 15, 2024
b9ed900
github/update: remove broken team-reviewers
MattSturgeon Jul 15, 2024
3fc6938
maintainers: add psfloyd
psfloyd Jul 9, 2024
03f90fa
plugins/lz-n: init
psfloyd Jul 16, 2024
2d5dfe3
plugins/qmk: add default values for name and layout options
psfloyd Jul 14, 2024
e96d4c5
lib/options: added mkLazyLoadOption
psfloyd Jul 16, 2024
7907bbd
plugins/lz-n: use mkLazyLoadOption
psfloyd Jul 16, 2024
3fc3464
lib/neovim-plugin: add lazyLoad
psfloyd Jul 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 103 additions & 37 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,125 @@
name: update-flake-lock
name: update
on:
workflow_dispatch: # allows manual triggering
inputs:
branch:
description: "Branch to update"
type: choice
options:
- "stable & unstable"
- "main"
- "nixos-24.05"
# Runs every Saturday at noon
schedule:
- cron: "0 12 * * SAT" # runs weekly on Saturday at noon
- cron: "0 12 * * SAT"
# Allow manual triggering
workflow_dispatch:
inputs:
nixos-24.05:
type: boolean
description: Also update nixos-24.05

# Allow one concurrent update per branch
concurrency:
group: "update-${{ github.ref_name }}"
cancel-in-progress: true

# Allow running workflows, pushing and creating PRs
permissions:
actions: write
contents: write
pull-requests: write

jobs:
lockfile:
strategy:
matrix:
# This allows to update both stable & unstable branches, but not both when triggered
# manually
branch: ["main", "nixos-24.05"]
selectedBranch: ["${{ inputs.branch }}"]
exclude:
- selectedBranch: main
branch: "nixos-24.05"
- selectedBranch: "nixos-24.05"
branch: main
update:
name: Update the flake inputs and generate options
runs-on: ubuntu-latest
timeout-minutes: 40

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
ref: "${{ matrix.branch }}"
ssh-key: ${{ secrets.CI_UPDATE_SSH_KEY }}

# NOTE: If additional "inputs" are added, copy this step
- name: Update nixos-24.05
if: inputs['nixos-24.05'] || github.event_name == 'schedule'
env:
GH_TOKEN: ${{ github.token }}
run: |
gh workflow run update.yml --ref nixos-24.05

- name: Install Nix
uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-unstable
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'

- name: Update flake.lock
id: update
uses: DeterminateSystems/update-flake-lock@v21
with:
pr-title: "Update flake.lock (${{ matrix.branch }})"
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
branch: "update_flake_lock_action-${{ matrix.branch }}"
id: flake_lock
run: |
old=$(git show --no-patch --format=%h)
nix flake update --commit-lock-file
new=$(git show --no-patch --format=%h)
if [ "$old" != "$new" ]; then
echo "body<<EOF" >> "$GITHUB_OUTPUT"
git show --no-patch --format=%b >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
fi

# TODO: do in one checkout + push the flake.lock update & the re-generation of the files
- name: Update autogenerated files
id: generate
run: |
git checkout update_flake_lock_action-${{ matrix.branch }}
nix run .#generate-files
git add ./generated
git commit -m "generated: Update files"
git push
old=$(git show --no-patch --format=%h)
nix run .#generate-files -- --commit
new=$(git show --no-patch --format=%h)
if [ "$old" != "$new" ]; then
body=$(git show --no-patch --format=%b)
echo "body<<EOF" >> "$GITHUB_OUTPUT"
if [ -n "$body" ]; then
# Multi-file changes are listed in the body
echo "$body" >> "$GITHUB_OUTPUT"
else
# Single-file changes are only in the summary,
# e.g. "generated: Updated none-ls.nix"
git show --no-patch --format=%s | \
sed -e 's/^generated:/-/' >> "$GITHUB_OUTPUT"
fi
echo "EOF" >> "$GITHUB_OUTPUT"
fi

- name: Create Pull Request
id: pr
uses: peter-evans/create-pull-request@v6
with:
add-paths: "!**"
branch: update/${{ github.ref_name }}
delete-branch: true
title: |
[${{ github.ref_name }}] Update flake.lock & generated files
body: |
## Flake lockfile
```
${{ steps.flake_lock.outputs.body || 'No changes' }}
```

## Generate
${{ steps.generate.outputs.body || 'No changes' }}

- name: Print summary
if: ${{ steps.pr.outputs.pull-request-number }}
run: |
num="${{ steps.pr.outputs.pull-request-number }}"
pr_url="${{ steps.pr.outputs.pull-request-url }}"
pr_branch="${{ steps.pr.outputs.pull-request-branch }}"
head="${{ steps.pr.outputs.pull-request-head-sha }}"
operation="${{ steps.pr.outputs.pull-request-operation }}"

# stdout
echo "${head:0:6} pushed to ${pr_branch}"
echo "${pr} was ${operation}."

# markdown summary
echo "## ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
echo >> $GITHUB_STEP_SUMMARY
echo "\`${head:0:6}\` pushed to \`${pr_branch}\`" >> $GITHUB_STEP_SUMMARY
echo >> $GITHUB_STEP_SUMMARY
echo "[#${num}](${pr_url}) was ${operation}." >> $GITHUB_STEP_SUMMARY
echo >> $GITHUB_STEP_SUMMARY
1 change: 1 addition & 0 deletions flake-modules/dev/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"**.svg"
"**/man/*.5"
];
formatter.ruff-format.options = [ "--isolated" ];
};
};
}
Expand Down
2 changes: 2 additions & 0 deletions flake-modules/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
inherit pkgs helpers;
inherit (pkgs) lib;
};

maintainers = import ../tests/maintainers.nix { inherit pkgs; };
};
};
}
53 changes: 53 additions & 0 deletions flake-modules/updates/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@
repo_root=$(git rev-parse --show-toplevel)
generated_dir=$repo_root/generated

commit=
while [ $# -gt 0 ]; do
case "$1" in
--commit) commit=1
;;
--*) echo "unknown option $1"
;;
*) echo "unexpected argument $1"
;;
esac
shift
done

mkdir -p "$generated_dir"

echo "Rust-Analyzer"
nix build .#rust-analyzer-options
cat ./result >"$generated_dir"/rust-analyzer.nix
Expand All @@ -21,7 +36,45 @@
nix build .#none-ls-builtins
cat ./result >"$generated_dir"/none-ls.nix

git add --intent-to-add "$generated_dir"
nix fmt

if [ -n "$commit" ]; then
cd "$generated_dir"
git add .

# Construct a msg body from `git status -- .`
body=$(
git status \
--short \
--ignored=no \
--untracked-files=no \
--no-ahead-behind \
-- . \
| sed \
-e 's/^\s*\([A-Z]\)\s*/\1 /' \
-e 's/^A/Added/' \
-e 's/^M/Updated/' \
-e 's/^R/Renamed/' \
-e 's/^D/Removed/' \
-e 's/^/- /'
)

# Construct the commit message based on the body
count=$(echo -n "$body" | wc -l)
if [ "$count" -gt 1 ] || [ ''${#body} -gt 50 ]; then
msg=$(echo -e "generated: Update\n\n$body")
else
msg="generated:''${body:1}"
fi

# Commit if there are changes
if [ "$count" -gt 0 ]; then
echo "Committing $count changes..."
echo "$msg"
git commit -m "$msg" --no-verify
fi
fi
'';
};

Expand Down
6 changes: 3 additions & 3 deletions flake-modules/updates/none-ls.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
pkgs,
}:
let
inherit (import ../../plugins/none-ls/packages.nix pkgs) packaged noPackage unpackaged;
inherit (import ../../plugins/none-ls/packages.nix pkgs) packaged noPackage;

builtinSources = lib.trivial.importJSON "${vimPlugins.none-ls-nvim.src}/doc/builtins.json";

Expand All @@ -14,11 +14,11 @@ let
toolNames = lib.unique (lib.flatten (lib.attrValues builtinSourceNames));

undeclaredTool = lib.filter (
name: !(lib.hasAttr name packaged || lib.elem name noPackage || lib.elem name unpackaged)
name: !(lib.hasAttr name packaged || lib.elem name noPackage)
) toolNames;

uselesslyDeclaredTool = lib.filter (name: !(lib.elem name toolNames)) (
unpackaged ++ noPackage ++ (lib.attrNames packaged)
noPackage ++ (lib.attrNames packaged)
);
in
writeText "efmls-configs-sources.nix" (
Expand Down
36 changes: 18 additions & 18 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions generated/rust-analyzer.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,20 @@
];
};
};
"rust-analyzer.assist.termSearch.borrowcheck" = {
description = ''
Enable borrow checking for term search code assists. If set to false, also there will be more suggestions, but some of them may not borrow-check.
'';
pluginDefault = true;
type = {
kind = "boolean";
};
};
"rust-analyzer.assist.termSearch.fuel" = {
description = ''
Term search fuel in "units of work" for assists (Defaults to 400).
Term search fuel in "units of work" for assists (Defaults to 1800).
'';
pluginDefault = 400;
pluginDefault = 1800;
type = {
kind = "integer";
maximum = null;
Expand Down Expand Up @@ -683,9 +692,9 @@
};
"rust-analyzer.completion.termSearch.fuel" = {
description = ''
Term search fuel in "units of work" for autocompletion (Defaults to 200).
Term search fuel in "units of work" for autocompletion (Defaults to 1000).
'';
pluginDefault = 200;
pluginDefault = 1000;
type = {
kind = "integer";
maximum = null;
Expand Down
Loading