Compare commits

..

No commits in common. "5fac61820234dfa2a58160a9b6ef6076d47e2010" and "43843da2300fa2eba2dc880cfb30ff964a1311de" have entirely different histories.

11 changed files with 180 additions and 382 deletions

6
.github/CODEOWNERS vendored
View file

@ -1,5 +1 @@
# Codeowners should be used to distinguish the maintainers of the project
# and not contributors of specific modules to nvf. While adding a new module
# please consider adding yourself to 'meta.maintainers' in the module instead
# of CODEOWNERS here.
* @NotAShelf @horriblename @Soliprem
* @NotAShelf

20
.github/README.md vendored
View file

@ -246,15 +246,14 @@ Neovim's behaviour with Nix.
### Co-Maintainers
Alongside [myself](https://github.com/notashelf), nvf is developed by those
talented folk. nvf would not be what it is today without their invaluable
contributions.
Alongside myself, nvf is developed by those talented folk:
- [**@horriblename**](https://github.com/horriblename)
([Liberapay](https://liberapay.com/horriblename/))- For actively implementing
planned features and quality of life updates.
- [**@Soliprem**](https://github.com/soliprem) - For rigorously implementing
missing features and excellent work on new language modules.
- [**@Diniamo**](https://github.com/Diniamo)
([Liberapay](https://en.liberapay.com/diniamo/)) - For actively submitting
pull requests, issues and assistance with maintenance of nvf.
Please do remember to extend your thanks (financially or otherwise) if this
project has been helpful to you.
@ -271,14 +270,14 @@ heart-felt thanks to
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
to work and Nix assistance.
- [**@n3oney**](https://github.com/n3oney) - For making custom keybinds finally
possible, great ideas and module additions.
possible, and other module additions.
- [**@Yavko**](https://github.com/Yavko) - For the amazing **nvf** logo
- [**@FrothyMarrow**](https://github.com/FrothyMarrow) - For seeing mistakes
that I could not and contributing good ideas & code.
that I could not.
- [**@Gerg-l**](https://github.com/gerg-l) 🐸 - For the modern Neovim wrapper,
[mnw], and occasional improvements to the codebase.
- [**@Diniamo**](https://github.com/Diniamo) - For actively submitting pull
requests, issues and assistance with co-maintenance of nvf.
[mnw], and occasional code improvements.
- [**@Soliprem**](https://github.com/soliprem) - Rigorously implementing missing
features and excellent work on new language modules.
and everyone who has submitted issues or pull requests!
@ -302,6 +301,7 @@ including:
I am grateful for their previous work and inspiration, and I wholeheartedly
recommend checking their work out.
<br/>
## License

56
.github/workflows/check-docs.yml vendored Normal file
View file

@ -0,0 +1,56 @@
name: "Validate flake & check documentation"
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
paths:
- docs/**
jobs:
flake-docs-check:
name: Validate Flake Documentation
runs-on: ubuntu-latest
strategy:
matrix:
package:
- docs
- docs-html
- docs-manpages
- docs-json
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Checkout
uses: actions/checkout@v4
- name: Set default git branch (to reduce log spam)
run: git config --global init.defaultBranch main
- name: Build documentation packages
run: nix build .#${{ matrix.package }} --print-build-logs
- name: Get current date
id: get-date
# output format: 2023-12-22-120000
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT}
- name: Upload doc artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.package }}"
path: result/share/doc/nvf
flake-docs-linkcheck:
name: Validate hyperlinks in documentation sources
runs-on: ubuntu-latest
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Checkout
uses: actions/checkout@v4
- name: Build documentation packages
run: nix build .#docs-linkcheck -Lv

View file

@ -1,6 +1,4 @@
name: "Treewide Checks"
permissions: read-all
name: "Validate flake & check formatting"
on:
pull_request:
workflow_dispatch:
@ -8,13 +6,13 @@ on:
branches:
- main
paths-ignore:
- .github/**
- assets/**
- .gitignore
jobs:
nix-flake-check:
name: "Validate flake"
name: Validate Flake
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v4
@ -26,9 +24,8 @@ jobs:
run: nix flake check
format-with-alejandra:
name: "Check formatting"
name: Formatting via Alejandra
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v4
@ -36,116 +33,4 @@ jobs:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Check formatting via Alejandra
run: nix run nixpkgs#alejandra -- -c .
check-typos:
name: "Check source tree for typos"
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/typos@master
with:
config: .github/typos.toml
- if: ${{ failure() }}
shell: bash
run: |
echo "::error:: Current codebase contains typos that were caught by the CI!"
echo "If those typos were intentional, please add them to the ignored regexes in .github/typos.toml"
echo "[skip ci] label may be added to the PR title if this is a one-time issue and is safe to ignore"
exit 1
flake-docs-check:
name: "Validate documentation builds"
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
strategy:
matrix:
package:
- docs
- docs-html
- docs-manpages
- docs-json
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Checkout
uses: actions/checkout@v4
- name: Set default git branch (to reduce log spam)
run: git config --global init.defaultBranch main
- name: Build documentation packages
run: nix build .#${{ matrix.package }} --print-build-logs
- name: Get current date
id: get-date
# output format: 2023-12-22-120000
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT}
- name: Upload doc artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.package }}"
path: result/share/doc/nvf
flake-docs-linkcheck:
name: "Validate hyperlinks in documentation sources"
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Checkout
uses: actions/checkout@v4
- name: Build linkcheck package
run: nix build .#docs-linkcheck -Lv
check-editorconfig:
name: "Validate Editorconfig conformance"
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Get list of changed files from PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api \
repos/${{ github.repository }}/pulls/${{github.event.number}}/files --paginate \
| jq '.[] | select(.status != "removed") | .filename' \
> "$HOME/changed_files"
- name: Print list of changed files
run: |
cat "$HOME/changed_files"
- name: Checkout
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Checking EditorConfig
shell: bash
run: |
cat "$HOME/changed_files" | nix-shell -p editorconfig-checker.out \
--run 'xargs -r editorconfig-checker -disable-indentation -exclude flake.lock --verbose'
echo -n "Check status: $?"
- if: ${{ failure() }}
shell: bash
run: |
echo "::error:: Current formatting does not fit convention provided by .editorconfig located in the project root."
echo "Please make sure your editor properly integrates editorconfig, Neovim does so by default."
echo "See https://editorconfig.org/#download on how to integrate Editorconfig to your editor."
exit 1
- run: nix run nixpkgs#alejandra -- -c .

View file

@ -1,13 +1,9 @@
name: Delete Stale Branches
permissions:
contents: write
name: Cleanup
on:
workflow_dispatch:
schedule:
- cron: "0 4 1 * *" # 4AM on 1st of every month
- cron: "0 4 15 * *" # 4AM on the 15th of every month
jobs:
branches:
name: Cleanup old branches

View file

@ -9,7 +9,7 @@ on:
- "modules/**"
- "docs/**"
# Defining permissions here passes it to all jobs.
# Defining permissions here passes it to all workflows.
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions:
contents: write
@ -34,7 +34,7 @@ jobs:
run: git config --global init.defaultBranch main
- name: Build documentation packages
run: nix build .#docs-html --print-build-logs || exit 1
run: nix build .#docs-html --print-build-logs
- name: Deploy to GitHub Pages preview
run: |

46
.github/workflows/editorconfig.yml vendored Normal file
View file

@ -0,0 +1,46 @@
name: "Check validity of .editorconfig"
permissions: read-all
on:
pull_request:
jobs:
check-editorconfig:
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Get list of changed files from PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api \
repos/notashelf/nvf/pulls/${{github.event.number}}/files --paginate \
| jq '.[] | select(.status != "removed") | .filename' \
> "$HOME/changed_files"
- name: Print list of changed files
run: |
cat "$HOME/changed_files"
- name: Checkout
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Checking EditorConfig
shell: bash
run: |
cat "$HOME/changed_files" | nix-shell -p editorconfig-checker.out --run 'xargs -r editorconfig-checker -disable-indentation -exclude flake.lock --verbose'
echo -n "Check status: $?"
- name: Fail Gracefully
if: ${{ failure() }}
shell: bash
run: |
echo "::error:: Current formatting does not fit convention provided by .editorconfig located in the project root."
echo "Please make sure your editor properly integrates editorconfig. See https://editorconfig.org/#download for more."
exit 1

30
.github/workflows/typos.yml vendored Normal file
View file

@ -0,0 +1,30 @@
name: "Check for typos in the source tree"
permissions: read-all
on:
pull_request:
workflow_dispatch:
push:
jobs:
check-typos:
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/typos@master
with:
config: .github/typos.toml
- name: Fail Gracefully
if: ${{ failure() }}
shell: bash
run: |
echo "::error:: Current codebase contains typos that were caught by the CI!"
echo "If those typos were intentional, please add them to the ignored regexes in .github/typos.toml"
echo "[skip ci] label may be used if this is a one-time issue"
exit 1

View file

@ -5,8 +5,8 @@ options will include useful comments, warnings or setup tips on how a module
option is meant to be used as well as examples in complex cases.
An offline version of this page is bundled with nvf as a part of the manpages
which you can access with `man 5 nvf`. Please let us know if you believe any of
the options below are missing useful examples.
which you can access with `man 5 nvf`. Please us know if you believe any of the
options below are missing useful examples.
<!--
In the manual, individual options may be referenced in Hyperlinks as follows:

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,5 @@
# Based off of:
# https://github.com/NixOS/nixpkgs/blob/776c3bee4769c616479393aeefceefeda16b6fcb/pkgs/tools/nix/npins/source.nix
{
lib,
fetchurl,
@ -6,16 +8,7 @@
}:
builtins.mapAttrs
(
name: let
getUrl = {
url,
hash,
...
}:
fetchurl {
inherit url;
sha256 = hash;
};
_: let
getZip = {
url,
hash,
@ -30,29 +23,19 @@ builtins.mapAttrs
repository,
revision,
url ? null,
submodules,
hash,
...
} @ attrs:
assert repository ? type;
if url != null && !submodules
if url != null
then getZip attrs
else
assert repository.type == "Git"; let
url' =
if repository.type == "Git"
then repository.url
else if repository.type == "GitHub"
then "https://github.com/${repository.owner}/${repository.repo}.git"
else if repository.type == "GitLab"
then "${repository.server}/${repository.repo_path}.git"
else throw "Unrecognized repository type ${repository.type}";
name = let
matched = builtins.match "^.*/([^/]*)(\\.git)?$" url';
short = builtins.substring 0 7 revision;
urlToName = url: rev: let
matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url;
short = builtins.substring 0 7 rev;
appendShort =
if (builtins.match "[a-f0-9]*" revision) != null
if (builtins.match "[a-f0-9]*" rev) != null
then "-${short}"
else "";
in "${
@ -60,53 +43,43 @@ builtins.mapAttrs
then "source"
else builtins.head matched
}${appendShort}";
name = urlToName repository.url revision;
in
fetchgit {
inherit name;
url = url';
inherit (repository) url;
rev = revision;
sha256 = hash;
fetchSubmodules = submodules;
};
mkPyPiSource = {
url,
hash,
...
}:
fetchurl {
inherit url;
sha256 = hash;
};
in
spec:
assert spec ? type; let
mayOverride = path: let
envVarName = "NPINS_OVERRIDE_${saneName}";
saneName = lib.stringAsChars (c:
if (builtins.match "[a-zA-Z0-9]" c) == null
then "_"
else c)
name;
ersatz = builtins.getEnv envVarName;
in
if ersatz == ""
then path
else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" (
if builtins.substring 0 1 ersatz == "/"
then /. + ersatz
else /. + builtins.getEnv "PWD" + "/${ersatz}"
);
func =
{
Git = mkGitSource;
GitRelease = mkGitSource;
PyPi = getUrl;
PyPi = mkPyPiSource;
Channel = getZip;
Tarball = getUrl;
}
.${spec.type}
or (builtins.throw "Unknown source type ${spec.type}");
in
spec // {outPath = mayOverride (func spec);}
spec // {outPath = func spec;}
)
(
let
json = lib.importJSON ./sources.json;
in
assert lib.assertMsg (json.version == 5) "Npins version mismatch!";
assert lib.assertMsg (json.version == 3) "Npins version mismatch!";
json.pins
)