vimUtils: buildVimPluginFrom2Nix renamed to buildVimPlugin

the `from2Nix` suffix is a legacy from vim2nix but we dont use that anymore. It makes the name of the function unusual and long.
This commit is contained in:
Matthieu Coudron 2023-09-26 20:31:31 +02:00
parent c22ca8e820
commit 0ab2c96429
12 changed files with 1377 additions and 1378 deletions

View File

@ -134,7 +134,7 @@ If one of your favourite plugins isn't packaged, you can package it yourself:
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
easygrep = pkgs.vimUtils.buildVimPluginFrom2Nix { easygrep = pkgs.vimUtils.buildVimPlugin {
name = "vim-easygrep"; name = "vim-easygrep";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "dkprice"; owner = "dkprice";

View File

@ -119,6 +119,9 @@
- The `services.ananicy.extraRules` option now has the type of `listOf attrs` instead of `string`. - The `services.ananicy.extraRules` option now has the type of `listOf attrs` instead of `string`.
- `buildVimPluginFrom2Nix` has been renamed to `buildVimPlugin`, which now
now skips `configurePhase` and `buildPhase`
- JACK tools (`jack_*` except `jack_control`) have moved from the `jack2` package to `jack-example-tools` - JACK tools (`jack_*` except `jack_control`) have moved from the `jack2` package to `jack-example-tools`
- The `matrix-synapse` package & module have undergone some significant internal changes, for most setups no intervention is needed, though: - The `matrix-synapse` package & module have undergone some significant internal changes, for most setups no intervention is needed, though:

View File

@ -16,8 +16,8 @@ rec {
, namePrefix ? "vimplugin-" , namePrefix ? "vimplugin-"
, src , src
, unpackPhase ? "" , unpackPhase ? ""
, configurePhase ? "" , configurePhase ? ":"
, buildPhase ? "" , buildPhase ? ":"
, preInstall ? "" , preInstall ? ""
, postInstall ? "" , postInstall ? ""
, path ? "." , path ? "."
@ -48,9 +48,4 @@ rec {
in in
addRtp (toVimPlugin drv); addRtp (toVimPlugin drv);
buildVimPluginFrom2Nix = attrs: buildVimPlugin ({
# vim plugins may override this
buildPhase = ":";
configurePhase = ":";
} // attrs);
} }

View File

@ -7,14 +7,14 @@
let let
inherit (vimUtils.override {inherit vim;}) inherit (vimUtils.override {inherit vim;})
buildVimPluginFrom2Nix; buildVimPlugin;
inherit (lib) extends; inherit (lib) extends;
initialPackages = self: { }; initialPackages = self: { };
plugins = callPackage ./generated.nix { plugins = callPackage ./generated.nix {
inherit buildVimPluginFrom2Nix; inherit buildVimPlugin;
inherit (neovimUtils) buildNeovimPlugin; inherit (neovimUtils) buildNeovimPlugin;
}; };
@ -26,7 +26,7 @@ let
# add to ./overrides.nix. # add to ./overrides.nix.
overrides = callPackage ./overrides.nix { overrides = callPackage ./overrides.nix {
inherit (darwin.apple_sdk.frameworks) Cocoa CoreFoundation CoreServices; inherit (darwin.apple_sdk.frameworks) Cocoa CoreFoundation CoreServices;
inherit buildVimPluginFrom2Nix; inherit buildVimPlugin;
inherit llvmPackages luaPackages; inherit llvmPackages luaPackages;
}; };

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
with import <localpkgs> {}; with import <localpkgs> {};
let let
inherit (vimUtils.override {inherit vim;}) buildVimPluginFrom2Nix; inherit (vimUtils.override {inherit vim;}) buildVimPlugin;
inherit (neovimUtils) buildNeovimPlugin; inherit (neovimUtils) buildNeovimPlugin;
generated = callPackage <localpkgs/pkgs/applications/editors/vim/plugins/generated.nix> { generated = callPackage <localpkgs/pkgs/applications/editors/vim/plugins/generated.nix> {
inherit buildNeovimPlugin buildVimPluginFrom2Nix; inherit buildNeovimPlugin buildVimPlugin;
} {} {}; } {} {};
hasChecksum = value: hasChecksum = value:
lib.isAttrs value && lib.hasAttrByPath ["src" "outputHash"] value; lib.isAttrs value && lib.hasAttrByPath ["src" "outputHash"] value;

View File

@ -3,7 +3,7 @@
# nixpkgs functions # nixpkgs functions
, buildGoModule , buildGoModule
, buildVimPluginFrom2Nix , buildVimPlugin
, fetchFromGitHub , fetchFromGitHub
, fetchFromSourcehut , fetchFromSourcehut
, fetchpatch , fetchpatch
@ -153,7 +153,7 @@ self: super: {
}; };
# The GitHub repository returns 404, which breaks the update script # The GitHub repository returns 404, which breaks the update script
bitbake-vim = buildVimPluginFrom2Nix { bitbake-vim = buildVimPlugin {
pname = "bitbake.vim"; pname = "bitbake.vim";
version = "2021-02-06"; version = "2021-02-06";
src = fetchFromGitHub { src = fetchFromGitHub {
@ -305,7 +305,7 @@ self: super: {
dependencies = with self; [ nvim-cmp zsh ]; dependencies = with self; [ nvim-cmp zsh ];
}; };
coc-nginx = buildVimPluginFrom2Nix { coc-nginx = buildVimPlugin {
pname = "coc-nginx"; pname = "coc-nginx";
inherit (nodePackages."@yaegassy/coc-nginx") version meta; inherit (nodePackages."@yaegassy/coc-nginx") version meta;
src = "${nodePackages."@yaegassy/coc-nginx"}/lib/node_modules/@yaegassy/coc-nginx"; src = "${nodePackages."@yaegassy/coc-nginx"}/lib/node_modules/@yaegassy/coc-nginx";
@ -553,7 +553,7 @@ self: super: {
# Mainly used as a dependency for fzf-vim. Wraps the fzf program as a vim # Mainly used as a dependency for fzf-vim. Wraps the fzf program as a vim
# plugin, since part of the fzf vim plugin is included in the main fzf # plugin, since part of the fzf vim plugin is included in the main fzf
# program. # program.
fzfWrapper = buildVimPluginFrom2Nix { fzfWrapper = buildVimPlugin {
inherit (fzf) src version; inherit (fzf) src version;
pname = "fzf"; pname = "fzf";
postInstall = '' postInstall = ''
@ -594,7 +594,7 @@ self: super: {
}; };
# https://hurl.dev/ # https://hurl.dev/
hurl = buildVimPluginFrom2Nix { hurl = buildVimPlugin {
pname = "hurl"; pname = "hurl";
version = hurl.version; version = hurl.version;
# dontUnpack = true; # dontUnpack = true;
@ -658,7 +658,7 @@ self: super: {
''; '';
}; };
in in
buildVimPluginFrom2Nix { buildVimPlugin {
pname = "LanguageClient-neovim"; pname = "LanguageClient-neovim";
inherit version; inherit version;
src = LanguageClient-neovim-src; src = LanguageClient-neovim-src;
@ -707,7 +707,7 @@ self: super: {
dependencies = with self; [ plenary-nvim ]; dependencies = with self; [ plenary-nvim ];
}; };
magma-nvim-goose = buildVimPluginFrom2Nix { magma-nvim-goose = buildVimPlugin {
pname = "magma-nvim-goose"; pname = "magma-nvim-goose";
version = "2023-03-13"; version = "2023-03-13";
src = fetchFromGitHub { src = fetchFromGitHub {
@ -767,7 +767,7 @@ self: super: {
dependencies = with self; [ mason-nvim ]; dependencies = with self; [ mason-nvim ];
}; };
meson = buildVimPluginFrom2Nix { meson = buildVimPlugin {
inherit (meson) pname version src; inherit (meson) pname version src;
preInstall = "cd data/syntax-highlighting/vim"; preInstall = "cd data/syntax-highlighting/vim";
meta.maintainers = with lib.maintainers; [ vcunat ]; meta.maintainers = with lib.maintainers; [ vcunat ];
@ -785,7 +785,7 @@ self: super: {
vimCommandCheck = "MinimapToggle"; vimCommandCheck = "MinimapToggle";
}; };
minsnip-nvim = buildVimPluginFrom2Nix { minsnip-nvim = buildVimPlugin {
pname = "minsnip.nvim"; pname = "minsnip.nvim";
version = "2022-01-04"; version = "2022-01-04";
src = fetchFromGitHub { src = fetchFromGitHub {
@ -939,7 +939,7 @@ self: super: {
inherit parinfer-rust; inherit parinfer-rust;
phpactor = buildVimPluginFrom2Nix { phpactor = buildVimPlugin {
inherit (phpactor) pname src meta version; inherit (phpactor) pname src meta version;
postPatch = '' postPatch = ''
substituteInPlace plugin/phpactor.vim \ substituteInPlace plugin/phpactor.vim \
@ -1008,7 +1008,7 @@ self: super: {
''; '';
}); });
skim = buildVimPluginFrom2Nix { skim = buildVimPlugin {
pname = "skim"; pname = "skim";
inherit (skim) version; inherit (skim) version;
src = skim.vim; src = skim.vim;
@ -1048,7 +1048,7 @@ self: super: {
doCheck = false; doCheck = false;
}; };
in in
buildVimPluginFrom2Nix { buildVimPlugin {
pname = "sniprun"; pname = "sniprun";
inherit version src; inherit version src;
@ -1061,7 +1061,7 @@ self: super: {
}; };
# The GitHub repository returns 404, which breaks the update script # The GitHub repository returns 404, which breaks the update script
Spacegray-vim = buildVimPluginFrom2Nix { Spacegray-vim = buildVimPlugin {
pname = "Spacegray.vim"; pname = "Spacegray.vim";
version = "2021-07-06"; version = "2021-07-06";
src = fetchFromGitHub { src = fetchFromGitHub {
@ -1086,7 +1086,7 @@ self: super: {
dependencies = with self; [ nvim-treesitter ]; dependencies = with self; [ nvim-treesitter ];
}; };
statix = buildVimPluginFrom2Nix rec { statix = buildVimPlugin rec {
inherit (statix) pname src meta; inherit (statix) pname src meta;
version = "0.1.0"; version = "0.1.0";
postPatch = '' postPatch = ''
@ -1136,7 +1136,7 @@ self: super: {
}; };
}; };
taskwarrior = buildVimPluginFrom2Nix { taskwarrior = buildVimPlugin {
inherit (taskwarrior) version pname; inherit (taskwarrior) version pname;
src = "${taskwarrior.src}/scripts/vim"; src = "${taskwarrior.src}/scripts/vim";
}; };
@ -1222,7 +1222,7 @@ self: super: {
au BufNewFile,BufRead Tupfile,*.tup setf tup au BufNewFile,BufRead Tupfile,*.tup setf tup
''; '';
in in
buildVimPluginFrom2Nix { buildVimPlugin {
inherit (tup) pname version src; inherit (tup) pname version src;
preInstall = '' preInstall = ''
mkdir -p vim-plugin/syntax vim-plugin/ftdetect mkdir -p vim-plugin/syntax vim-plugin/ftdetect
@ -1546,7 +1546,7 @@ self: super: {
''; '';
}; };
vim2nix = buildVimPluginFrom2Nix { vim2nix = buildVimPlugin {
pname = "vim2nix"; pname = "vim2nix";
version = "1.0"; version = "1.0";
src = ./vim2nix; src = ./vim2nix;
@ -1570,7 +1570,7 @@ self: super: {
}; };
# The GitHub repository returns 404, which breaks the update script # The GitHub repository returns 404, which breaks the update script
VimCompletesMe = buildVimPluginFrom2Nix { VimCompletesMe = buildVimPlugin {
pname = "VimCompletesMe"; pname = "VimCompletesMe";
version = "2022-02-18"; version = "2022-02-18";
src = fetchFromGitHub { src = fetchFromGitHub {
@ -1706,7 +1706,7 @@ self: super: {
"coc-yaml" "coc-yaml"
"coc-yank" "coc-yank"
]; ];
nodePackage2VimPackage = name: buildVimPluginFrom2Nix { nodePackage2VimPackage = name: buildVimPlugin {
pname = name; pname = name;
inherit (nodePackages.${name}) version meta; inherit (nodePackages.${name}) version meta;
src = "${nodePackages.${name}}/lib/node_modules/${name}"; src = "${nodePackages.${name}}/lib/node_modules/${name}";

View File

@ -74,7 +74,7 @@ class VimEditor(pluginupdate.Editor):
with open(outfile, "w+") as f: with open(outfile, "w+") as f:
f.write(HEADER) f.write(HEADER)
f.write(textwrap.dedent(""" f.write(textwrap.dedent("""
{ lib, buildVimPluginFrom2Nix, buildNeovimPlugin, fetchFromGitHub, fetchgit }: { lib, buildVimPlugin, buildNeovimPlugin, fetchFromGitHub, fetchgit }:
final: prev: final: prev:
{ {
@ -103,7 +103,7 @@ class VimEditor(pluginupdate.Editor):
}}; }};
""".format( """.format(
buildFn="buildNeovimPlugin" if isNeovim else "buildVimPluginFrom2Nix", plugin=plugin, src_nix=src_nix, repo=repo) buildFn="buildNeovimPlugin" if isNeovim else "buildVimPlugin", plugin=plugin, src_nix=src_nix, repo=repo)
log.debug(content) log.debug(content)
return content return content

View File

@ -53,7 +53,7 @@ let
}; };
in in
vimUtils.buildVimPluginFrom2Nix { vimUtils.buildVimPlugin {
pname = "vim-clap"; pname = "vim-clap";
inherit version src meta; inherit version src meta;

View File

@ -392,8 +392,9 @@ rec {
inherit (import ./build-vim-plugin.nix { inherit (import ./build-vim-plugin.nix {
inherit lib stdenv rtpPath toVimPlugin; inherit lib stdenv rtpPath toVimPlugin;
}) buildVimPlugin buildVimPluginFrom2Nix; }) buildVimPlugin;
buildVimPluginFrom2Nix = lib.warn "buildVimPluginFrom2Nix is deprecated: use buildVimPlugin instead" buildVimPlugin;
# used to figure out which python dependencies etc. neovim needs # used to figure out which python dependencies etc. neovim needs
requiredPlugins = { requiredPlugins = {

View File

@ -50,7 +50,7 @@ fun! nix#NixDerivation(opts, name, repository) abort
let dependencies = nix#DependenciesFromCheckout(a:opts, a:name, a:repository, dir) let dependencies = nix#DependenciesFromCheckout(a:opts, a:name, a:repository, dir)
return {'n_a_name': n_a_name, 'n_n_name': n_n_name, 'dependencies': dependencies, 'derivation': join([ return {'n_a_name': n_a_name, 'n_n_name': n_n_name, 'dependencies': dependencies, 'derivation': join([
\ ' '.n_a_name.' = buildVimPluginFrom2Nix {'.created_notice, \ ' '.n_a_name.' = buildVimPlugin {'.created_notice,
\ ' name = "'.n_n_name.'-'.date.'";', \ ' name = "'.n_n_name.'-'.date.'";',
\ ' src = fetchgit {', \ ' src = fetchgit {',
\ ' url = "'. a:repository.url .'";', \ ' url = "'. a:repository.url .'";',
@ -74,7 +74,7 @@ fun! nix#NixDerivation(opts, name, repository) abort
let dependencies = nix#DependenciesFromCheckout(a:opts, a:name, a:repository, dir) let dependencies = nix#DependenciesFromCheckout(a:opts, a:name, a:repository, dir)
return {'n_a_name': n_a_name, 'n_n_name': n_n_name, 'dependencies': dependencies, 'derivation': join([ return {'n_a_name': n_a_name, 'n_n_name': n_n_name, 'dependencies': dependencies, 'derivation': join([
\ ' '.n_a_name.' = buildVimPluginFrom2Nix {'.created_notice, \ ' '.n_a_name.' = buildVimPlugin {'.created_notice,
\ ' name = "'.n_n_name.'";', \ ' name = "'.n_n_name.'";',
\ ' src = fetchhg {', \ ' src = fetchhg {',
\ ' url = "'. a:repository.url .'";', \ ' url = "'. a:repository.url .'";',
@ -99,7 +99,7 @@ fun! nix#NixDerivation(opts, name, repository) abort
let dependencies = keys(get(addon_info, 'dependencies', {})) let dependencies = keys(get(addon_info, 'dependencies', {}))
return {'n_a_name': n_a_name, 'n_n_name': n_n_name, 'dependencies': dependencies, 'derivation': join([ return {'n_a_name': n_a_name, 'n_n_name': n_n_name, 'dependencies': dependencies, 'derivation': join([
\ ' '.n_a_name.' = buildVimPluginFrom2Nix {'.created_notice, \ ' '.n_a_name.' = buildVimPlugin {'.created_notice,
\ ' name = "'.n_n_name.'";', \ ' name = "'.n_n_name.'";',
\ ' src = fetchurl {', \ ' src = fetchurl {',
\ ' url = "'. a:repository.url .'";', \ ' url = "'. a:repository.url .'";',

View File

@ -3,7 +3,7 @@
, pkgs , pkgs
}: }:
let let
inherit (vimUtils) buildVimPluginFrom2Nix; inherit (vimUtils) buildVimPlugin;
packages.myVimPackage.start = with vimPlugins; [ vim-nix ]; packages.myVimPackage.start = with vimPlugins; [ vim-nix ];