branch: elpa/nix-mode
commit a3eb135716039c668ab2cc37d47eeffd50976b86
Author: Akira Komamura <[email protected]>
Commit: Akira Komamura <[email protected]>
nix-flake: Fix miscomparison to avoid repeatedly adding to registry
---
nix-flake.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/nix-flake.el b/nix-flake.el
index 1f12f41c2a..fbd99084cb 100644
--- a/nix-flake.el
+++ b/nix-flake.el
@@ -156,12 +156,13 @@ readers in transient.el."
"Select a directory containing a flake.
For PROMPT and INITIAL-INPUT, see the documentation of transient.el."
- (let ((input (read-directory-name prompt initial-input nil t)))
+ (let ((input (string-remove-suffix "/" (read-directory-name prompt
initial-input nil t))))
(prog1 (expand-file-name input)
(unless (file-exists-p (expand-file-name "flake.nix" input))
(user-error "The selected directory does not contain flake.nix"))
(when (and nix-flake-add-to-registry
- (not (member input (nix-flake--registry-refs))))
+ (not (member (concat "path:" input)
+ (nix-flake--registry-refs))))
(nix-flake--registry-add-1 input)))))
;;;;; --update-input