mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
docs: Add an option search to our documentation
This commit is contained in:
parent
30ab203d56
commit
42a7676d5a
6 changed files with 81 additions and 19 deletions
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
pkgs ? import <nixpkgs> { config.enableUnfree = true; },
|
pkgs ? import <nixpkgs> { config.enableUnfree = true; },
|
||||||
|
nuschtosSearch,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
# Extend nixpkg's lib, so that we can handle recursive leaf types such as `either`
|
# Extend nixpkg's lib, so that we can handle recursive leaf types such as `either`
|
||||||
|
@ -71,8 +72,7 @@ let
|
||||||
hmOptions = builtins.removeAttrs (lib.evalModules {
|
hmOptions = builtins.removeAttrs (lib.evalModules {
|
||||||
modules = [ (import ../wrappers/modules/hm.nix { inherit lib; }) ];
|
modules = [ (import ../wrappers/modules/hm.nix { inherit lib; }) ];
|
||||||
}).options [ "_module" ];
|
}).options [ "_module" ];
|
||||||
in
|
|
||||||
rec {
|
|
||||||
options-json =
|
options-json =
|
||||||
(pkgsDoc.nixosOptionsDoc {
|
(pkgsDoc.nixosOptionsDoc {
|
||||||
inherit
|
inherit
|
||||||
|
@ -88,17 +88,38 @@ rec {
|
||||||
inherit transformOptions;
|
inherit transformOptions;
|
||||||
warningsAreErrors = false;
|
warningsAreErrors = false;
|
||||||
}).optionsJSON;
|
}).optionsJSON;
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
inherit options-json;
|
||||||
|
|
||||||
man-docs = pkgsDoc.callPackage ./man { inherit options-json; };
|
man-docs = pkgsDoc.callPackage ./man { inherit options-json; };
|
||||||
}
|
}
|
||||||
# Do not check if documentation builds fine on darwin as it fails:
|
// lib.optionalAttrs (!pkgsDoc.stdenv.isDarwin) (
|
||||||
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
|
let
|
||||||
// lib.optionalAttrs (!pkgsDoc.stdenv.isDarwin) {
|
mkSearch =
|
||||||
docs = pkgsDoc.callPackage ./mdbook {
|
baseHref:
|
||||||
inherit
|
nuschtosSearch.packages.mkSearch {
|
||||||
helpers
|
optionsJSON = options-json + "/share/doc/nixos/options.json";
|
||||||
modules
|
urlPrefix = "https://github.com/nix-community/nixvim/tree/main";
|
||||||
hmOptions
|
inherit baseHref;
|
||||||
transformOptions
|
};
|
||||||
;
|
in
|
||||||
};
|
{
|
||||||
}
|
# NuschtOS/search does not seem to work on darwin
|
||||||
|
search = mkSearch "/";
|
||||||
|
|
||||||
|
# Do not check if documentation builds fine on darwin as it fails:
|
||||||
|
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
|
||||||
|
docs = pkgsDoc.callPackage ./mdbook {
|
||||||
|
inherit
|
||||||
|
helpers
|
||||||
|
modules
|
||||||
|
hmOptions
|
||||||
|
transformOptions
|
||||||
|
;
|
||||||
|
# TODO: Find how to handle stable when 24.11 lands
|
||||||
|
search = mkSearch "/search/";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
|
@ -21,3 +21,4 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
[Contributing](./CONTRIBUTING.md)
|
[Contributing](./CONTRIBUTING.md)
|
||||||
|
[NixVim Options Search](./search/index.html)
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
nixosOptionsDoc,
|
nixosOptionsDoc,
|
||||||
transformOptions,
|
transformOptions,
|
||||||
hmOptions,
|
hmOptions,
|
||||||
|
search,
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
|
@ -268,5 +269,7 @@ pkgs.stdenv.mkDerivation {
|
||||||
${prepareMD}
|
${prepareMD}
|
||||||
mdbook build
|
mdbook build
|
||||||
cp -r ./book/* $dest
|
cp -r ./book/* $dest
|
||||||
|
mkdir -p $dest/search
|
||||||
|
cp -r ${search}/* $dest/search
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
{
|
{
|
||||||
perSystem =
|
perSystem =
|
||||||
{ pkgsUnfree, config, ... }:
|
{
|
||||||
|
pkgsUnfree,
|
||||||
|
config,
|
||||||
|
inputs',
|
||||||
|
...
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
packages = import ../docs {
|
packages = import ../docs {
|
||||||
# Building the docs evaluates each plugin's default package, some of which are unfree
|
# Building the docs evaluates each plugin's default package, some of which are unfree
|
||||||
pkgs = pkgsUnfree;
|
pkgs = pkgsUnfree;
|
||||||
|
inherit (inputs') nuschtosSearch;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Test that all packages build fine when running `nix flake check`.
|
# Test that all packages build fine when running `nix flake check`.
|
||||||
|
|
33
flake.lock
generated
33
flake.lock
generated
|
@ -2,7 +2,10 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"devshell": {
|
"devshell": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": [
|
||||||
|
"nuschtosSearch",
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
|
@ -60,11 +63,11 @@
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1701680307,
|
"lastModified": 1710146030,
|
||||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -177,6 +180,27 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nuschtosSearch": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1721332622,
|
||||||
|
"narHash": "sha256-04AOrnpZIz15AXXlVWKRmZwbFgI/pjC8AaQ+T6VlFMc=",
|
||||||
|
"owner": "NuschtOS",
|
||||||
|
"repo": "search",
|
||||||
|
"rev": "b5990bce952c39824169dad255ff39c8abe4ca21",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NuschtOS",
|
||||||
|
"repo": "search",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"devshell": "devshell",
|
"devshell": "devshell",
|
||||||
|
@ -186,6 +210,7 @@
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"nix-darwin": "nix-darwin",
|
"nix-darwin": "nix-darwin",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nuschtosSearch": "nuschtosSearch",
|
||||||
"treefmt-nix": "treefmt-nix"
|
"treefmt-nix": "treefmt-nix"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -33,6 +33,11 @@
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
nuschtosSearch = {
|
||||||
|
url = "github:NuschtOS/search";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
@ -45,6 +50,7 @@
|
||||||
devshell = {
|
devshell = {
|
||||||
url = "github:numtide/devshell";
|
url = "github:numtide/devshell";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.flake-utils.follows = "nuschtosSearch/flake-utils";
|
||||||
};
|
};
|
||||||
treefmt-nix = {
|
treefmt-nix = {
|
||||||
url = "github:numtide/treefmt-nix";
|
url = "github:numtide/treefmt-nix";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue