Files
nixpkgs/pkgs/applications/editors/vim/plugins/non-generated/codesnap-nvim/default.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

69 lines
1.6 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
nix-update-script,
pkg-config,
rustPlatform,
vimUtils,
libuv,
}:
let
version = "1.6.3";
src = fetchFromGitHub {
owner = "mistricky";
repo = "codesnap.nvim";
tag = "v${version}";
hash = "sha256-VHH1jQczzNFiH+5YflhU9vVCkEUoKciV/Z/n9DEZwiY=";
};
codesnap-lib = rustPlatform.buildRustPackage {
pname = "codesnap-lib";
inherit version src;
sourceRoot = "${src.name}/generator";
cargoHash = "sha256-tg4BO4tPzHhJTowL7RiAuBo4i440FehpGmnz9stTxfI=";
nativeBuildInputs = [
pkg-config
rustPlatform.bindgenHook
];
buildInputs = [
libuv.dev
];
};
in
vimUtils.buildVimPlugin {
pname = "codesnap.nvim";
inherit version src;
# - Remove the shipped pre-built binaries
# - Copy the resulting binary from the codesnap-lib derivation
# Note: the destination should be generator.so, even on darwin
# https://github.com/mistricky/codesnap.nvim/blob/main/scripts/build_generator.sh
postInstall =
let
extension = if stdenv.hostPlatform.isDarwin then "dylib" else "so";
in
''
rm -r $out/lua/*.so
cp ${codesnap-lib}/lib/libgenerator.${extension} $out/lua/generator.so
'';
passthru = {
updateScript = nix-update-script {
attrPath = "vimPlugins.codesnap-nvim.codesnap-lib";
};
# needed for the update script
inherit codesnap-lib;
};
meta = {
homepage = "https://github.com/mistricky/codesnap.nvim/";
changelog = "https://github.com/mistricky/codesnap.nvim/releases/tag/${src.tag}";
license = lib.licenses.mit;
};
}