mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
Merge branch 'main' into machine-tests
This commit is contained in:
commit
09b2c4ec39
48 changed files with 1410 additions and 716 deletions
|
@ -9,84 +9,114 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.customisation) makeScope;
|
||||
inherit (lib.attrsets) isDerivation isAttrs concatMapAttrs;
|
||||
inherit (lib.strings) concatStringsSep;
|
||||
inherit (lib.filesystem) packagesFromDirectoryRecursive;
|
||||
|
||||
# Entrypoint for nvf documentation and relevant packages.
|
||||
docs = import ../docs {inherit pkgs inputs lib;};
|
||||
|
||||
# Helper function for creating demo configurations for nvf
|
||||
# TODO: make this more generic.
|
||||
buildPkg = maximal:
|
||||
(args.config.flake.lib.nvim.neovimConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [(import ../configuration.nix maximal)];
|
||||
}).neovim;
|
||||
|
||||
# This constructs a by-name overlay similar to the one found in Nixpkgs.
|
||||
# The goal is to automatically discover and packages found in pkgs/by-name
|
||||
# as long as they have a 'package.nix' in the package directory. We also
|
||||
# pass 'inputs' and 'pins' to all packages in the 'callPackage' scope, therefore
|
||||
# they are always available in the relevant 'package.nix' files.
|
||||
# ---
|
||||
# The logic is borrowed from drupol/pkgs-by-name-for-flake-parts, available
|
||||
# under the MIT license.
|
||||
flattenPkgs = separator: path: value:
|
||||
if isDerivation value
|
||||
then {
|
||||
${concatStringsSep separator path} = value;
|
||||
}
|
||||
else if isAttrs value
|
||||
then concatMapAttrs (name: flattenPkgs separator (path ++ [name])) value
|
||||
else
|
||||
# Ignore the functions which makeScope returns
|
||||
{};
|
||||
|
||||
inputsScope = makeScope pkgs.newScope (_: {
|
||||
inherit inputs;
|
||||
inherit (self) pins;
|
||||
});
|
||||
|
||||
scopeFromDirectory = directory:
|
||||
packagesFromDirectoryRecursive {
|
||||
inherit directory;
|
||||
inherit (inputsScope) newScope callPackage;
|
||||
};
|
||||
|
||||
legacyPackages = scopeFromDirectory ./pkgs/by-name;
|
||||
in {
|
||||
packages = {
|
||||
blink-cmp = pkgs.callPackage ./blink {};
|
||||
avante-nvim = let
|
||||
pin = self.pins.avante-nvim;
|
||||
in
|
||||
pkgs.callPackage ./avante-nvim {
|
||||
version = pin.branch;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
inherit (pin.repository) owner repo;
|
||||
rev = pin.revision;
|
||||
sha256 = pin.hash;
|
||||
};
|
||||
pins = self.pins;
|
||||
};
|
||||
packages =
|
||||
(flattenPkgs "/" [] legacyPackages)
|
||||
// {
|
||||
inherit (docs.manual) htmlOpenTool;
|
||||
|
||||
inherit (docs.manual) htmlOpenTool;
|
||||
# Documentation
|
||||
docs = docs.manual.html;
|
||||
docs-html = docs.manual.html;
|
||||
docs-manpages = docs.manPages;
|
||||
docs-json = docs.options.json;
|
||||
docs-linkcheck = let
|
||||
site = config.packages.docs;
|
||||
in
|
||||
pkgs.testers.lycheeLinkCheck {
|
||||
inherit site;
|
||||
# Documentation
|
||||
docs = docs.manual.html;
|
||||
docs-html = docs.manual.html;
|
||||
docs-manpages = docs.manPages;
|
||||
docs-json = docs.options.json;
|
||||
docs-linkcheck = let
|
||||
site = config.packages.docs;
|
||||
in
|
||||
pkgs.testers.lycheeLinkCheck {
|
||||
inherit site;
|
||||
|
||||
remap = {
|
||||
"https://notashelf.github.io/nvf/" = site;
|
||||
remap = {
|
||||
"https://notashelf.github.io/nvf/" = site;
|
||||
};
|
||||
|
||||
extraConfig = {
|
||||
exclude = [];
|
||||
include_mail = true;
|
||||
include_verbatim = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = {
|
||||
exclude = [];
|
||||
include_mail = true;
|
||||
include_verbatim = true;
|
||||
};
|
||||
};
|
||||
# Helper utility for building the HTML manual and opening it in the
|
||||
# browser with $BROWSER or using xdg-open as a fallback tool.
|
||||
# Adapted from Home-Manager, available under the MIT license.
|
||||
docs-html-wrapped = let
|
||||
xdg-open = lib.getExe' pkgs.xdg-utils "xdg-open";
|
||||
docs-html = docs.manual.html + /share/doc/nvf;
|
||||
in
|
||||
pkgs.writeShellScriptBin "docs-html-wrapped" ''
|
||||
set -euo pipefail
|
||||
|
||||
# Helper utility for building the HTML manual and opening it in the
|
||||
# browser with $BROWSER or using xdg-open as a fallback tool.
|
||||
# Adapted from Home-Manager, available under the MIT license.
|
||||
docs-html-wrapped = let
|
||||
xdg-open = lib.getExe' pkgs.xdg-utils "xdg-open";
|
||||
docs-html = docs.manual.html + /share/doc/nvf;
|
||||
in
|
||||
pkgs.writeShellScriptBin "docs-html-wrapped" ''
|
||||
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
|
||||
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"
|
||||
echo "$0: Trying xdg-open as a fallback"
|
||||
${xdg-open} ${docs-html}/index.xhtml
|
||||
else
|
||||
echo "\$BROWSER is set. Attempting to open manual"
|
||||
exec "$BROWSER" "${docs-html}/index.xhtml"
|
||||
fi
|
||||
'';
|
||||
|
||||
if [[ ! -v BROWSER || -z $BROWSER ]]; then
|
||||
echo "$0: unable to start a web browser; please set \$BROWSER"
|
||||
echo "$0: Trying xdg-open as a fallback"
|
||||
${xdg-open} ${docs-html}/index.xhtml
|
||||
else
|
||||
echo "\$BROWSER is set. Attempting to open manual"
|
||||
exec "$BROWSER" "${docs-html}/index.xhtml"
|
||||
fi
|
||||
'';
|
||||
|
||||
# Exposed neovim configurations
|
||||
nix = buildPkg false;
|
||||
maximal = buildPkg true;
|
||||
default = config.packages.nix;
|
||||
};
|
||||
# Exposed neovim configurations
|
||||
nix = buildPkg false;
|
||||
maximal = buildPkg true;
|
||||
default = config.packages.nix;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
pins,
|
||||
openssl,
|
||||
pkg-config,
|
||||
rustPlatform,
|
||||
|
@ -6,11 +7,17 @@
|
|||
vimUtils,
|
||||
makeWrapper,
|
||||
pkgs,
|
||||
version,
|
||||
src,
|
||||
...
|
||||
}: let
|
||||
inherit version src;
|
||||
# From npins
|
||||
pin = pins.avante-nvim;
|
||||
version = pin.branch;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
inherit (pin.repository) owner repo;
|
||||
rev = pin.revision;
|
||||
sha256 = pin.hash;
|
||||
};
|
||||
|
||||
avante-nvim-lib = rustPlatform.buildRustPackage {
|
||||
pname = "avante-nvim-lib";
|
||||
inherit version src;
|
||||
|
@ -48,10 +55,9 @@ in
|
|||
ext = stdenv.hostPlatform.extensions.sharedLibrary;
|
||||
in ''
|
||||
mkdir -p $out/build
|
||||
ln -s ${avante-nvim-lib}/lib/libavante_repo_map${ext} $out/build/avante_repo_map${ext}
|
||||
ln -s ${avante-nvim-lib}/lib/libavante_templates${ext} $out/build/avante_templates${ext}
|
||||
ln -s ${avante-nvim-lib}/lib/libavante_tokenizers${ext} $out/build/avante_tokenizers${ext}
|
||||
ln -s ${avante-nvim-lib}/lib/libavante_html2md${ext} $out/build/avante_html2md${ext}
|
||||
for lib in "avante_repo_map" "avante_templates" "avante_tokenizers" "avante_html2md"; do
|
||||
ln -s ${avante-nvim-lib}/lib/lib$lib${ext} $out/build/$lib${ext}
|
||||
done
|
||||
'';
|
||||
|
||||
nvimSkipModules = [
|
|
@ -5,13 +5,13 @@
|
|||
}:
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "blink-cmp";
|
||||
version = "1.3.1";
|
||||
version = "1.6.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Saghen";
|
||||
repo = "blink.cmp";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-8lyDDrsh3sY7l0i0TPyhL69Oq0l63+/QPnLaU/mhq5A=";
|
||||
hash = "sha256-IHRYgKcYP+JDGu8Vtawgzlhq25vpROFqb8KmpfVMwCk=";
|
||||
};
|
||||
|
||||
forceShare = [
|
||||
|
@ -29,8 +29,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
|||
mv "$out/lib" "$out/target/release"
|
||||
'';
|
||||
|
||||
cargoHash = "sha256-IDoDugtNWQovfSstbVMkKHLBXKa06lxRWmywu4zyS3M=";
|
||||
useFetchCargoVendor = true;
|
||||
cargoHash = "sha256-QsVCugYWRri4qu64wHnbJQZBhy4tQrr+gCYbXtRBlqE=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
(writeShellScriptBin "git" "exit 1")
|
Loading…
Add table
Add a link
Reference in a new issue