From b63ef7b643940f9df5d8b9c98139063855f3eaf3 Mon Sep 17 00:00:00 2001 From: Daniel Nagy Date: Wed, 5 Apr 2023 21:15:00 +0200 Subject: [PATCH] Allow build logs to be opened in `.drv` files --- CHANGELOG.md | 1 + nix-store.el | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0790202..f60d691 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased (1.6.0) * Introduce nix-store-path-omit-self customization option. +* Build logs can now be viewed from `.drv` store buffers as well. ## 1.5.0 diff --git a/nix-store.el b/nix-store.el index 2668246..608e0fa 100644 --- a/nix-store.el +++ b/nix-store.el @@ -216,7 +216,10 @@ It uses \\[nix-store-show-path] to display the store path." (defun nix-store-show-log () "Opens the log file for the derivation of the nix-store path." (interactive) - (if-let ((drv-path (car (nix-store-path-derivers nix-buffer-store-path)))) + (if-let ((drv-path + (if (string-suffix-p ".drv" (nix-store-path-path nix-buffer-store-path)) + (nix-store-path-path nix-buffer-store-path) + (car (nix-store-path-derivers nix-buffer-store-path))))) (find-file (nix-log-path drv-path)) (user-error "This store path has no associated derivation.")))