aboutsummaryrefslogtreecommitdiffstats
path: root/oni
diff options
context:
space:
mode:
authorGravatar Tom Willemse2022-04-11 23:15:51 -0700
committerGravatar Tom Willemse2022-04-11 23:15:51 -0700
commit98284e0af36e4a913bd575d38f932023dec92d22 (patch)
treef1d44963750301bcff3ad6910c38c71fef855f9e /oni
parent15b1898664c41b60fefad9ba844efb5ee6a03af4 (diff)
downloadnew-dotfiles-98284e0af36e4a913bd575d38f932023dec92d22.tar.gz
new-dotfiles-98284e0af36e4a913bd575d38f932023dec92d22.zip
Make zsh plugins their own services
Diffstat (limited to 'oni')
-rw-r--r--oni/home/data/config.scm17
-rw-r--r--oni/home/services/zsh.scm62
2 files changed, 71 insertions, 8 deletions
diff --git a/oni/home/data/config.scm b/oni/home/data/config.scm
index 070f4c2..7c2b064 100644
--- a/oni/home/data/config.scm
+++ b/oni/home/data/config.scm
@@ -13,12 +13,11 @@
#:use-module (oni home services kitty)
#:use-module (oni home services xsession)
#:use-module (oni home services compton)
- #:use-module (oni home services xbindkeys))
+ #:use-module (oni home services xbindkeys)
+ #:use-module (oni home services zsh))
(home-environment
- (packages (list (specification->package+output "glibc-locales")
- zsh-syntax-highlighting
- zsh-autosuggestions))
+ (packages (list (specification->package+output "glibc-locales")))
(services
(list
@@ -62,10 +61,12 @@
"bindkey -e '^W' x-kill-region\n"
"bindkey -e '^Y' x-yank\n"
"autoload -Uz compinit\n"
- "compinit\n"
- "source " zsh-autosuggestions "/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh\n"
- ;; This has to be last
- "source " zsh-syntax-highlighting "/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh\n")))))
+ "compinit\n")))))
+
+ ;; This has to be the first extension because it needs to be added to the
+ ;; configuration last.
+ (service home-zsh-syntax-highlighting-service-type)
+ (service home-zsh-autosuggestions-service-type)
(service home-rofi-service-type
(home-rofi-configuration
diff --git a/oni/home/services/zsh.scm b/oni/home/services/zsh.scm
new file mode 100644
index 0000000..26c7bd5
--- /dev/null
+++ b/oni/home/services/zsh.scm
@@ -0,0 +1,62 @@
+(define-module (oni home services zsh)
+ #:use-module (gnu services configuration)
+ #:use-module (gnu packages shellutils)
+ #:use-module (gnu home services)
+ #:use-module (gnu home services shells)
+ #:use-module (gnu home services utils)
+ #:use-module (guix packages)
+ #:use-module (guix gexp)
+
+ #:export (home-zsh-autosuggestions-service-type
+ home-zsh-autosuggestions-configuration
+ home-zsh-syntax-highlighting-service-type
+ home-zsh-syntax-highlighting-configuration))
+
+(define-configuration/no-serialization home-zsh-autosuggestions-configuration
+ (package
+ (package zsh-autosuggestions)
+ "Package to use for setting zsh-autosuggestions"))
+
+(define (add-zsh-autosuggestions config)
+ (home-zsh-extension
+ (zshrc
+ (list
+ (mixed-text-file
+ "zshrc"
+ "source " (home-zsh-autosuggestions-configuration-package config) "/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh")))))
+
+(define home-zsh-autosuggestions-service-type
+ (service-type
+ (name 'home-zsh-autosuggestions)
+ (extensions
+ (list (service-extension
+ home-zsh-service-type
+ add-zsh-autosuggestions)))
+ (compose identity)
+ (default-value (home-zsh-autosuggestions-configuration))
+ (description "Install and configure zsh-autosuggestions.")))
+
+
+(define-configuration/no-serialization home-zsh-syntax-highlighting-configuration
+ (package
+ (package zsh-syntax-highlighting)
+ "Package to use for setting zsh-syntax-highlighting."))
+
+(define (add-zsh-syntax-highlighting config)
+ (home-zsh-extension
+ (zshrc
+ (list
+ (mixed-text-file
+ "zshrc"
+ "source " (home-zsh-syntax-highlighting-configuration-package config) "/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh")))))
+
+(define home-zsh-syntax-highlighting-service-type
+ (service-type
+ (name 'home-zsh-syntax-highlighting)
+ (extensions
+ (list (service-extension
+ home-zsh-service-type
+ add-zsh-syntax-highlighting)))
+ (compose identity)
+ (default-value (home-zsh-syntax-highlighting-configuration))
+ (description "Install and configure zsh-syntax-highlighting.")))