Skip to content

Commit 5333bfa

Browse files
committed
vimPlugins.codesnap-nvim: move out of vim generated
1 parent e2118db commit 5333bfa

File tree

4 files changed

+72
-72
lines changed

4 files changed

+72
-72
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
nix-update-script,
6+
pkg-config,
7+
rustPlatform,
8+
vimUtils,
9+
libuv,
10+
}:
11+
let
12+
version = "1.6.1";
13+
src = fetchFromGitHub {
14+
owner = "mistricky";
15+
repo = "codesnap.nvim";
16+
tag = "v${version}";
17+
hash = "sha256-OmSgrTYDtNb2plMyzjVvxGrfXB/lGKDpUQhpRqKfAMA=";
18+
};
19+
codesnap-lib = rustPlatform.buildRustPackage {
20+
pname = "codesnap-lib";
21+
inherit version src;
22+
23+
sourceRoot = "${src.name}/generator";
24+
25+
cargoHash = "sha256-6n37n8oHIHrz3S1+40nuD0Ud3l0iNgXig1ZwrgsnYTI=";
26+
27+
nativeBuildInputs = [
28+
pkg-config
29+
rustPlatform.bindgenHook
30+
];
31+
32+
buildInputs = [
33+
libuv.dev
34+
];
35+
};
36+
in
37+
vimUtils.buildVimPlugin {
38+
pname = "codesnap.nvim";
39+
inherit version src;
40+
41+
# - Remove the shipped pre-built binaries
42+
# - Copy the resulting binary from the codesnap-lib derivation
43+
# Note: the destination should be generator.so, even on darwin
44+
# https://github.com/mistricky/codesnap.nvim/blob/main/scripts/build_generator.sh
45+
postInstall =
46+
let
47+
extension = if stdenv.hostPlatform.isDarwin then "dylib" else "so";
48+
in
49+
''
50+
rm -r $out/lua/*.so
51+
cp ${codesnap-lib}/lib/libgenerator.${extension} $out/lua/generator.so
52+
'';
53+
54+
doInstallCheck = true;
55+
nvimRequireCheck = "codesnap";
56+
57+
passthru = {
58+
updateScript = nix-update-script {
59+
attrPath = "vimPlugins.codesnap-nvim.codesnap-lib";
60+
};
61+
62+
# needed for the update script
63+
inherit codesnap-lib;
64+
};
65+
66+
meta = {
67+
homepage = "https://github.com/mistricky/codesnap.nvim/";
68+
changelog = "https://github.com/mistricky/codesnap.nvim/releases/tag/${src.tag}";
69+
license = lib.licenses.mit;
70+
};
71+
}

pkgs/applications/editors/vim/plugins/generated.nix

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,18 +2465,6 @@ final: prev:
24652465
meta.homepage = "https://github.com/Exafunction/codeium.vim/";
24662466
};
24672467

2468-
codesnap-nvim = buildVimPlugin {
2469-
pname = "codesnap.nvim";
2470-
version = "2024-09-22";
2471-
src = fetchFromGitHub {
2472-
owner = "mistricky";
2473-
repo = "codesnap.nvim";
2474-
rev = "6400480aa6cc366cbd931146c429aaa64680dab9";
2475-
sha256 = "1kdqh5vn837pxygz141n01zw08apcxi39xzdn5a0zhddimqn16z1";
2476-
};
2477-
meta.homepage = "https://github.com/mistricky/codesnap.nvim/";
2478-
};
2479-
24802468
codewindow-nvim = buildVimPlugin {
24812469
pname = "codewindow.nvim";
24822470
version = "2024-06-05";

pkgs/applications/editors/vim/plugins/overrides.nix

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@
7272
zsh,
7373
# codeium-nvim dependencies
7474
codeium,
75-
# codesnap-nvim dependencies
76-
clang,
77-
libuv,
7875
# command-t dependencies
7976
getconf,
8077
ruby,
@@ -678,62 +675,7 @@ in
678675
nvimRequireCheck = "codeium";
679676
};
680677

681-
codesnap-nvim =
682-
let
683-
version = "1.6.1";
684-
src = fetchFromGitHub {
685-
owner = "mistricky";
686-
repo = "codesnap.nvim";
687-
rev = "refs/tags/v${version}";
688-
hash = "sha256-OmSgrTYDtNb2plMyzjVvxGrfXB/lGKDpUQhpRqKfAMA=";
689-
};
690-
codesnap-lib = rustPlatform.buildRustPackage {
691-
pname = "codesnap-lib";
692-
inherit version src;
693-
694-
sourceRoot = "${src.name}/generator";
695-
696-
cargoHash = "sha256-6n37n8oHIHrz3S1+40nuD0Ud3l0iNgXig1ZwrgsnYTI=";
697-
698-
nativeBuildInputs = [
699-
pkg-config
700-
rustPlatform.bindgenHook
701-
];
702-
703-
buildInputs =
704-
[
705-
libuv.dev
706-
]
707-
++ lib.optionals stdenv.hostPlatform.isDarwin [
708-
darwin.apple_sdk.frameworks.AppKit
709-
];
710-
};
711-
in
712-
buildVimPlugin {
713-
pname = "codesnap.nvim";
714-
inherit version src;
715-
716-
# - Remove the shipped pre-built binaries
717-
# - Copy the resulting binary from the codesnap-lib derivation
718-
# Note: the destination should be generator.so, even on darwin
719-
# https://github.com/mistricky/codesnap.nvim/blob/main/scripts/build_generator.sh
720-
postInstall =
721-
let
722-
extension = if stdenv.hostPlatform.isDarwin then "dylib" else "so";
723-
in
724-
''
725-
rm -r $out/lua/*.so
726-
cp ${codesnap-lib}/lib/libgenerator.${extension} $out/lua/generator.so
727-
'';
728-
729-
doInstallCheck = true;
730-
nvimRequireCheck = "codesnap";
731-
732-
meta = {
733-
homepage = "https://github.com/mistricky/codesnap.nvim/";
734-
changelog = "https://github.com/mistricky/codesnap.nvim/releases/tag/v${version}";
735-
};
736-
};
678+
codesnap-nvim = callPackage ./codesnap-nvim { };
737679

738680
codewindow-nvim = super.codewindow-nvim.overrideAttrs {
739681
dependencies = [ self.nvim-treesitter ];

pkgs/applications/editors/vim/plugins/vim-plugin-names

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ https://github.com/manicmaniac/coconut.vim/,HEAD,
203203
https://github.com/olimorris/codecompanion.nvim/,HEAD,
204204
https://github.com/Exafunction/codeium.nvim/,HEAD,
205205
https://github.com/Exafunction/codeium.vim/,HEAD,
206-
https://github.com/mistricky/codesnap.nvim/,HEAD,
207206
https://github.com/gorbit99/codewindow.nvim/,HEAD,
208207
https://github.com/metakirby5/codi.vim/,,
209208
https://github.com/tjdevries/colorbuddy.nvim/,,

0 commit comments

Comments
 (0)