home-services: shells: Remove dependency on (radix utils) and (radix combinators), and make sure each plugin derivation is already computed prior to the service instantiation
parent
dda033a2d9
commit
bfefb07673
|
@ -4,6 +4,7 @@
|
|||
#:use-module (gnu home services)
|
||||
#:use-module (gnu packages shells)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix monads)
|
||||
#:use-module (guix store)
|
||||
#:use-module (guix derivations)
|
||||
#:use-module (guix packages)
|
||||
|
@ -12,8 +13,6 @@
|
|||
#:use-module (srfi srfi-9)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (radix utils)
|
||||
#:use-module (radix combinators)
|
||||
#:use-module (radix packages fish-xyz)
|
||||
|
||||
#:export (home-fish-service-type
|
||||
|
@ -197,26 +196,36 @@ end\n\n")
|
|||
home-fish-extension-plugins extension-configs)))))
|
||||
|
||||
(define (fish-plugin-files-service config)
|
||||
(define (plugin-files plugin)
|
||||
(define (directory-files dir)
|
||||
(define (list-contents dir)
|
||||
(and=> (scandir dir)
|
||||
(lambda (subdirs)
|
||||
(map (cut string-append dir "/" <>)
|
||||
(cddr subdirs)))))
|
||||
|
||||
(define (plugin-subdir-files plugin drv-subdir)
|
||||
(map (lambda (file)
|
||||
(let ((almost-basename (almost-basename file)))
|
||||
(list (string-append "fish/" almost-basename)
|
||||
(file-append plugin
|
||||
(string-append "/share/fish/"
|
||||
almost-basename)))))
|
||||
(list-contents dir)))
|
||||
(let ((name (string-append (basename (dirname file))
|
||||
"/" (basename file))))
|
||||
(list (string-append "fish/" name)
|
||||
(file-append plugin (string-append "/share/fish/" name)))))
|
||||
(list-contents drv-subdir)))
|
||||
|
||||
(let* ((drv (run-with-store (open-connection)
|
||||
(with-store %store
|
||||
(package->derivation plugin))))
|
||||
(path (string-append (derivation->output-path drv) "/share/fish/")))
|
||||
(append-map directory-files
|
||||
(filter (negate (cut string-suffix? "doc" <>))
|
||||
(list-contents path)))))
|
||||
|
||||
(append-map plugin-files
|
||||
(home-fish-configuration-plugins config)))
|
||||
(define plugins (home-fish-configuration-plugins config))
|
||||
(define derivations
|
||||
(run-with-store (open-connection)
|
||||
(mlet* %store-monad
|
||||
((drvs (mapm %store-monad
|
||||
package->derivation
|
||||
plugins))
|
||||
(_ (built-derivations drvs)))
|
||||
(return drvs))))
|
||||
(append-map
|
||||
(lambda (plugin drv)
|
||||
(let ((out (derivation->output-path drv)))
|
||||
(append-map (cut plugin-subdir-files plugin <>)
|
||||
(list-contents (string-append out "/share/fish")))))
|
||||
plugins
|
||||
derivations))
|
||||
|
||||
;; TODO: Support for generating completion files
|
||||
(define home-fish-service-type
|
||||
|
|
Loading…
Reference in New Issue