Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 nix-update-script, 6 pkg-config, 7 rustPlatform, 8 vimUtils, 9 libuv, 10}: 11let 12 version = "1.6.3"; 13 src = fetchFromGitHub { 14 owner = "mistricky"; 15 repo = "codesnap.nvim"; 16 tag = "v${version}"; 17 hash = "sha256-VHH1jQczzNFiH+5YflhU9vVCkEUoKciV/Z/n9DEZwiY="; 18 }; 19 codesnap-lib = rustPlatform.buildRustPackage { 20 pname = "codesnap-lib"; 21 inherit version src; 22 23 sourceRoot = "${src.name}/generator"; 24 25 cargoHash = "sha256-tg4BO4tPzHhJTowL7RiAuBo4i440FehpGmnz9stTxfI="; 26 27 nativeBuildInputs = [ 28 pkg-config 29 rustPlatform.bindgenHook 30 ]; 31 32 buildInputs = [ 33 libuv.dev 34 ]; 35 }; 36in 37vimUtils.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 passthru = { 55 updateScript = nix-update-script { 56 attrPath = "vimPlugins.codesnap-nvim.codesnap-lib"; 57 }; 58 59 # needed for the update script 60 inherit codesnap-lib; 61 }; 62 63 meta = { 64 homepage = "https://github.com/mistricky/codesnap.nvim/"; 65 changelog = "https://github.com/mistricky/codesnap.nvim/releases/tag/${src.tag}"; 66 license = lib.licenses.mit; 67 }; 68}