From 6c12a584251429cda2c991f27c98259502722d22 Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Thu, 2 Jan 2025 11:35:02 +0100 Subject: [PATCH 1/3] emacsPackages.copilot: 0-unstable-2024-05-01 -> 0-unstable-2024-12-28 --- .../elisp-packages/manual-packages/copilot/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/package.nix b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/package.nix index 2225dff0872d..438f1a8ae101 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/package.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/package.nix @@ -10,13 +10,13 @@ }: melpaBuild { pname = "copilot"; - version = "0-unstable-2024-05-01"; + version = "0-unstable-2024-12-28"; src = fetchFromGitHub { owner = "copilot-emacs"; repo = "copilot.el"; - rev = "733bff26450255e092c10873580e9abfed8a81b8"; - sha256 = "sha256-Knp36PtgA73gtYO+W1clQfr570bKCxTFsGW3/iH86A0="; + rev = "c5dfa99f05878db5e6a6a378dc7ed09f11e803d4"; + sha256 = "sha256-FzI08AW7a7AleEM7kSQ8LsWsDYID8SW1SmSN6/mIB/A="; }; files = ''(:defaults "dist")''; From 46646c3003838f77555619b3d505188b3cc43401 Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Thu, 2 Jan 2025 14:09:33 +0100 Subject: [PATCH 2/3] emacsPackages.copilot: Configure nix-installed copilot-node-server By default, the copilot Emacs package searches for "copilot-node-server" in PATH. If copilot-node-server isn't found, the package downloads and installs it automatically. All of that isn't compatible with the Nix way of doing things. This commit configures the package so the package gets the copilot-node-server from Nix. Co-authored-by: Lin Jian --- .../manual-packages/copilot/package.nix | 7 +++++++ .../copilot/specify-copilot-install-dir.patch | 14 ++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/specify-copilot-install-dir.patch diff --git a/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/package.nix b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/package.nix index 438f1a8ae101..2c6bbd7fb465 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/package.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/package.nix @@ -4,9 +4,11 @@ editorconfig, f, fetchFromGitHub, + replaceVars, nodejs, s, melpaBuild, + copilot-node-server, }: melpaBuild { pname = "copilot"; @@ -21,6 +23,11 @@ melpaBuild { files = ''(:defaults "dist")''; + patches = [ + (replaceVars ./specify-copilot-install-dir.patch { + copilot-node-server = copilot-node-server; + }) + ]; packageRequires = [ dash editorconfig diff --git a/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/specify-copilot-install-dir.patch b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/specify-copilot-install-dir.patch new file mode 100644 index 000000000000..c10f19133cac --- /dev/null +++ b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/specify-copilot-install-dir.patch @@ -0,0 +1,14 @@ +diff --git a/copilot.el b/copilot.el +index f1f5e51..ddf2b5b 100644 +--- a/copilot.el ++++ b/copilot.el +@@ -132,8 +132,7 @@ (defcustom copilot-indentation-alist + (defconst copilot-server-package-name "copilot-node-server" + "The name of the package to install copilot server.") + +-(defcustom copilot-install-dir (expand-file-name +- (locate-user-emacs-file (f-join ".cache" "copilot"))) ++(defcustom copilot-install-dir "@copilot-node-server@" + "Directory in which the servers will be installed." + :risky t + :type 'directory From 9dd2f25c2b1ef93daec35953d962f00a840a0a93 Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Thu, 2 Jan 2025 14:13:58 +0100 Subject: [PATCH 3/3] emacsPackages.copilot: Make the package use a compatible version of the server --- .../manual-packages/copilot/package.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/package.nix b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/package.nix index 2c6bbd7fb465..86109b57a2ac 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/package.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/copilot/package.nix @@ -10,6 +10,20 @@ melpaBuild, copilot-node-server, }: +let + # The Emacs package isn't compatible with the latest + # copilot-node-server so we have to set a specific revision + # https://github.com/copilot-emacs/copilot.el/issues/344 + pinned-copilot-node-server = copilot-node-server.overrideAttrs (old: rec { + version = "1.27.0"; + src = fetchFromGitHub { + owner = "jfcherng"; + repo = "copilot-node-server"; + rev = version; + hash = "sha256-Ds2agoO7LBXI2M1dwvifQyYJ3F9fm9eV2Kmm7WITgyo="; + }; + }); +in melpaBuild { pname = "copilot"; version = "0-unstable-2024-12-28"; @@ -25,7 +39,7 @@ melpaBuild { patches = [ (replaceVars ./specify-copilot-install-dir.patch { - copilot-node-server = copilot-node-server; + copilot-node-server = pinned-copilot-node-server; }) ]; packageRequires = [