Skip to content

Commit 4aa183d

Browse files
authored
Merge branch 'main' into diniamo-moment
2 parents ab3a68f + 9c8fbc7 commit 4aa183d

File tree

8 files changed

+215
-99
lines changed

8 files changed

+215
-99
lines changed

.github/workflows/docs-preview.yml

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
name: Build and Preview Manual
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types: [opened, synchronize, reopened, closed]
7+
paths:
8+
- ".github/workflows/docs-preview.yml"
9+
- "modules/**"
10+
- "docs/**"
11+
12+
# Defining permissions here passes it to all workflows.
13+
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
issues: write
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
build-preview:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Install Nix
28+
uses: DeterminateSystems/nix-installer-action@main
29+
- uses: DeterminateSystems/magic-nix-cache-action@main
30+
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
- name: Set default git branch (to reduce log spam)
35+
run: git config --global init.defaultBranch main
36+
37+
- name: Build documentation packages
38+
run: nix build .#docs-html --print-build-logs
39+
40+
- name: Deploy to GitHub Pages preview
41+
run: |
42+
PR_NUMBER=${{ github.event.pull_request.number }}
43+
BRANCH_NAME="gh-pages"
44+
PREVIEW_DIR="docs-preview-${PR_NUMBER}"
45+
46+
# Clone the gh-pages branch and move to the preview subdirectory
47+
git clone --single-branch --branch $BRANCH_NAME https://github.com/${{ github.repository }} gh-pages
48+
cd gh-pages
49+
50+
mkdir -p $PREVIEW_DIR
51+
52+
# Copy the build files to the preview subdirectory
53+
cp -rvf ../result/share/doc/nvf/* ./$PREVIEW_DIR
54+
55+
# Configure git to use the GitHub Actions token for authentication
56+
git config --global user.name "GitHub Actions"
57+
git config --global user.email "actions@github.com"
58+
59+
# Set the GitHub token for authentication
60+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
61+
62+
# Add and commit the changes
63+
git add --all
64+
git commit -m "Deploy PR #${PR_NUMBER} preview" || echo "No changes to commit"
65+
git push --force origin $BRANCH_NAME
66+
67+
comment-url:
68+
needs: build-preview
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Prepare Environment
72+
id: prelude
73+
run: |
74+
PR_NUMBER=${{ github.event.pull_request.number }}
75+
URL="https://${{ github.repository_owner }}.github.io/nvf/docs-preview-${PR_NUMBER}/"
76+
77+
# Propagate non-interpolatable environment vars
78+
echo "URL=$URL" >> "$GITHUB_OUTPUT"
79+
echo "REV=$GITHUB_SHA" >> "$GITHUB_OUTPUT"
80+
echo "ACTOR=$GITHUB_ACTOR" >> "$GITHUB_OUTPUT"
81+
echo "REF=$GITHUB_HEAD_REF" >> "$GITHUB_OUTPUT"
82+
echo "RUNS=$GITHUB_RUN_NUMBER" >> "$GITHUB_OUTPUT"
83+
84+
echo "Live Preview URL: $URL"
85+
echo "Rev: $GITHUB_SHA"
86+
echo "Actor: $GITHUB_ACTOR"
87+
echo "Ref: "$GITHUB_HEAD_REF"
88+
echo "Reruns: "$GITHUB_RUN_NUMBER"
89+
90+
echo "### :rocket: Live Preview Deployed " >> "$GITHUB_STEP_SUMMARY"
91+
echo "Preview can be found at ${URL}" >> "$GITHUB_STEP_SUMMARY"
92+
93+
- name: Find Comment
94+
uses: peter-evans/find-comment@v3
95+
id: fc
96+
with:
97+
comment-author: "github-actions[bot]"
98+
issue-number: ${{ github.event.pull_request.number }}
99+
body-includes: "Live preview deployed"
100+
101+
- name: Post live preview comment
102+
uses: peter-evans/create-or-update-comment@v4
103+
env:
104+
COMMENT_ID: ${{ steps.fc.outputs.comment-id }}
105+
URL: ${{ steps.prelude.outputs.URL }}
106+
GITHUB_SHA: ${{ steps.prelude.outputs.REV }}
107+
ACTOR: ${{ steps.prelude.outputs.ACTOR }}
108+
REF: ${{ steps.prelude.outputs.REF }}
109+
RUNS: ${{ steps.prelude.outputs.RUNS }}
110+
with:
111+
comment-id: ${{ env.COMMENT_ID }}
112+
issue-number: ${{ github.event.pull_request.number }} # issue number also applies to pull requests
113+
edit-mode: replace # replace previous body
114+
body: |
115+
### :rocket: Live preview deployed from ${{ env.GITHUB_SHA }}
116+
117+
View it [here](${{ env.URL }}):
118+
119+
<details>
120+
<summary><strong>Debug Information</strong></summary>
121+
<p>Triggered by: ${{ env.ACTOR }}</p>
122+
<p><code>HEAD</code> at: ${{ env.REF }}</p>
123+
<p>Reruns: ${{ env.RUNS }}</p>
124+
</details>
125+
126+
cleanup:
127+
if: ${{ github.event.pull_request.merged == true || github.event.pull_request.state == 'closed' }}
128+
runs-on: ubuntu-latest
129+
steps:
130+
- name: Checkout repository
131+
uses: actions/checkout@v4
132+
133+
- name: Delete preview for closed/merged PR
134+
run: |
135+
PR_NUMBER=${{ github.event.pull_request.number }}
136+
BRANCH_NAME="gh-pages"
137+
PREVIEW_DIR="docs-preview-${PR_NUMBER}"
138+
139+
# Clone the gh-pages branch
140+
git clone --single-branch --branch $BRANCH_NAME https://github.com/${{ github.repository }} gh-pages
141+
cd gh-pages
142+
143+
# Check if the preview directory exists, and delete it if it does
144+
if [ -d "$PREVIEW_DIR" ]; then
145+
echo "Deleting preview directory $PREVIEW_DIR"
146+
rm -rf $PREVIEW_DIR
147+
else
148+
echo "Preview directory $PREVIEW_DIR does not exist. Skipping deletion."
149+
fi
150+
151+
# Configure git to use the GitHub Actions token for authentication
152+
git config --global user.name "GitHub Actions"
153+
git config --global user.email "actions@github.com"
154+
155+
# Set the GitHub token for authentication
156+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
157+
158+
# Add and commit the changes (only if there's something to delete)
159+
git add .
160+
git diff --quiet || git commit -m "Remove preview for PR #${PR_NUMBER}"
161+
git push origin $BRANCH_NAME
162+
163+
cleanup-comment:
164+
needs: cleanup
165+
runs-on: ubuntu-latest
166+
steps:
167+
- name: Checkout repository
168+
uses: actions/checkout@v4
169+
170+
- name: Double check preview directory deletion
171+
run: |
172+
# Check if the preview directory exists, and delete it if it does
173+
if [ -d "docs-preview-${{ github.event.pull_request.number }}" ]; then
174+
echo "Something went wrong, preview directory is not deleted."
175+
exit 1
176+
else
177+
echo "Preview directory has been deleted successfully, proceeding."
178+
fi
179+
180+
- name: Post cleanup verification
181+
uses: peter-evans/create-or-update-comment@v4
182+
with:
183+
issue-number: ${{ github.event.pull_request.number }}
184+
body: |
185+
✅ Preview has been deleted successfully!

docs/release-notes/rl-0.8.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
warning you that it is invalid. Do keep in mind that this value is no longer
2222
checked, so you will be responsible for ensuring its validity.
2323

24-
- Deprecated `vim.enableEditorconfig` in favor of
24+
- Deprecate `vim.enableEditorconfig` in favor of
2525
[](#opt-vim.globals.editorconfig).
2626

27+
- Deprecate rnix-lsp as it has been abandoned and archived upstream.
28+
2729
[amadaluzia](https://github.com/amadaluzia):
2830

2931
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
@@ -44,3 +46,8 @@
4446

4547
- Add [aerial.nvim]
4648
- Add [nvim-ufo]
49+
50+
[LilleAila](https://github.com/LilleAila):
51+
52+
- Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes
53+
issue with setting the workspace directory.

flake.lock

Lines changed: 0 additions & 73 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
};
9090

9191
# Language servers (use master instead of nixpkgs)
92-
rnix-lsp.url = "github:nix-community/rnix-lsp";
9392
nil = {
9493
url = "github:oxalica/nil";
9594
inputs.nixpkgs.follows = "nixpkgs";

flake/legacyPackages.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
inherit system;
99
overlays = [
1010
inputs.self.overlays.default
11+
1112
(_: _: {
12-
rnix-lsp = inputs'.rnix-lsp.defaultPackage;
13+
# Build nil from source to get most recent
14+
# features as they are added.
1315
nil = inputs'.nil.packages.default;
1416
})
1517
];

modules/plugins/languages/nix.nix

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,6 @@
2626
then expToLua package
2727
else ''{"${package}/bin/${defaultCmd}"}'';
2828
servers = {
29-
rnix = {
30-
package = pkgs.rnix-lsp;
31-
internalFormatter = cfg.format.type == "nixpkgs-fmt";
32-
lspConfig = ''
33-
lspconfig.rnix.setup{
34-
capabilities = capabilities,
35-
${
36-
if (cfg.format.enable && cfg.format.type == "nixpkgs-fmt")
37-
then useFormat
38-
else noFormat
39-
},
40-
cmd = ${packageToCmd cfg.lsp.package "rnix-lsp"},
41-
}
42-
'';
43-
};
44-
4529
nil = {
4630
package = pkgs.nil;
4731
internalFormatter = true;
@@ -165,6 +149,7 @@ in {
165149
type = enum (attrNames formats);
166150
default = defaultFormat;
167151
};
152+
168153
package = mkOption {
169154
description = "Nix formatter package";
170155
type = package;
@@ -188,7 +173,18 @@ in {
188173
assertions = [
189174
{
190175
assertion = cfg.format.type != "nixpkgs-fmt";
191-
message = "nixpkgs-fmt has been archived upstream. Please use one of the following instead: ${concatStringsSep ", " (attrNames formats)}";
176+
message = ''
177+
nixpkgs-fmt has been archived upstream. Please use one of the following available formatters:
178+
${concatStringsSep ", " (attrNames formats)}
179+
'';
180+
}
181+
182+
{
183+
assertion = cfg.lsp.server != "rnix";
184+
message = ''
185+
rnix-lsp has been archived upstream. Please use one of the following available language servers:
186+
${concatStringsSep ", " (attrNames servers)}
187+
'';
192188
}
193189
];
194190
vim.pluginRC.nix = ''

modules/plugins/notes/obsidian/obsidian.nix

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ in {
2424
enable = mkEnableOption "complementary neovim plugins for Obsidian editor";
2525

2626
setupOpts = mkPluginSetupOption "Obsidian.nvim" {
27-
dir = mkOption {
28-
type = str;
29-
default = "~/my-vault";
30-
description = "Obsidian vault directory";
31-
};
32-
3327
daily_notes = {
3428
folder = mkOption {
3529
type = nullOr str;

0 commit comments

Comments
 (0)