config/guix/profile-to-manifest: Include Guix commit

master
Pierre Neidhardt 2019-03-22 12:00:21 +01:00
parent 43eb990c53
commit 80e69944eb
1 changed files with 19 additions and 6 deletions

View File

@ -5,11 +5,8 @@
(ice-9 match)
(ice-9 pretty-print))
(match (command-line)
((_ where)
(pretty-print
`(specifications->manifest
',(sort (map (lambda (entry)
(define (guix-manifest where)
(sort (map (lambda (entry)
(let ((out (manifest-entry-output entry)))
(if (string= out "out")
(manifest-entry-name entry)
@ -17,5 +14,21 @@
(manifest-entry-name entry)
(manifest-entry-output entry)))))
(manifest-entries (profile-manifest where)))
string<?))))
string<?))
;; Thanks to Ivan Vilata-i-Balaguer for this:
(define (guix-commit)
(let ((guix-manifest (profile-manifest (string-append (getenv "HOME") "/.config/guix/current"))))
(match (assq 'source (manifest-entry-properties (car (manifest-entries guix-manifest))))
(('source ('repository ('version 0) _ _
('commit commit) _ ...))
commit)
(_ #f))))
(match (command-line)
((_ where)
(format #t ";; commit: ~a\n" (guix-commit))
(pretty-print
`(specifications->manifest
',(guix-manifest where))))
(_ (error "Please provide the path to a Guix profile.")))