Skip to content

Commit

Permalink
Merge branch 'main' of github.com:NotAShelf/neovim-flake into nim-lang
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAShelf committed Feb 7, 2024
2 parents e9ad2f8 + 232c812 commit 38bf156
Show file tree
Hide file tree
Showing 74 changed files with 2,026 additions and 1,508 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cachix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- uses: cachix/cachix-action@v13
- uses: cachix/cachix-action@v14
with:
authToken: ${{ secrets.CACHIX_TOKEN }}
extraPullNames: nix-community
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ jobs:
- 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@v3
uses: actions/upload-artifact@v4
with:
name: doc
name: "${{ matrix.package }}"
path: result/share/doc/neovim-flake/
33 changes: 13 additions & 20 deletions configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,29 @@ inputs: let

nix.enable = true;
html.enable = isMaximal;
clang = {
enable = isMaximal;
lsp.server = "clangd";
};
css.enable = isMaximal;
sql.enable = isMaximal;
rust = {
enable = isMaximal;
crates.enable = true;
};
java.enable = isMaximal;
ts.enable = isMaximal;
svelte.enable = isMaximal;
go.enable = isMaximal;
zig.enable = isMaximal;
python.enable = isMaximal;
dart.enable = isMaximal;
elixir.enable = false;
elixir.enable = isMaximal;
bash.enable = isMaximal;
terraform.enable = isMaximal;
nim.enable = isMaximal;
tailwind.enable = isMaximal;
clang = {
enable = isMaximal;
lsp.server = "clangd";
};

rust = {
enable = isMaximal;
crates.enable = true;
};
};

vim.visuals = {
Expand Down Expand Up @@ -233,17 +236,7 @@ inputs: let
};

vim.presence = {
presence-nvim = {
enable = true;
auto_update = true;
image_text = "The Superior Text Editor";
client_id = "793271441293967371";
main_image = "neovim";
show_time = true;
rich_presence = {
editing_text = "Editing %s";
};
};
neocord.enable = true;
};
};
};
Expand Down
135 changes: 71 additions & 64 deletions docs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pkgs,
lib ? import ../lib/stdlib-extended.nix pkgs.lib,
nmdSrc,
...
}: let
nmd = import nmdSrc {
inherit lib;
Expand Down Expand Up @@ -29,103 +30,109 @@
];
};

dontCheckDefinitions = {_module.check = false;};

githubDeclaration = user: repo: subpath: let
urlRef = "main";
in {
url = "https://github.com/${user}/${repo}/blob/${urlRef}/${subpath}";
name = "<${repo}/${subpath}>";
};

dontCheckDefinitions = {_module.check = false;};

nvimPath = toString ./..;

buildOptionsDocs = args @ {
modules,
includeModuleSystemsOptions ? true,
includeModuleSystemOptions ? true,
...
}: let
options = (lib.evalModules {inherit modules;}).options;
inherit ((lib.evalModules {inherit modules;})) options;
in
pkgs.buildPackages.nixosOptionsDoc
({
pkgs.buildPackages.nixosOptionsDoc ({
options =
if includeModuleSystemsOptions
if includeModuleSystemOptions
then options
else builtins.removeAttrs (options ["_module"]);
else builtins.removeAttrs options ["_module"];
transformOptions = opt:
opt
// {
# Clean up declaration sites to not refer to local source tree
declarations =
map
(decl:
if lib.hasPrefix nvimPath (toString decl)
then
githubDeclaration "notashelf" "neovim-flake"
(lib.removePrefix "/" (lib.removePrefix nvimPath (toString decl)))
else decl)
opt.declarations;
# Clean up declaration sites to not refer to the Home Manager
# source tree.
declarations = map (decl:
if lib.hasPrefix nvimPath (toString decl)
then
githubDeclaration "notashelf" "neovim-flake"
(lib.removePrefix "/" (lib.removePrefix nvimPath (toString decl)))
else if decl == "lib/modules.nix"
then
# TODO: handle this in a better way (may require upstream
# changes to nixpkgs)
githubDeclaration "NixOS" "nixpkgs" decl
else decl)
opt.declarations;
};
}
// builtins.removeAttrs args ["modules" "includeModuleSystemsOptions"]);
// builtins.removeAttrs args ["modules" "includeModuleSystemOptions"]);

nvimModuleDocs = buildOptionsDocs {
modules =
import ../modules/modules.nix
{
inherit pkgs lib;
import ../modules/modules.nix {
inherit lib pkgs;
check = false;
}
++ [scrubbedPkgsModule];
variablelistId = "neovim-flake-options";
};

docs = nmd.buildDocBookDocs {
pathName = "neovim-flake";
projectName = "neovim-flake";
modulesDocs = [
{
docBook = pkgs.linkFarm "nvim-module-docs-for-nmd" {
"nmd-result/neovim-flake-options.xml" = nvimModuleDocs.optionsDocBook;
};
}
];
documentsDirectory = ./.;
documentType = "book";
chunkToc = ''
<toc>
<d:tocentry xmlns:d="http://docbook.org/ns/docbook" linkend="book-neovim-flake-manual">
<?dbhtml filename="index.html"?>
<d:tocentry linkend="ch-options">
<?dbhtml filename="options.html"?>
</d:tocentry>
<d:tocentry linkend="ch-release-notes">
<?dbhtml filename="release-notes.html"?>
</d:tocentry>
</d:tocentry>
</toc>
release-config = builtins.fromJSON (builtins.readFile ../release.json);
revision = "release-${release-config.release}";
# Generate the `man home-configuration.nix` package
nvf-configuration-manual =
pkgs.runCommand "neovim-flake-reference-manpage" {
nativeBuildInputs = [pkgs.buildPackages.installShellFiles pkgs.nixos-render-docs];
allowedReferences = ["out"];
} ''
# Generate manpages.
mkdir -p $out/share/man/man5
mkdir -p $out/share/man/man1
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
--revision ${revision} \
${nvimModuleDocs.optionsJSON}/share/doc/nixos/options.json \
$out/share/man/man5/neovim-flake.5
cp ${./neovim-flake.1} $out/share/man/man1/neovim-flake.1
'';
# Generate the HTML manual pages
neovim-flake-manual = pkgs.callPackage ./manual.nix {
inherit revision;
outputPath = "share/doc/neovim-flake";
nmd = nmdSrc;
options = {
neovim-flake = nvimModuleDocs.optionsJSON;
};
};
html = neovim-flake-manual;
htmlOpenTool = pkgs.callPackage ./html-open-tool.nix {} {inherit html;};
in {
options.json =
pkgs.runCommand "options.json"
# TODO: Use `nvimOptionsDoc.optionsJSON` directly once upstream
# `nixosOptionsDoc` is more customizable
{
meta.description = "List of neovim-flake options in JSON format";
} ''
mkdir -p $out/{share/doc,nix-support}
cp -a ${nvimModuleDocs.optionsJSON}/share/doc/nixos $out/share/doc/neovim-flake
substitute \
${nvimModuleDocs.optionsJSON}/nix-support/hydra-build-products \
$out/nix-support/hydra-build-products \
--replace \
'${nvimModuleDocs.optionsJSON}/share/doc/nixos' \
"$out/share/doc/neovim-flake"
'';
inherit nmdSrc;

inherit (docs) manPages;
options = {
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
# `nixosOptionsDoc` is more customizable.
json =
pkgs.runCommand "options.json" {
meta.description = "List of Home Manager options in JSON format";
} ''
mkdir -p $out/{share/doc,nix-support}
cp -a ${nvimModuleDocs.optionsJSON}/share/doc/nixos $out/share/doc/neovim-flake
substitute \
${nvimModuleDocs.optionsJSON}/nix-support/hydra-build-products \
$out/nix-support/hydra-build-products \
--replace \
'${nvimModuleDocs.optionsJSON}/share/doc/nixos' \
"$out/share/doc/neovim-flake"
'';
};

manual = {inherit (docs) html htmlOpenTool;};
manPages = nvf-configuration-manual;
manual = {inherit html htmlOpenTool;};
}
3 changes: 3 additions & 0 deletions docs/footer.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.SH "AUTHORS"
.PP
neovim-flake contributors
14 changes: 14 additions & 0 deletions docs/header.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.TH "neovim-flake" "5" "01/01/1980" "neovim-flake"
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" enable line breaks after slashes
.cflags 4 /
.SH "NAME"
neovim-flake configuration specification
.SH "OPTIONS"
.PP
You can use the following options in
home\-configuration\&.nix:
.PP
8 changes: 8 additions & 0 deletions docs/highlight-style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pre {
padding: 0;
}

pre code.hljs {
border: none;
margin: 0;
}
43 changes: 43 additions & 0 deletions docs/html-open-tool.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
writeShellScriptBin,
makeDesktopItem,
symlinkJoin,
}: {
html,
pathName ? "neovim-flake",
projectName ? pathName,
name ? "${pathName}-help",
}: let
helpScript = writeShellScriptBin name ''
set -euo pipefail
if [[ ! -v BROWSER || -z $BROWSER ]]; then
for candidate in xdg-open open w3m; do
BROWSER="$(type -P $candidate || true)"
if [[ -x $BROWSER ]]; then
break;
fi
done
fi
if [[ ! -v BROWSER || -z $BROWSER ]]; then
echo "$0: unable to start a web browser; please set \$BROWSER"
exit 1
else
exec "$BROWSER" "${html}/share/doc/${pathName}/index.xhtml"
fi
'';

desktopItem = makeDesktopItem {
name = "${pathName}-manual";
desktopName = "${projectName} Manual";
genericName = "View ${projectName} documentation in a web browser";
icon = "nix-snowflake";
exec = "${helpScript}/bin/${name}";
categories = ["System"];
};
in
symlinkJoin {
inherit name;
paths = [helpScript desktopItem];
}
50 changes: 0 additions & 50 deletions docs/man-configuration.xml

This file was deleted.

Loading

0 comments on commit 38bf156

Please sign in to comment.