1{
2 lib,
3 fetchFromGitHub,
4 rustPlatform,
5 vimUtils,
6 stdenv,
7}:
8let
9 version = "0.3.1-unstable-2023-07-06";
10 src = fetchFromGitHub {
11 owner = "willothy";
12 repo = "moveline.nvim";
13 rev = "570603637be8af20e97b91cf554fef29cab73ca6";
14 hash = "sha256-hq/n48JC1EgJbmb6b/1jQ8MNhbcsJD3wIYaKE1UiU30=";
15 };
16 moveline-lib = rustPlatform.buildRustPackage {
17 inherit src version;
18 pname = "moveline-lib";
19
20 # Upstream doesn't contain a cargo lock
21 cargoLock = {
22 lockFile = ./Cargo.lock;
23 };
24
25 postPatch = ''
26 ln -s ${./Cargo.lock} Cargo.lock
27 '';
28 };
29in
30vimUtils.buildVimPlugin {
31 inherit src version;
32 pname = "moveline-nvim";
33
34 preInstall =
35 # https://github.com/neovim/neovim/issues/21749
36 # Need to still copy generated library as `so` because neovim doesn't check for `dylib`
37 let
38 ext = stdenv.hostPlatform.extensions.sharedLibrary;
39 in
40 ''
41 mkdir -p lua
42 ln -s ${moveline-lib}/lib/libmoveline${ext} lua/moveline.so
43 '';
44
45 # Plugin generates a non lua file output that needs to be manually required
46 nvimRequireCheck = "moveline";
47
48 meta = {
49 description = "Neovim plugin for moving lines up and down";
50 homepage = "https://github.com/willothy/moveline.nvim";
51 license = lib.licenses.mit;
52 maintainers = with lib.maintainers; [ redxtech ];
53 };
54}