[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/nix-mode e0c057fade 4/7: Add function to get nix store log
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/nix-mode e0c057fade 4/7: Add function to get nix store log path |
Date: |
Sun, 30 Oct 2022 19:58:58 -0400 (EDT) |
branch: elpa/nix-mode
commit e0c057fade6b1dcaf438861f45a5669ce9bfc034
Author: Matthew Bauer <mjbauer95@gmail.com>
Commit: Matthew Bauer <mjbauer95@gmail.com>
Add function to get nix store log path
---
nix-log.el | 21 ++++++++++++---------
nix-store.el | 16 ++++------------
2 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/nix-log.el b/nix-log.el
index 730cd6de3a..92d76c3869 100644
--- a/nix-log.el
+++ b/nix-log.el
@@ -16,6 +16,16 @@
(require 'nix)
(require 'nix-search)
(require 'nix-instantiate)
+(require 'files)
+
+(defun nix-log-path (drv-file)
+ "Get the nix log of path a derivation"
+ (let* ((drv-name (file-relative-name drv-file nix-store-dir))
+ (log-file (format "%s/log/nix/drvs/%s/%s.bz2"
+ nix-state-dir
+ (substring drv-name 0 2) (substring drv-name 2))))
+ (if (file-exists-p log-file) log-file
+ (error "No log is available for derivation"))))
;;;###autoload
(defun nix-log (file attr)
@@ -26,15 +36,8 @@ ATTR attribute to load the log of."
(unless attr (setq attr (nix-read-attr file)))
(let* ((drv-file (nix-instantiate file attr))
- (drv-name (progn
- (string-match (format "^%s/\\(.*\\)$" nix-store-dir)
drv-file)
- (match-string 1 drv-file)))
- (log-file (format "%s/log/nix/drvs/%s/%s.bz2"
- nix-state-dir
- (substring drv-name 0 2) drv-name)))
- (if (file-exists-p log-file)
- (find-file log-file)
- (error "No log is available for derivation"))))
+ (log-file (nix-log-path drv-file)))
+ (find-file log-file)))
(provide 'nix-log)
;;; nix-log.el ends here
diff --git a/nix-store.el b/nix-store.el
index 099019ecdc..21e3bb732e 100644
--- a/nix-store.el
+++ b/nix-store.el
@@ -14,6 +14,7 @@
(require 'eieio)
(require 'nix)
+(require 'nix-log)
(require 'magit-section)
(eval-when-compile
(require 'cl-lib))
@@ -209,19 +210,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)
- (let ((drv-name (when-let*
- ((drv-name (nix-store-path-derivers
nix-buffer-store-path))
- (drv-name (car drv-name)))
- (file-relative-name drv-name nix-store-dir))))
- (if (not drv-name)
+ (let ((drv-path (car (nix-store-path-derivers nix-buffer-store-path))))
+ (if (not drv-path)
(message "This store path has no associated derivation.")
- (let ((log-file (format "%s/log/nix/drvs/%s/%s.bz2"
- nix-state-dir
- (substring drv-name 0 2)
- (substring drv-name 2))))
- (if (file-exists-p log-file)
- (find-file log-file)
- (error "No log is available for derivation"))))))
+ (find-file (nix-log-path drv-path)))))
(defvar nix-store-path-mode-map
(let ((map (make-sparse-keymap)))
- [nongnu] elpa/nix-mode updated (34d51e2731 -> 5efb5383ab), ELPA Syncer, 2022/10/30
- [nongnu] elpa/nix-mode 098433bd54 1/7: chore(deps): bump cachix/install-nix-action from 17 to 18, ELPA Syncer, 2022/10/30
- [nongnu] elpa/nix-mode 26928b8a20 2/7: Add `nix-store-show-log` to open a log file from nix-store-path mode., ELPA Syncer, 2022/10/30
- [nongnu] elpa/nix-mode e0c057fade 4/7: Add function to get nix store log path,
ELPA Syncer <=
- [nongnu] elpa/nix-mode 1f93977c25 5/7: Bind l to nix-store-show-log, ELPA Syncer, 2022/10/30
- [nongnu] elpa/nix-mode 2915a0f4c7 3/7: Merge pull request #169 from NixOS/dependabot/github_actions/cachix/install-nix-action-18, ELPA Syncer, 2022/10/30
- [nongnu] elpa/nix-mode 634a1ffcaa 6/7: Merge pull request #170 from zainab-ali/nix-store-show-log, ELPA Syncer, 2022/10/30
- [nongnu] elpa/nix-mode 5efb5383ab 7/7: Fix auto-mode-alist for drvs, ELPA Syncer, 2022/10/30