rich-presence/cord-nvim: init

This commit is contained in:
Adam0 2026-04-27 16:12:28 +02:00
parent 5b4f9c6320
commit e04a353093
No known key found for this signature in database
GPG key ID: 0FFE5DE6328D5EC9
9 changed files with 116 additions and 1 deletions

View file

@ -293,6 +293,7 @@ isMaximal: {
presence = {
neocord.enable = false;
cord-nvim.enable = false;
};
};
}

View file

@ -506,4 +506,10 @@ https://github.com/gorbit99/codewindow.nvim
- Allow `vim.treesitter.context.setupOpts.max_lines` to also be given as a
string in order to allow percentage values like `"20%"`
[Adam0](https://github.com/adam01110):
[cord.nvim]: https://github.com/vyfor/cord.nvim
- Add [cord.nvim] plugin in `vim.presence.cord` with `enable` and `setupOpts`
<!-- vim: set textwidth=80: -->

View file

@ -0,0 +1,56 @@
{
lib,
pins,
fetchFromGitHub,
rustPlatform,
stdenv,
vimUtils,
}: let
pin = pins.cord-nvim;
pname = "cord";
version = pin.revision;
src = fetchFromGitHub {
inherit (pin.repository) owner repo;
rev = pin.revision;
sha256 = pin.hash;
};
cord-server = rustPlatform.buildRustPackage {
inherit pname version src;
postPatch = ''
substituteInPlace .github/server-version.txt \
--replace-fail "2.3.13" "${version}"
'';
cargoHash = "sha256-/O+jOaA0PinUiEVILNEF+vUS7Kh3XAwWyFqSvD54rGM=";
doCheck = false;
env.RUSTFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-C link-arg=-undefined -C link-arg=dynamic_lookup";
meta.mainProgram = "cord";
};
in
vimUtils.buildVimPlugin {
pname = "cord-nvim";
inherit version src;
doCheck = false;
postPatch = ''
substituteInPlace lua/cord/server/fs/init.lua \
--replace-fail "or M.get_data_path()" "or '${cord-server}'"
substituteInPlace lua/cord/api/config/init.lua \
--replace-fail "update = 'fetch'," "update = 'none'," \
--replace-fail "auto_update = true," "auto_update = false,"
'';
meta = {
description = "Discord rich presence plugin for Neovim";
homepage = "https://github.com/vyfor/cord.nvim";
license = lib.licenses.asl20;
};
}

View file

@ -0,0 +1,22 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.presence.cord-nvim;
in {
config = mkIf cfg.enable {
vim = {
globals.cord_defer_startup = true;
lazy.plugins.cord-nvim = {
package = "cord-nvim";
setupModule = "cord";
inherit (cfg) setupOpts;
event = ["DeferredUIEnter"];
};
};
};
}

View file

@ -0,0 +1,10 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.presence.cord-nvim = {
enable = mkEnableOption "Discord rich presence [cord.nvim]";
setupOpts = mkPluginSetupOption "cord.nvim" {};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./cord-nvim.nix
];
}

View file

@ -1,5 +1,6 @@
{
imports = [
./cord-nvim
./neocord
];
}

View file

@ -57,7 +57,7 @@
# Get plugins built from source from self.packages
# If adding a new plugin to be built from source, it must also be inherited
# here.
inherit (inputs.self.packages.${pkgs.stdenv.system}) blink-cmp avante-nvim;
inherit (inputs.self.packages.${pkgs.stdenv.system}) blink-cmp avante-nvim cord-nvim;
};
buildConfigPlugins = plugins:

View file

@ -381,6 +381,19 @@
"url": "https://github.com/zbirenbaum/copilot.lua/archive/0552b44fceedf0c4cba2cd4953d3976633b2509a.tar.gz",
"hash": "sha256-PULc9fiFljpomXDBY1HeJDttImQf7lYprpNEx5MZO4Y="
},
"cord-nvim": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "vyfor",
"repo": "cord.nvim"
},
"branch": "master",
"submodules": false,
"revision": "0be090969e978f7442870ef227e09eff7bf3480d",
"url": "https://github.com/vyfor/cord.nvim/archive/0be090969e978f7442870ef227e09eff7bf3480d.tar.gz",
"hash": "sha256-J1Hc38vrltbRQi+ztiMMu1G6z3N1PVtFxQ7qMGsgq00="
},
"crates-nvim": {
"type": "Git",
"repository": {