mirror of
https://github.com/zoriya/lz.n.git
synced 2025-12-06 06:36:11 +00:00
Initial commit
This commit is contained in:
12
.busted
Normal file
12
.busted
Normal file
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
_all = {
|
||||
coverage = false,
|
||||
lpath = "lua/?.lua;lua/?/init.lua",
|
||||
},
|
||||
default = {
|
||||
verbose = true
|
||||
},
|
||||
tests = {
|
||||
verbose = true
|
||||
},
|
||||
}
|
||||
8
.editorconfig
Executable file
8
.editorconfig
Executable file
@@ -0,0 +1,8 @@
|
||||
root = true
|
||||
|
||||
[*.*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
7
.github/workflows/dependabot.yml
vendored
Normal file
7
.github/workflows/dependabot.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
36
.github/workflows/docgen.yml
vendored
Normal file
36
.github/workflows/docgen.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
name: Generate docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
name: Generate docs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v23
|
||||
- uses: cachix/cachix-action@v12
|
||||
with:
|
||||
name: neorocks
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
|
||||
- name: Generating docs
|
||||
run: nix run ".#docgen"
|
||||
|
||||
- name: Update documentation
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
COMMIT_MSG: |
|
||||
docs(generated): update doc/rocks.txt
|
||||
skip-checks: true
|
||||
run: |
|
||||
git config user.email "actions@github"
|
||||
git config user.name "Github Actions"
|
||||
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
|
||||
git add doc/
|
||||
# Only commit and push if we have changes
|
||||
git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin HEAD:${GITHUB_REF})
|
||||
30
.github/workflows/luarocks.yml
vendored
Normal file
30
.github/workflows/luarocks.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
name: Push to LuaRocks
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
release:
|
||||
types:
|
||||
- created
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
luarocks-release:
|
||||
runs-on: ubuntu-latest
|
||||
name: Release
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Required to count the commits
|
||||
- name: Get Version
|
||||
run: echo "LUAROCKS_VERSION=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV
|
||||
- name: Luarocks Upload
|
||||
uses: nvim-neorocks/luarocks-tag-release@v5
|
||||
env:
|
||||
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
|
||||
with:
|
||||
version: ${{ env.LUAROCKS_VERSION }}
|
||||
11
.github/workflows/nix-build.yml
vendored
Executable file
11
.github/workflows/nix-build.yml
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
name: "Nix build"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
jobs:
|
||||
checks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: cachix/install-nix-action@v20
|
||||
- run: nix flake check -L
|
||||
20
.github/workflows/release-please.yml
vendored
Normal file
20
.github/workflows/release-please.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
---
|
||||
name: Release Please
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: google-github-actions/release-please-action@v3
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
|
||||
with:
|
||||
release-type: simple
|
||||
package-name: TODO # TODO: Set package name
|
||||
52
.github/workflows/review-checklist.yml
vendored
Normal file
52
.github/workflows/review-checklist.yml
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
name: Review Checklist
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, review_requested]
|
||||
|
||||
jobs:
|
||||
review-checklist:
|
||||
name: Review Checklist
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const body = context.payload.pull_request.body
|
||||
if (body && (body.startsWith(":robot: I have created a release *beep* *boop*") || body.startsWith("Automated changes"))) { return; }
|
||||
|
||||
const { data: comments } = await github.rest.issues.listComments({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
});
|
||||
|
||||
// if comment already exists, then just return
|
||||
if (comments.find(comment => comment.body.includes("### Review Checklist"))) { return; }
|
||||
|
||||
// TODO: Update <owner> and <repo>
|
||||
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: `### Review Checklist
|
||||
|
||||
Does this PR follow the [Contribution Guidelines](https://github.com/<owner>/<repo>/blob/master/CONTRIBUTING.md)? Following is a _partial_ checklist:
|
||||
|
||||
Proper [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) scoping:
|
||||
|
||||
- For example, fix(context): some bugfix
|
||||
|
||||
- [ ] Pull request title has the appropriate conventional commit prefix.
|
||||
|
||||
If applicable:
|
||||
|
||||
- [ ] Tested
|
||||
- [ ] Tests have been added.
|
||||
- [ ] Tested manually (Steps to reproduce in PR description).
|
||||
- [ ] Updated documentation.
|
||||
- [ ] Updated [CHANGELOG.md](https://github.com/<owner>/<repo>/blob/master/CHANGELOG.md)
|
||||
`,
|
||||
})
|
||||
3
.gitignore
vendored
Executable file
3
.gitignore
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
result
|
||||
.pre-commit-config.yaml
|
||||
.direnv
|
||||
10
.luacheckrc
Normal file
10
.luacheckrc
Normal file
@@ -0,0 +1,10 @@
|
||||
ignore = {
|
||||
"631", -- max_line_length
|
||||
"122", -- read-only field of global variable
|
||||
}
|
||||
read_globals = {
|
||||
"vim",
|
||||
"describe",
|
||||
"it",
|
||||
"assert"
|
||||
}
|
||||
6
.stylua.toml
Executable file
6
.stylua.toml
Executable file
@@ -0,0 +1,6 @@
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferSingle"
|
||||
call_parentheses = "NoSingleTable"
|
||||
collapse_simple_statement = "Never"
|
||||
87
CHANGELOG.md
Executable file
87
CHANGELOG.md
Executable file
@@ -0,0 +1,87 @@
|
||||
<!-- markdownlint-disable -->
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [4.0.0](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/compare/v3.1.0...v4.0.0) (2024-01-05)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* replace nixpkgs-fmt with alejandra
|
||||
|
||||
### Features
|
||||
|
||||
* add docgen workflow ([190f1f9](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/commit/190f1f96b1035f5d57210f3b94cf8ebd5722f876))
|
||||
* add lua-ls to pre-commit-hooks-nix ([05a35aa](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/commit/05a35aa69f798386b326d902343d8d1f9421dea4))
|
||||
* add luarocks package + split out type checks ([144fdf0](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/commit/144fdf0c9d5244c08b593b4f46d28aee28ea1960))
|
||||
* add review-checklist workflow ([6bdc4ec](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/commit/6bdc4ec1e43b57489af711e4c5b71659ab9b0d9c))
|
||||
* **nix:** use test suite as base for devShell ([446a48f](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/commit/446a48fdfd5ea95942762ce822ae0b57d6c3ffc3))
|
||||
* switch from flake-utils to flake-parts ([1b35d07](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/commit/1b35d07eb215329ade4ada403c18c235b2ab7d7a))
|
||||
* use neorocksTest + bump dependencies ([b604362](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/commit/b604362c0d63d503b82ae35c55fb2b6c3cf9cde7))
|
||||
* use release-please workflow ([c11046f](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/commit/c11046f975340471a67bebb336f46d988a862647))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct typo ([a6e9f13](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/commit/a6e9f13a212391be752c29f19f80202738862c68))
|
||||
* luarocks upload workflow ([01ba07b](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/commit/01ba07b7621f6d53b75380ad898a90f5106a66ee))
|
||||
* markdownlint can fail on changelog ([34ad340](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/commit/34ad340b12e5cb73332561a8c32a4a0e7b514442))
|
||||
* type checks for tests ([777091b](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/commit/777091bd9b5031a97a41c3b257790b3c4de2209e))
|
||||
|
||||
|
||||
### Styles
|
||||
|
||||
* replace nixpkgs-fmt with alejandra ([eb199e0](https://github.com/mrcjkb/nvim-lua-nix-plugin-template/commit/eb199e06f3ccb2088610043a9ba154482887afe8))
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [3.1.0] - 2023-09-05
|
||||
|
||||
### Added
|
||||
|
||||
- Use `neorocksTest`.
|
||||
|
||||
### Changed
|
||||
|
||||
- Bump `luarocks-tag-release` version.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fail release if changelog entry doesn't exist.
|
||||
|
||||
## [3.0.0] - 2023-08-16
|
||||
|
||||
### Fixed
|
||||
|
||||
- Luarocks Upload workflow.
|
||||
|
||||
### Changed
|
||||
|
||||
- Loosen license restrictions to allow any OSI approved open source derivations.
|
||||
- Switch from `flake-utils` to `flake-parts`.
|
||||
|
||||
### Added
|
||||
|
||||
- More pre-commit-hooks and linters.
|
||||
- `luarocks-tag-release` workflow.
|
||||
- Add lua-ls pre-commit checks.
|
||||
|
||||
### Changed
|
||||
|
||||
- Remove `cachix-action` from workflow.
|
||||
|
||||
## [2.0.0] - 2023-01-02
|
||||
|
||||
### Changed
|
||||
|
||||
- Replace `nixpkgs-fmt` with `alejandra`.
|
||||
|
||||
## [1.0.0] - 2022-10-20
|
||||
|
||||
### Added
|
||||
|
||||
- Initial release
|
||||
106
CONTRIBUTING.md
Executable file
106
CONTRIBUTING.md
Executable file
@@ -0,0 +1,106 @@
|
||||
# Contributing guide
|
||||
|
||||
Contributions are more than welcome!
|
||||
|
||||
## Commit messages / PR title
|
||||
|
||||
Please ensure your pull request title conforms to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
|
||||
|
||||
## CI
|
||||
|
||||
CI checks are run using [`nix`](https://nixos.org/download.html#download-nix).
|
||||
|
||||
## Development
|
||||
|
||||
### Dev environment
|
||||
|
||||
I use the following tools:
|
||||
|
||||
#### Formatting
|
||||
|
||||
- [`.editorconfig`](https://editorconfig.org/) (with [`editorconfig-checker`](https://github.com/editorconfig-checker/editorconfig-checker))
|
||||
- [`stylua`](https://github.com/JohnnyMorganz/StyLua) [Lua]
|
||||
- [`alejandra`](https://github.com/kamadorueda/alejandra) [Nix]
|
||||
|
||||
#### Linting
|
||||
|
||||
- [`luacheck`](https://github.com/mpeterv/luacheck) [Lua]
|
||||
- [`markdownlint`](https://github.com/DavidAnson/markdownlint) [Markdown]
|
||||
|
||||
#### Static type checking
|
||||
|
||||
- [`lua-language-server`](https://github.com/LuaLS/lua-language-server/wiki/Diagnosis-Report#create-a-report)
|
||||
|
||||
### Nix devShell
|
||||
|
||||
- Requires [flakes](https://nixos.wiki/wiki/Flakes) to be enabled.
|
||||
|
||||
This project provides a `flake.nix` that can
|
||||
bootstrap all of the above development tools.
|
||||
|
||||
To enter a development shell:
|
||||
|
||||
```console
|
||||
nix develop
|
||||
```
|
||||
|
||||
To apply formatting, while in a devShell, run
|
||||
|
||||
```console
|
||||
pre-commit run --all
|
||||
```
|
||||
|
||||
If you use [`direnv`](https://direnv.net/),
|
||||
just run `direnv allow` and you will be dropped in this devShell.
|
||||
|
||||
### Running tests
|
||||
|
||||
I use [`busted`](https://lunarmodules.github.io/busted/) for testing,
|
||||
but with Neovim as the Lua interpreter.
|
||||
|
||||
The easiest way to run tests is with Nix (see below).
|
||||
|
||||
If you do not use Nix, you can also run the test suite using `luarocks test`.
|
||||
For more information on how to set up Neovim as a Lua interpreter, see
|
||||
|
||||
- The [neorocks tutorial](https://github.com/nvim-neorocks/neorocks#without-neolua).
|
||||
|
||||
Or
|
||||
|
||||
- [`nlua`](https://github.com/mfussenegger/nlua).
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> The Nix devShell sets up `luarocks test` to use Neovim as the interpreter.
|
||||
|
||||
### Running tests and checks with Nix
|
||||
|
||||
If you just want to run all checks that are available, run:
|
||||
|
||||
```console
|
||||
nix flake check -L --option sandbox false
|
||||
```
|
||||
|
||||
To run tests locally, using Nix:
|
||||
|
||||
```console
|
||||
nix build .#checks.<your-system>.integration-nightly -L --option sandbox false
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```console
|
||||
nix build .#checks.x86_64-linux.integration-nightly -L --option sandbox false
|
||||
```
|
||||
|
||||
For formatting and linting:
|
||||
|
||||
```console
|
||||
nix build .#checks.<your-system>.pre-commit-check -L
|
||||
```
|
||||
|
||||
For static type checking:
|
||||
|
||||
```console
|
||||
nix build .#checks.<your-system>.type-check-nightly -L
|
||||
```
|
||||
348
LICENSE
Normal file
348
LICENSE
Normal file
@@ -0,0 +1,348 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
||||
|
||||
GPL LICENSE EXCEPTION FOR DERIVED OPEN SOURCE SOFTWARE
|
||||
|
||||
The GPL version 2 license applies only to the Nix CI infrastructure provided
|
||||
by this template repository, including any modifications made to the infrastructure.
|
||||
Any software that uses or is derived from this template may be licensed under any
|
||||
OSI approved open source license, without being subject to the GPL version 2 license
|
||||
of the infrastructure.
|
||||
58
README.md
Executable file
58
README.md
Executable file
@@ -0,0 +1,58 @@
|
||||
# An opinionated Neovim Lua plugin template with a Nix CI
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
This repository is a template for Neovim plugins written in Lua.
|
||||
|
||||
## Features
|
||||
|
||||
- GitHub Actions workflows with a locally reproducible CI,
|
||||
using [`nix` flakes](https://nixos.wiki/wiki/Flakes).
|
||||
- Run tests with both neovim stable and neovim nightly
|
||||
using [`neorocksTest`](https://github.com/nvim-neorocks/neorocks).
|
||||
- Lints and a nix shell with pre-commit-hooks:
|
||||
- [`luacheck`](https://github.com/mpeterv/luacheck)
|
||||
- [`stylua`](https://github.com/JohnnyMorganz/StyLua)
|
||||
- [`lua-language-server` static type checks](https://github.com/LuaLS/lua-language-server/wiki/Diagnosis-Report)
|
||||
- [`alejandra`](https://github.com/kamadorueda/alejandra)
|
||||
- [`editorconfig-checker`](https://github.com/editorconfig-checker/editorconfig-checker)
|
||||
- [`markdownlint`](https://github.com/DavidAnson/markdownlint)
|
||||
- `vimPlugin` nix flake output.
|
||||
- Automatically publish tags to [LuaRocks](https://luarocks.org/labels/neovim)
|
||||
with the [luarocks-tag-release action](https://github.com/nvim-neorocks/luarocks-tag-release).
|
||||
- Automatic release PRs using [conventional commits](https://conventionalcommits.org/)
|
||||
with [release-please](https://github.com/googleapis/release-please).
|
||||
- Automatically comment PRs with a review checklist.
|
||||
|
||||
## Setup
|
||||
|
||||
1. Click on [Use this template](https://github.com/MrcJkb/nvim-lua-nix-plugin-template/generate)
|
||||
to start a repo based on this template. **Do _not_ fork it**.
|
||||
1. If your plugin depends on other plugins,
|
||||
add them to [`nvim-wrapped` in the `ci-overlay.nix`](./nix/ci-overlay.nix).
|
||||
1. Add the name of your plugin to [`flake.nix`](./flake.nix).
|
||||
1. Add [`plenary.nvim`](https://github.com/nvim-lua/plenary.nvim) specs
|
||||
to the `tests` directory.
|
||||
1. Create a [LuaRocks API key](https://luarocks.org/settings/api-keys).
|
||||
1. Add the API key to the repository's
|
||||
[GitHub Actions secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository).
|
||||
1. Text that needs to be updated is marked with `TODO:` comments.
|
||||
1. Rename [`plugin-template.nvim-scm-1.rockspec`](./plugin-template.nvim-scm-1.rockspec)
|
||||
|
||||
## Contributing
|
||||
|
||||
All contributions are welcome!
|
||||
See [CONTRIBUTING.md](./CONTRIBUTING.md).
|
||||
|
||||
## License
|
||||
|
||||
This template is [licensed according to GPL version 2](./LICENSE),
|
||||
with the following exception:
|
||||
|
||||
The license applies only to the Nix CI infrastructure provided by this template
|
||||
repository, including any modifications made to the infrastructure.
|
||||
Any software that uses or is derived from this template may be licensed under any
|
||||
[OSI approved open source license](https://opensource.org/licenses/),
|
||||
without being subject to the GPL version 2 license of this template.
|
||||
14
default.nix
Normal file
14
default.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
(
|
||||
import
|
||||
(
|
||||
let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
in
|
||||
fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||
}
|
||||
)
|
||||
{src = ./.;}
|
||||
)
|
||||
.defaultNix
|
||||
463
flake.lock
generated
Executable file
463
flake.lock
generated
Executable file
@@ -0,0 +1,463 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_3": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1704152458,
|
||||
"narHash": "sha256-DS+dGw7SKygIWf9w4eNBUZsK+4Ug27NwEWmn2tnbycg=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "88a2cd8166694ba0b6cb374700799cec53aef527",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701680307,
|
||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701680307,
|
||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_3": {
|
||||
"inputs": {
|
||||
"systems": "systems_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1685518550,
|
||||
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_4": {
|
||||
"inputs": {
|
||||
"systems": "systems_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1685518550,
|
||||
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"neorocks",
|
||||
"pre-commit-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660459072,
|
||||
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"pre-commit-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660459072,
|
||||
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"neodev-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1704434754,
|
||||
"narHash": "sha256-guSJ809CDvzbnPyYG8ELr7LEkuX833m5TK+U0hl0hbc=",
|
||||
"owner": "folke",
|
||||
"repo": "neodev.nvim",
|
||||
"rev": "be8d4d4cab6c13c6a572269c9d6a63774baba9a0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "folke",
|
||||
"repo": "neodev.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"neorocks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"neovim-nightly": "neovim-nightly",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1704432148,
|
||||
"narHash": "sha256-52a21kUZHQ538U+1yD/5pXqO9xrcL0uRUdYlLx0siFc=",
|
||||
"owner": "nvim-neorocks",
|
||||
"repo": "neorocks",
|
||||
"rev": "400a78596fea7014d7b2af43bd8011386517c39d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-neorocks",
|
||||
"repo": "neorocks",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"neovim-nightly": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": [
|
||||
"neorocks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"dir": "contrib",
|
||||
"lastModified": 1704423592,
|
||||
"narHash": "sha256-0bL9QYA9BelnMV3B3fbYhN2r80aH9eHJ/N5gv+64uWA=",
|
||||
"owner": "neovim",
|
||||
"repo": "neovim",
|
||||
"rev": "e09adfdcffe8a94e09d834bb49f42fd725ddd47b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "contrib",
|
||||
"owner": "neovim",
|
||||
"repo": "neovim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1704161960,
|
||||
"narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "63143ac2c9186be6d9da6035fa22620018c85932",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1703961334,
|
||||
"narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1685801374,
|
||||
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable_2": {
|
||||
"locked": {
|
||||
"lastModified": 1685801374,
|
||||
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1704161960,
|
||||
"narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "63143ac2c9186be6d9da6035fa22620018c85932",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1689261696,
|
||||
"narHash": "sha256-LzfUtFs9MQRvIoQ3MfgSuipBVMXslMPH/vZ+nM40LkA=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "df1eee2aa65052a18121ed4971081576b25d6b5c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
"flake-utils": "flake-utils_3",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"neorocks",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703939133,
|
||||
"narHash": "sha256-Gxe+mfOT6bL7wLC/tuT2F+V+Sb44jNr8YsJ3cyIl4Mo=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "9d3d7e18c6bc4473d7520200d4ddab12f8402d38",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks_2": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_3",
|
||||
"flake-utils": "flake-utils_4",
|
||||
"gitignore": "gitignore_2",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs-stable": "nixpkgs-stable_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703939133,
|
||||
"narHash": "sha256-Gxe+mfOT6bL7wLC/tuT2F+V+Sb44jNr8YsJ3cyIl4Mo=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "9d3d7e18c6bc4473d7520200d4ddab12f8402d38",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"neodev-nvim": "neodev-nvim",
|
||||
"neorocks": "neorocks",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"pre-commit-hooks": "pre-commit-hooks_2"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_3": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_4": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
184
flake.nix
Executable file
184
flake.nix
Executable file
@@ -0,0 +1,184 @@
|
||||
{
|
||||
description = "Neovim Nix flake CI template for GitHub Actions"; # TODO: Set description
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
|
||||
pre-commit-hooks = {
|
||||
url = "github:cachix/pre-commit-hooks.nix";
|
||||
};
|
||||
|
||||
neorocks = {
|
||||
url = "github:nvim-neorocks/neorocks";
|
||||
};
|
||||
|
||||
neodev-nvim = {
|
||||
url = "github:folke/neodev.nvim";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-parts,
|
||||
pre-commit-hooks,
|
||||
neorocks,
|
||||
neodev-nvim,
|
||||
...
|
||||
}: let
|
||||
name = "plugin-template.nvim"; # TODO: Choose a name
|
||||
|
||||
plugin-overlay = import ./nix/plugin-overlay.nix {
|
||||
inherit name self;
|
||||
};
|
||||
in
|
||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
perSystem = {
|
||||
config,
|
||||
self',
|
||||
inputs',
|
||||
system,
|
||||
...
|
||||
}: let
|
||||
ci-overlay = import ./nix/ci-overlay.nix {
|
||||
inherit
|
||||
self
|
||||
neodev-nvim
|
||||
;
|
||||
plugin-name = name;
|
||||
};
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
ci-overlay
|
||||
neorocks.overlays.default
|
||||
plugin-overlay
|
||||
];
|
||||
};
|
||||
|
||||
mkTypeCheck = {
|
||||
nvim-api ? [],
|
||||
disabled-diagnostics ? [],
|
||||
}:
|
||||
pre-commit-hooks.lib.${system}.run {
|
||||
src = self;
|
||||
hooks = {
|
||||
lua-ls.enable = true;
|
||||
};
|
||||
settings = {
|
||||
lua-ls = {
|
||||
config = {
|
||||
runtime.version = "LuaJIT";
|
||||
Lua = {
|
||||
workspace = {
|
||||
library =
|
||||
nvim-api
|
||||
++ [
|
||||
# TODO: Add lua API dependencies here, e.g.
|
||||
# "${pkgs.lua51Packages.fzy}/share/lua/5.1"
|
||||
# "${pkgs.vimPlugins.telescope-nvim}/lua"
|
||||
]
|
||||
++ [
|
||||
"\${3rd}/busted/library"
|
||||
"\${3rd}/luassert/library"
|
||||
];
|
||||
ignoreDir = [
|
||||
".git"
|
||||
".github"
|
||||
".direnv"
|
||||
"result"
|
||||
"nix"
|
||||
"doc"
|
||||
];
|
||||
};
|
||||
diagnostics = {
|
||||
libraryFiles = "Disable";
|
||||
disable = disabled-diagnostics;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
type-check-stable = mkTypeCheck {
|
||||
nvim-api = [
|
||||
"${pkgs.neovim}/share/nvim/runtime/lua"
|
||||
"${pkgs.neodev-plugin}/types/stable"
|
||||
];
|
||||
disabled-diagnostics = [
|
||||
# For compatibility with nightly, some diagnostics may have to be disabled here.
|
||||
];
|
||||
};
|
||||
|
||||
type-check-nightly = mkTypeCheck {
|
||||
nvim-api = [
|
||||
"${pkgs.neovim-nightly}/share/nvim/runtime/lua"
|
||||
"${pkgs.neodev-plugin}/types/nightly"
|
||||
];
|
||||
};
|
||||
|
||||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||
src = self;
|
||||
hooks = {
|
||||
alejandra.enable = true;
|
||||
stylua.enable = true;
|
||||
luacheck.enable = true;
|
||||
editorconfig-checker.enable = true;
|
||||
markdownlint.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
devShell = pkgs.nvim-nightly-tests.overrideAttrs (oa: {
|
||||
name = "devShell"; # TODO: Choose a name
|
||||
inherit (pre-commit-check) shellHook;
|
||||
buildInputs = with pre-commit-hooks.packages.${system};
|
||||
[
|
||||
alejandra
|
||||
lua-language-server
|
||||
stylua
|
||||
luacheck
|
||||
editorconfig-checker
|
||||
markdownlint-cli
|
||||
]
|
||||
++ oa.buildInputs;
|
||||
});
|
||||
in {
|
||||
devShells = {
|
||||
default = devShell;
|
||||
inherit devShell;
|
||||
};
|
||||
|
||||
packages = rec {
|
||||
default = nvim-plugin;
|
||||
inherit (pkgs.vimPlugins) nvim-plugin;
|
||||
inherit (pkgs) docgen;
|
||||
};
|
||||
|
||||
checks = {
|
||||
inherit
|
||||
pre-commit-check
|
||||
type-check-stable
|
||||
type-check-nightly
|
||||
;
|
||||
inherit
|
||||
(pkgs)
|
||||
nvim-stable-tests
|
||||
nvim-nightly-tests
|
||||
;
|
||||
};
|
||||
};
|
||||
flake = {
|
||||
overlays.default = plugin-overlay;
|
||||
};
|
||||
};
|
||||
}
|
||||
71
nix/ci-overlay.nix
Executable file
71
nix/ci-overlay.nix
Executable file
@@ -0,0 +1,71 @@
|
||||
# Add flake.nix test inputs as arguments here
|
||||
{
|
||||
self,
|
||||
neodev-nvim,
|
||||
plugin-name,
|
||||
}: final: prev:
|
||||
with final.lib;
|
||||
with final.stdenv; let
|
||||
nvim-nightly = final.neovim-nightly;
|
||||
|
||||
neodev-plugin = final.pkgs.vimUtils.buildVimPlugin {
|
||||
name = "neodev.nvim";
|
||||
src = neodev-nvim;
|
||||
};
|
||||
|
||||
mkNeorocksTest = {
|
||||
name,
|
||||
nvim ? final.neovim-unwrapped,
|
||||
extraPkgs ? [],
|
||||
}: let
|
||||
nvim-wrapped = final.pkgs.wrapNeovim nvim {
|
||||
configure = {
|
||||
packages.myVimPackage = {
|
||||
start = [
|
||||
# Add plugin dependencies that aren't on LuaRocks here
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
final.pkgs.neorocksTest {
|
||||
inherit name;
|
||||
pname = plugin-name;
|
||||
src = self;
|
||||
neovim = nvim-wrapped;
|
||||
|
||||
# luaPackages = ps: with ps; [];
|
||||
# extraPackages = [];
|
||||
|
||||
preCheck = ''
|
||||
export HOME=$(realpath .)
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r tests $out
|
||||
'';
|
||||
};
|
||||
|
||||
docgen = final.writeShellApplication {
|
||||
name = "docgen";
|
||||
runtimeInputs = with final; [
|
||||
lemmy-help
|
||||
];
|
||||
text = ''
|
||||
mkdir -p doc
|
||||
# TODO: Update this!
|
||||
lemmy-help lua/rocks/{init,commands,config/init}.lua > doc/nvim-plugin.txt
|
||||
'';
|
||||
};
|
||||
in {
|
||||
nvim-stable-tests = mkNeorocksTest {name = "neovim-stable-tests";};
|
||||
nvim-nightly-tests = mkNeorocksTest {
|
||||
name = "neovim-nightly-tests";
|
||||
nvim = nvim-nightly;
|
||||
};
|
||||
inherit
|
||||
neodev-plugin
|
||||
docgen
|
||||
;
|
||||
}
|
||||
39
nix/plugin-overlay.nix
Executable file
39
nix/plugin-overlay.nix
Executable file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
name,
|
||||
self,
|
||||
}: final: prev: let
|
||||
packageOverrides = luaself: luaprev: {
|
||||
# TODO: Rename
|
||||
plugin-template-nvim = luaself.callPackage ({buildLuarocksPackage}:
|
||||
buildLuarocksPackage {
|
||||
pname = name;
|
||||
version = "scm-1";
|
||||
# TODO: Set rockspec name
|
||||
knownRockspec = "${self}/plugin-template.nvim-scm-1.rockspec";
|
||||
src = self;
|
||||
}) {};
|
||||
};
|
||||
|
||||
lua5_1 = prev.lua5_1.override {
|
||||
inherit packageOverrides;
|
||||
};
|
||||
lua51Packages = final.lua5_1.pkgs;
|
||||
|
||||
# TODO: Rename
|
||||
nvim-plugin = final.neovimUtils.buildNeovimPlugin {
|
||||
pname = name;
|
||||
src = self;
|
||||
version = "dev";
|
||||
};
|
||||
in {
|
||||
inherit
|
||||
lua5_1
|
||||
lua51Packages
|
||||
;
|
||||
|
||||
vimPlugins =
|
||||
prev.vimPlugins
|
||||
// {
|
||||
inherit nvim-plugin;
|
||||
};
|
||||
}
|
||||
34
plugin-template.nvim-scm-1.rockspec
Normal file
34
plugin-template.nvim-scm-1.rockspec
Normal file
@@ -0,0 +1,34 @@
|
||||
-- NOTE: This rockspec is used for running busted tests only,
|
||||
-- not for publishing to LuaRocks.org
|
||||
|
||||
-- TODO: Rename this file
|
||||
|
||||
local _MODREV, _SPECREV = 'scm', '-1'
|
||||
rockspec_format = '3.0'
|
||||
package = 'plugin-template.nvim' -- TODO: Set name
|
||||
version = _MODREV .. _SPECREV
|
||||
|
||||
dependencies = {
|
||||
'lua >= 5.1',
|
||||
}
|
||||
|
||||
test_dependencies = {
|
||||
'lua >= 5.1',
|
||||
}
|
||||
|
||||
source = {
|
||||
-- TODO: Replace <user>
|
||||
url = 'git://github.com/<user>/' .. package,
|
||||
}
|
||||
|
||||
build = {
|
||||
type = 'builtin',
|
||||
-- TODO: Add runtime diretories here
|
||||
-- copy_directories = {
|
||||
-- 'doc',
|
||||
-- "plugin",
|
||||
-- },
|
||||
}
|
||||
|
||||
|
||||
|
||||
14
shell.nix
Normal file
14
shell.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
(
|
||||
import
|
||||
(
|
||||
let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
in
|
||||
fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||
}
|
||||
)
|
||||
{src = ./.;}
|
||||
)
|
||||
.shellNix
|
||||
5
spec/example_spec.lua
Executable file
5
spec/example_spec.lua
Executable file
@@ -0,0 +1,5 @@
|
||||
describe('Test example', function()
|
||||
it('Test can access vim namespace', function()
|
||||
assert.are.same(vim.trim(' a '), 'a')
|
||||
end)
|
||||
end)
|
||||
Reference in New Issue
Block a user