Skip to content

Commit d27aec6

Browse files
committed
rich-presence/cord-nvim: init
1 parent 294a078 commit d27aec6

8 files changed

Lines changed: 115 additions & 1 deletion

File tree

docs/manual/release-notes/rl-0.9.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,4 +445,10 @@ https://github.com/gorbit99/codewindow.nvim
445445
indentation; e.g. useful for Haskell and PureScript, for which treesitter
446446
indentation does not work good
447447
448+
[Adam0](https://github.com/adam01110):
449+
450+
[cord.nvim]: https://github.com/vyfor/cord.nvim
451+
452+
- Add [cord.nvim] plugin in `vim.presence.cord` with `enable` and `setupOpts`
453+
448454
<!-- vim: set textwidth=80: -->
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
lib,
3+
pins,
4+
fetchFromGitHub,
5+
rustPlatform,
6+
stdenv,
7+
vimUtils,
8+
}: let
9+
pin = pins.cord-nvim;
10+
11+
pname = "cord";
12+
version = pin.revision;
13+
src = fetchFromGitHub {
14+
inherit (pin.repository) owner repo;
15+
rev = pin.revision;
16+
sha256 = pin.hash;
17+
};
18+
19+
cord-server = rustPlatform.buildRustPackage {
20+
inherit pname version src;
21+
22+
postPatch = ''
23+
substituteInPlace .github/server-version.txt \
24+
--replace-fail "2.3.13" "${version}"
25+
'';
26+
27+
cargoHash = "sha256-/O+jOaA0PinUiEVILNEF+vUS7Kh3XAwWyFqSvD54rGM=";
28+
29+
doCheck = false;
30+
31+
env.RUSTFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-C link-arg=-undefined -C link-arg=dynamic_lookup";
32+
33+
meta.mainProgram = "cord";
34+
};
35+
in
36+
vimUtils.buildVimPlugin {
37+
pname = "cord-nvim";
38+
inherit version src;
39+
40+
doCheck = false;
41+
42+
postPatch = ''
43+
substituteInPlace lua/cord/server/fs/init.lua \
44+
--replace-fail "or M.get_data_path()" "or '${cord-server}'"
45+
46+
substituteInPlace lua/cord/api/config/init.lua \
47+
--replace-fail "update = 'fetch'," "update = 'none'," \
48+
--replace-fail "auto_update = true," "auto_update = false,"
49+
'';
50+
51+
meta = {
52+
description = "Discord rich presence plugin for Neovim";
53+
homepage = "https://github.com/vyfor/cord.nvim";
54+
license = lib.licenses.asl20;
55+
};
56+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
config,
3+
lib,
4+
...
5+
}: let
6+
inherit (lib.modules) mkIf;
7+
8+
cfg = config.vim.presence.cord-nvim;
9+
in {
10+
config = mkIf cfg.enable {
11+
vim = {
12+
globals.cord_defer_startup = true;
13+
14+
lazy.plugins.cord-nvim = {
15+
package = "cord-nvim";
16+
setupModule = "cord";
17+
inherit (cfg) setupOpts;
18+
event = ["DeferredUIEnter"];
19+
};
20+
};
21+
};
22+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{lib, ...}: let
2+
inherit (lib.options) mkEnableOption;
3+
inherit (lib.nvim.types) mkPluginSetupOption;
4+
in {
5+
options.vim.presence.cord-nvim = {
6+
enable = mkEnableOption "Discord rich presence [cord.nvim]";
7+
8+
setupOpts = mkPluginSetupOption "cord.nvim" {};
9+
};
10+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
imports = [
3+
./config.nix
4+
./cord.nix
5+
];
6+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
imports = [
3+
./cord-nvim
34
./neocord
45
];
56
}

modules/wrapper/build/config.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
# Get plugins built from source from self.packages
5858
# If adding a new plugin to be built from source, it must also be inherited
5959
# here.
60-
inherit (inputs.self.packages.${pkgs.stdenv.system}) blink-cmp avante-nvim;
60+
inherit (inputs.self.packages.${pkgs.stdenv.system}) blink-cmp avante-nvim cord-nvim;
6161
};
6262

6363
buildConfigPlugins = plugins:

npins/sources.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,19 @@
381381
"url": "https://github.com/zbirenbaum/copilot.lua/archive/0552b44fceedf0c4cba2cd4953d3976633b2509a.tar.gz",
382382
"hash": "sha256-PULc9fiFljpomXDBY1HeJDttImQf7lYprpNEx5MZO4Y="
383383
},
384+
"cord-nvim": {
385+
"type": "Git",
386+
"repository": {
387+
"type": "GitHub",
388+
"owner": "vyfor",
389+
"repo": "cord.nvim"
390+
},
391+
"branch": "master",
392+
"submodules": false,
393+
"revision": "0be090969e978f7442870ef227e09eff7bf3480d",
394+
"url": "https://github.com/vyfor/cord.nvim/archive/0be090969e978f7442870ef227e09eff7bf3480d.tar.gz",
395+
"hash": "sha256-J1Hc38vrltbRQi+ztiMMu1G6z3N1PVtFxQ7qMGsgq00="
396+
},
384397
"crates-nvim": {
385398
"type": "Git",
386399
"repository": {

0 commit comments

Comments
 (0)