mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-16 15:30:50 +00:00
Compare commits
20 commits
5bc627f4e4
...
e027bd0718
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e027bd0718 |
||
|
|
e57b7e2895 |
||
|
95126f5da0 |
|||
|
12706b81e2 |
|||
|
30ffe11cc0 |
|||
|
|
8b1e6080f6 |
||
|
|
05da6e3318 |
||
|
f605bceeca |
|||
|
|
d93d755989 |
||
|
|
6d0e580085 |
||
|
a70e9e5e26 |
|||
|
73b0927189 |
|||
|
|
e1a1a4e6f4 |
||
|
|
68490f43ff |
||
|
|
11dd3752f8 |
||
|
|
e771f299c1 |
||
|
|
e8dd47bbd0 |
||
|
|
297ac641ed |
||
|
|
8912302427 |
||
|
|
5ecb1a4172 |
29 changed files with 581 additions and 235 deletions
6
.github/CODEOWNERS
vendored
6
.github/CODEOWNERS
vendored
|
|
@ -1 +1,5 @@
|
||||||
* @NotAShelf
|
# 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
|
||||||
|
|
|
||||||
20
.github/README.md
vendored
20
.github/README.md
vendored
|
|
@ -246,14 +246,15 @@ Neovim's behaviour with Nix.
|
||||||
|
|
||||||
### Co-Maintainers
|
### Co-Maintainers
|
||||||
|
|
||||||
Alongside myself, nvf is developed by those talented folk:
|
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.
|
||||||
|
|
||||||
- [**@horriblename**](https://github.com/horriblename)
|
- [**@horriblename**](https://github.com/horriblename)
|
||||||
([Liberapay](https://liberapay.com/horriblename/))- For actively implementing
|
([Liberapay](https://liberapay.com/horriblename/))- For actively implementing
|
||||||
planned features and quality of life updates.
|
planned features and quality of life updates.
|
||||||
- [**@Diniamo**](https://github.com/Diniamo)
|
- [**@Soliprem**](https://github.com/soliprem) - For rigorously implementing
|
||||||
([Liberapay](https://en.liberapay.com/diniamo/)) - For actively submitting
|
missing features and excellent work on new language modules.
|
||||||
pull requests, issues and assistance with maintenance of nvf.
|
|
||||||
|
|
||||||
Please do remember to extend your thanks (financially or otherwise) if this
|
Please do remember to extend your thanks (financially or otherwise) if this
|
||||||
project has been helpful to you.
|
project has been helpful to you.
|
||||||
|
|
@ -270,14 +271,14 @@ heart-felt thanks to
|
||||||
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
|
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
|
||||||
to work and Nix assistance.
|
to work and Nix assistance.
|
||||||
- [**@n3oney**](https://github.com/n3oney) - For making custom keybinds finally
|
- [**@n3oney**](https://github.com/n3oney) - For making custom keybinds finally
|
||||||
possible, and other module additions.
|
possible, great ideas and module additions.
|
||||||
- [**@Yavko**](https://github.com/Yavko) - For the amazing **nvf** logo
|
- [**@Yavko**](https://github.com/Yavko) - For the amazing **nvf** logo
|
||||||
- [**@FrothyMarrow**](https://github.com/FrothyMarrow) - For seeing mistakes
|
- [**@FrothyMarrow**](https://github.com/FrothyMarrow) - For seeing mistakes
|
||||||
that I could not.
|
that I could not and contributing good ideas & code.
|
||||||
- [**@Gerg-l**](https://github.com/gerg-l) 🐸 - For the modern Neovim wrapper,
|
- [**@Gerg-l**](https://github.com/gerg-l) 🐸 - For the modern Neovim wrapper,
|
||||||
[mnw], and occasional code improvements.
|
[mnw], and occasional improvements to the codebase.
|
||||||
- [**@Soliprem**](https://github.com/soliprem) - Rigorously implementing missing
|
- [**@Diniamo**](https://github.com/Diniamo) - For actively submitting pull
|
||||||
features and excellent work on new language modules.
|
requests, issues and assistance with co-maintenance of nvf.
|
||||||
|
|
||||||
and everyone who has submitted issues or pull requests!
|
and everyone who has submitted issues or pull requests!
|
||||||
|
|
||||||
|
|
@ -301,7 +302,6 @@ including:
|
||||||
|
|
||||||
I am grateful for their previous work and inspiration, and I wholeheartedly
|
I am grateful for their previous work and inspiration, and I wholeheartedly
|
||||||
recommend checking their work out.
|
recommend checking their work out.
|
||||||
<br/>
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
||||||
56
.github/workflows/check-docs.yml
vendored
56
.github/workflows/check-docs.yml
vendored
|
|
@ -1,56 +0,0 @@
|
||||||
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
|
|
||||||
127
.github/workflows/check.yml
vendored
127
.github/workflows/check.yml
vendored
|
|
@ -1,4 +1,6 @@
|
||||||
name: "Validate flake & check formatting"
|
name: "Treewide Checks"
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
@ -6,13 +8,13 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- .github/**
|
|
||||||
- assets/**
|
- assets/**
|
||||||
- .gitignore
|
|
||||||
jobs:
|
jobs:
|
||||||
nix-flake-check:
|
nix-flake-check:
|
||||||
name: Validate Flake
|
name: "Validate flake"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -24,8 +26,9 @@ jobs:
|
||||||
run: nix flake check
|
run: nix flake check
|
||||||
|
|
||||||
format-with-alejandra:
|
format-with-alejandra:
|
||||||
name: Formatting via Alejandra
|
name: "Check formatting"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -33,4 +36,116 @@ jobs:
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
- run: nix run nixpkgs#alejandra -- -c .
|
- 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
|
||||||
|
|
|
||||||
8
.github/workflows/cleanup.yml
vendored
8
.github/workflows/cleanup.yml
vendored
|
|
@ -1,9 +1,13 @@
|
||||||
name: Cleanup
|
name: Delete Stale Branches
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 4 1 * *" # 4AM on 1st of every month
|
- cron: "0 4 1 * *" # 4AM on 1st of every month
|
||||||
- cron: "0 4 15 * *" # 4AM on the 15th of every month
|
- cron: "0 4 15 * *" # 4AM on the 15th of every month
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
branches:
|
branches:
|
||||||
name: Cleanup old branches
|
name: Cleanup old branches
|
||||||
|
|
@ -13,7 +17,7 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: "Delete old branches"
|
- name: "Delete old branches"
|
||||||
uses: beatlabs/delete-old-branches-action@v0.0.10
|
uses: beatlabs/delete-old-branches-action@v0.0.11
|
||||||
with:
|
with:
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
date: "1 months ago"
|
date: "1 months ago"
|
||||||
|
|
|
||||||
4
.github/workflows/docs-preview.yml
vendored
4
.github/workflows/docs-preview.yml
vendored
|
|
@ -9,7 +9,7 @@ on:
|
||||||
- "modules/**"
|
- "modules/**"
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
|
|
||||||
# Defining permissions here passes it to all workflows.
|
# Defining permissions here passes it to all jobs.
|
||||||
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
|
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
@ -34,7 +34,7 @@ jobs:
|
||||||
run: git config --global init.defaultBranch main
|
run: git config --global init.defaultBranch main
|
||||||
|
|
||||||
- name: Build documentation packages
|
- name: Build documentation packages
|
||||||
run: nix build .#docs-html --print-build-logs
|
run: nix build .#docs-html --print-build-logs || exit 1
|
||||||
|
|
||||||
- name: Deploy to GitHub Pages preview
|
- name: Deploy to GitHub Pages preview
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
46
.github/workflows/editorconfig.yml
vendored
46
.github/workflows/editorconfig.yml
vendored
|
|
@ -1,46 +0,0 @@
|
||||||
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
30
.github/workflows/typos.yml
vendored
|
|
@ -1,30 +0,0 @@
|
||||||
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
|
|
||||||
|
|
@ -82,6 +82,7 @@ isMaximal: {
|
||||||
elixir.enable = false;
|
elixir.enable = false;
|
||||||
haskell.enable = false;
|
haskell.enable = false;
|
||||||
ruby.enable = false;
|
ruby.enable = false;
|
||||||
|
fsharp.enable = false;
|
||||||
|
|
||||||
tailwind.enable = false;
|
tailwind.enable = false;
|
||||||
svelte.enable = false;
|
svelte.enable = false;
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,6 @@
|
||||||
inherit (nvimModuleDocs) optionsJSON;
|
inherit (nvimModuleDocs) optionsJSON;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
inherit (inputs) nmd;
|
|
||||||
|
|
||||||
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
|
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
|
||||||
# `nixosOptionsDoc` is more customizable.
|
# `nixosOptionsDoc` is more customizable.
|
||||||
options.json =
|
options.json =
|
||||||
|
|
|
||||||
|
|
@ -38,3 +38,22 @@ As of version **0.7**, we exposed an API for configuring lazy-loaded plugins via
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## LazyFile event {#sec-lazyfile-event}
|
||||||
|
|
||||||
|
You can use the `LazyFile` user event to load a plugin when a file is opened:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
config.vim.lazy.plugins = {
|
||||||
|
"aerial.nvim" = {
|
||||||
|
package = pkgs.vimPlugins.aerial-nvim;
|
||||||
|
event = [{event = "User"; pattern = "LazyFile";}];
|
||||||
|
# ...
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can consider `LazyFile` as an alias to
|
||||||
|
`["BufReadPost" "BufNewFile" "BufWritePre"]`
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ formatting to diagnostics. The following languages have sections under the
|
||||||
- Go: [vim.languages.go.enable](#opt-vim.languages.go.enable)
|
- Go: [vim.languages.go.enable](#opt-vim.languages.go.enable)
|
||||||
- Lua: [vim.languages.lua.enable](#opt-vim.languages.lua.enable)
|
- Lua: [vim.languages.lua.enable](#opt-vim.languages.lua.enable)
|
||||||
- PHP: [vim.languages.php.enable](#opt-vim.languages.php.enable)
|
- PHP: [vim.languages.php.enable](#opt-vim.languages.php.enable)
|
||||||
|
- F#: [vim.languages.fsharp.enable](#opt-vim.languages.fsharp.enable)
|
||||||
|
|
||||||
Adding support for more languages, and improving support for existing ones are
|
Adding support for more languages, and improving support for existing ones are
|
||||||
great places where you can contribute with a PR.
|
great places where you can contribute with a PR.
|
||||||
|
|
|
||||||
|
|
@ -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.
|
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
|
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 us know if you believe any of the
|
which you can access with `man 5 nvf`. Please let us know if you believe any of
|
||||||
options below are missing useful examples.
|
the options below are missing useful examples.
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
In the manual, individual options may be referenced in Hyperlinks as follows:
|
In the manual, individual options may be referenced in Hyperlinks as follows:
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@
|
||||||
[blink.cmp]: https://github.com/saghen/blink.cmp
|
[blink.cmp]: https://github.com/saghen/blink.cmp
|
||||||
|
|
||||||
- Add [blink.cmp] support.
|
- Add [blink.cmp] support.
|
||||||
|
- Add `LazyFile` user event.
|
||||||
|
|
||||||
[diniamo](https://github.com/diniamo):
|
[diniamo](https://github.com/diniamo):
|
||||||
|
|
||||||
|
|
@ -244,8 +245,8 @@
|
||||||
syncing of nvim shell environment with direnv's.
|
syncing of nvim shell environment with direnv's.
|
||||||
- Add [blink.cmp] source options and some default-disabled sources.
|
- Add [blink.cmp] source options and some default-disabled sources.
|
||||||
- Add [blink.cmp] option to add
|
- Add [blink.cmp] option to add
|
||||||
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets)
|
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so
|
||||||
so blink.cmp can source snippets from it.
|
blink.cmp can source snippets from it.
|
||||||
- Fix [blink.cmp] breaking when built-in sources were modified.
|
- Fix [blink.cmp] breaking when built-in sources were modified.
|
||||||
|
|
||||||
[TheColorman](https://github.com/TheColorman):
|
[TheColorman](https://github.com/TheColorman):
|
||||||
|
|
@ -271,3 +272,11 @@
|
||||||
[Butzist](https://github.com/butzist):
|
[Butzist](https://github.com/butzist):
|
||||||
|
|
||||||
- Add Helm chart support under `vim.languages.helm`.
|
- Add Helm chart support under `vim.languages.helm`.
|
||||||
|
|
||||||
|
[rice-cracker-dev](https://github.com/rice-cracker-dev):
|
||||||
|
|
||||||
|
- `eslint_d` now checks for configuration files to load.
|
||||||
|
|
||||||
|
[Sc3l3t0n](https://github.com/Sc3l3t0n):
|
||||||
|
|
||||||
|
- Add F# support under `vim.languages.fsharp`.
|
||||||
|
|
|
||||||
17
flake.lock
generated
17
flake.lock
generated
|
|
@ -106,22 +106,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nmd": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1705050560,
|
|
||||||
"narHash": "sha256-x3zzcdvhJpodsmdjqB4t5mkVW22V3wqHLOun0KRBzUI=",
|
|
||||||
"owner": "~rycee",
|
|
||||||
"repo": "nmd",
|
|
||||||
"rev": "66d9334933119c36f91a78d565c152a4fdc8d3d3",
|
|
||||||
"type": "sourcehut"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "~rycee",
|
|
||||||
"repo": "nmd",
|
|
||||||
"type": "sourcehut"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
|
|
@ -129,7 +113,6 @@
|
||||||
"mnw": "mnw",
|
"mnw": "mnw",
|
||||||
"nil": "nil",
|
"nil": "nil",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nmd": "nmd",
|
|
||||||
"systems": "systems_2"
|
"systems": "systems_2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -86,12 +86,6 @@
|
||||||
# Alternate neovim-wrapper
|
# Alternate neovim-wrapper
|
||||||
mnw.url = "github:Gerg-L/mnw";
|
mnw.url = "github:Gerg-L/mnw";
|
||||||
|
|
||||||
# For generating documentation website
|
|
||||||
nmd = {
|
|
||||||
url = "sourcehut:~rycee/nmd";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Language servers (use master instead of nixpkgs)
|
# Language servers (use master instead of nixpkgs)
|
||||||
nil = {
|
nil = {
|
||||||
url = "github:oxalica/nil";
|
url = "github:oxalica/nil";
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
|
stdenv,
|
||||||
rustPlatform,
|
rustPlatform,
|
||||||
hostPlatform,
|
hostPlatform,
|
||||||
vimUtils,
|
vimUtils,
|
||||||
git,
|
git,
|
||||||
src,
|
src,
|
||||||
version,
|
version,
|
||||||
fetchpatch,
|
|
||||||
}: let
|
}: let
|
||||||
blink-fuzzy-lib = rustPlatform.buildRustPackage {
|
blink-fuzzy-lib = rustPlatform.buildRustPackage {
|
||||||
pname = "blink-fuzzy-lib";
|
pname = "blink-fuzzy-lib";
|
||||||
|
|
@ -19,11 +19,6 @@
|
||||||
|
|
||||||
nativeBuildInputs = [git];
|
nativeBuildInputs = [git];
|
||||||
};
|
};
|
||||||
|
|
||||||
libExt =
|
|
||||||
if hostPlatform.isDarwin
|
|
||||||
then "dylib"
|
|
||||||
else "so";
|
|
||||||
in
|
in
|
||||||
vimUtils.buildVimPlugin {
|
vimUtils.buildVimPlugin {
|
||||||
pname = "blink-cmp";
|
pname = "blink-cmp";
|
||||||
|
|
@ -31,22 +26,13 @@ in
|
||||||
|
|
||||||
# blink references a repro.lua which is placed outside the lua/ directory
|
# blink references a repro.lua which is placed outside the lua/ directory
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
preInstall = ''
|
preInstall = let
|
||||||
|
ext = stdenv.hostPlatform.extensions.sharedLibrary;
|
||||||
|
in ''
|
||||||
mkdir -p target/release
|
mkdir -p target/release
|
||||||
ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy.${libExt} target/release/libblink_cmp_fuzzy.${libExt}
|
ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy${ext} target/release/libblink_cmp_fuzzy${ext}
|
||||||
echo -n "nix" > target/release/version
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Borrowed from nixpkgs
|
|
||||||
# TODO: Remove this patch when updating to next version
|
|
||||||
patches = [
|
|
||||||
(fetchpatch {
|
|
||||||
name = "blink-add-bypass-for-nix.patch";
|
|
||||||
url = "https://github.com/Saghen/blink.cmp/commit/6c83ef1ae34abd7ef9a32bfcd9595ac77b61037c.diff?full_index=1";
|
|
||||||
hash = "sha256-304F1gDDKVI1nXRvvQ0T1xBN+kHr3jdmwMMp8CNl+GU=";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
# Module for reproducing issues
|
# Module for reproducing issues
|
||||||
nvimSkipModule = ["repro"];
|
nvimSkipModule = ["repro"];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,12 @@ in {
|
||||||
inherit (cfg) setupOpts;
|
inherit (cfg) setupOpts;
|
||||||
after = mkIf cfg.cmp.enable "require('copilot_cmp').setup()";
|
after = mkIf cfg.cmp.enable "require('copilot_cmp').setup()";
|
||||||
|
|
||||||
|
event = [
|
||||||
|
{
|
||||||
|
event = "User";
|
||||||
|
pattern = "LazyFile";
|
||||||
|
}
|
||||||
|
];
|
||||||
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
|
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
|
||||||
keys = [
|
keys = [
|
||||||
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})
|
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ in {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["nvim-lint"];
|
startPlugins = ["nvim-lint"];
|
||||||
pluginRC.nvim-lint = entryAnywhere ''
|
pluginRC.nvim-lint = entryAnywhere ''
|
||||||
require("lint").linters_by_ft(${toLuaObject cfg.linters_by_ft})
|
require("lint").linters_by_ft = ${toLuaObject cfg.linters_by_ft}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,16 @@
|
||||||
ls_sources,
|
ls_sources,
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
null_ls.builtins.diagnostics.eslint_d.with({
|
||||||
command = "${getExe pkg}",
|
command = "${getExe pkg}",
|
||||||
|
condition = function(utils)
|
||||||
|
return utils.root_has_file({
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.mjs",
|
||||||
|
".eslintrc",
|
||||||
|
".eslintrc.json",
|
||||||
|
".eslintrc.js",
|
||||||
|
".eslintrc.yml",
|
||||||
|
})
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ in {
|
||||||
./clang.nix
|
./clang.nix
|
||||||
./css.nix
|
./css.nix
|
||||||
./elixir.nix
|
./elixir.nix
|
||||||
|
./fsharp.nix
|
||||||
./gleam.nix
|
./gleam.nix
|
||||||
./go.nix
|
./go.nix
|
||||||
./hcl.nix
|
./hcl.nix
|
||||||
|
|
|
||||||
109
modules/plugins/languages/fsharp.nix
Normal file
109
modules/plugins/languages/fsharp.nix
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) either listOf package str enum;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.lists) isList;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
|
defaultServer = "fsautocomplete";
|
||||||
|
servers = {
|
||||||
|
fsautocomplete = {
|
||||||
|
package = pkgs.fsautocomplete;
|
||||||
|
internalFormatter = false;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.fsautocomplete.setup {
|
||||||
|
capabilities = capabilities;
|
||||||
|
on_attach = default_on_attach;
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else "{'${cfg.lsp.package}/bin/fsautocomplete'}"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultFormat = "fantomas";
|
||||||
|
formats = {
|
||||||
|
fantomas = {
|
||||||
|
package = pkgs.fantomas;
|
||||||
|
nullConfig = ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.fantomas.with({
|
||||||
|
command = "${cfg.format.package}/bin/fantomas",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
cfg = config.vim.languages.fsharp;
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
vim.languages.fsharp = {
|
||||||
|
enable = mkEnableOption "F# language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "F# treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "fsharp";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "F# LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
server = mkOption {
|
||||||
|
type = enum (attrNames servers);
|
||||||
|
default = defaultServer;
|
||||||
|
description = "F# LSP server to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = either package (listOf str);
|
||||||
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
example = ''[lib.getExe pkgs.fsautocomplete "--state-directory" "~/.cache/fsautocomplete"]'';
|
||||||
|
description = "F# LSP server package, or the command to run as a list of strings";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
format = {
|
||||||
|
enable = mkEnableOption "F# formatting" // {default = config.vim.languages.enableFormat;};
|
||||||
|
|
||||||
|
type = mkOption {
|
||||||
|
type = enum (attrNames formats);
|
||||||
|
default = defaultFormat;
|
||||||
|
description = "F# formatter to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = formats.${cfg.format.type}.package;
|
||||||
|
description = "F# formatter package";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.fsharp-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.format.enable {
|
||||||
|
vim.lsp.null-ls.enable = true;
|
||||||
|
vim.lsp.null-ls.sources.fsharp-format = formats.${cfg.format.type}.nullConfig;
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
@ -72,6 +72,16 @@
|
||||||
ls_sources,
|
ls_sources,
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
null_ls.builtins.diagnostics.eslint_d.with({
|
||||||
command = "${getExe pkg}",
|
command = "${getExe pkg}",
|
||||||
|
condition = function(utils)
|
||||||
|
return utils.root_has_file({
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.mjs",
|
||||||
|
".eslintrc",
|
||||||
|
".eslintrc.json",
|
||||||
|
".eslintrc.js",
|
||||||
|
".eslintrc.yml",
|
||||||
|
})
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,16 @@
|
||||||
ls_sources,
|
ls_sources,
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
null_ls.builtins.diagnostics.eslint_d.with({
|
||||||
command = "${getExe pkg}",
|
command = "${getExe pkg}",
|
||||||
|
condition = function(utils)
|
||||||
|
return utils.root_has_file({
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.mjs",
|
||||||
|
".eslintrc",
|
||||||
|
".eslintrc.json",
|
||||||
|
".eslintrc.js",
|
||||||
|
".eslintrc.yml",
|
||||||
|
})
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
|
|
@ -124,8 +124,6 @@ in {
|
||||||
mkOption {
|
mkOption {
|
||||||
type = enum themesConcatted;
|
type = enum themesConcatted;
|
||||||
default = "auto";
|
default = "auto";
|
||||||
# TODO: xml generation error if the closing '' is on a new line.
|
|
||||||
# issue: https://gitlab.com/rycee/nmd/-/issues/10
|
|
||||||
defaultText = ''`config.vim.theme.name` if theme supports lualine else "auto"'';
|
defaultText = ''`config.vim.theme.name` if theme supports lualine else "auto"'';
|
||||||
description = "Theme for lualine";
|
description = "Theme for lualine";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,15 @@ in {
|
||||||
startPlugins = ["lz-n" "lzn-auto-require"];
|
startPlugins = ["lz-n" "lzn-auto-require"];
|
||||||
|
|
||||||
optPlugins = pluginPackages;
|
optPlugins = pluginPackages;
|
||||||
|
augroups = [{name = "nvf_lazy_file_hooks";}];
|
||||||
|
autocmds = [
|
||||||
|
{
|
||||||
|
event = ["BufReadPost" "BufNewFile" "BufWritePre"];
|
||||||
|
group = "nvf_lazy_file_hooks";
|
||||||
|
command = "doautocmd User LazyFile";
|
||||||
|
once = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
lazy.builtLazyConfig = ''
|
lazy.builtLazyConfig = ''
|
||||||
require('lz.n').load(${toLuaObject lznSpecs})
|
require('lz.n').load(${toLuaObject lznSpecs})
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
event = mkOption {
|
event = mkOption {
|
||||||
type = nullOr (oneOf [str (listOf str) lznEvent]);
|
type = nullOr (oneOf [str lznEvent (listOf (either str lznEvent))]);
|
||||||
default = null;
|
default = null;
|
||||||
description = "Lazy-load on event";
|
description = "Lazy-load on event";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,3 @@
|
||||||
# Based off of:
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/776c3bee4769c616479393aeefceefeda16b6fcb/pkgs/tools/nix/npins/source.nix
|
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
fetchurl,
|
fetchurl,
|
||||||
|
|
@ -8,7 +6,16 @@
|
||||||
}:
|
}:
|
||||||
builtins.mapAttrs
|
builtins.mapAttrs
|
||||||
(
|
(
|
||||||
_: let
|
name: let
|
||||||
|
getUrl = {
|
||||||
|
url,
|
||||||
|
hash,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
fetchurl {
|
||||||
|
inherit url;
|
||||||
|
sha256 = hash;
|
||||||
|
};
|
||||||
getZip = {
|
getZip = {
|
||||||
url,
|
url,
|
||||||
hash,
|
hash,
|
||||||
|
|
@ -23,19 +30,29 @@ builtins.mapAttrs
|
||||||
repository,
|
repository,
|
||||||
revision,
|
revision,
|
||||||
url ? null,
|
url ? null,
|
||||||
|
submodules,
|
||||||
hash,
|
hash,
|
||||||
...
|
...
|
||||||
} @ attrs:
|
} @ attrs:
|
||||||
assert repository ? type;
|
assert repository ? type;
|
||||||
if url != null
|
if url != null && !submodules
|
||||||
then getZip attrs
|
then getZip attrs
|
||||||
else
|
else
|
||||||
assert repository.type == "Git"; let
|
assert repository.type == "Git"; let
|
||||||
urlToName = url: rev: let
|
url' =
|
||||||
matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url;
|
if repository.type == "Git"
|
||||||
short = builtins.substring 0 7 rev;
|
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;
|
||||||
appendShort =
|
appendShort =
|
||||||
if (builtins.match "[a-f0-9]*" rev) != null
|
if (builtins.match "[a-f0-9]*" revision) != null
|
||||||
then "-${short}"
|
then "-${short}"
|
||||||
else "";
|
else "";
|
||||||
in "${
|
in "${
|
||||||
|
|
@ -43,43 +60,53 @@ builtins.mapAttrs
|
||||||
then "source"
|
then "source"
|
||||||
else builtins.head matched
|
else builtins.head matched
|
||||||
}${appendShort}";
|
}${appendShort}";
|
||||||
name = urlToName repository.url revision;
|
|
||||||
in
|
in
|
||||||
fetchgit {
|
fetchgit {
|
||||||
inherit name;
|
inherit name;
|
||||||
inherit (repository) url;
|
url = url';
|
||||||
rev = revision;
|
rev = revision;
|
||||||
sha256 = hash;
|
sha256 = hash;
|
||||||
};
|
fetchSubmodules = submodules;
|
||||||
|
|
||||||
mkPyPiSource = {
|
|
||||||
url,
|
|
||||||
hash,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
fetchurl {
|
|
||||||
inherit url;
|
|
||||||
sha256 = hash;
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
spec:
|
spec:
|
||||||
assert spec ? type; let
|
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 =
|
func =
|
||||||
{
|
{
|
||||||
Git = mkGitSource;
|
Git = mkGitSource;
|
||||||
GitRelease = mkGitSource;
|
GitRelease = mkGitSource;
|
||||||
PyPi = mkPyPiSource;
|
PyPi = getUrl;
|
||||||
Channel = getZip;
|
Channel = getZip;
|
||||||
|
Tarball = getUrl;
|
||||||
}
|
}
|
||||||
.${spec.type}
|
.${spec.type}
|
||||||
or (builtins.throw "Unknown source type ${spec.type}");
|
or (builtins.throw "Unknown source type ${spec.type}");
|
||||||
in
|
in
|
||||||
spec // {outPath = func spec;}
|
spec // {outPath = mayOverride (func spec);}
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
let
|
let
|
||||||
json = lib.importJSON ./sources.json;
|
json = lib.importJSON ./sources.json;
|
||||||
in
|
in
|
||||||
assert lib.assertMsg (json.version == 3) "Npins version mismatch!";
|
assert lib.assertMsg (json.version == 5) "Npins version mismatch!";
|
||||||
json.pins
|
json.pins
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue