2022-04-11 23:15:51 -07:00
|
|
|
|
(define-module (oni home services zsh)
|
2025-02-03 22:03:48 -08:00
|
|
|
|
#:use-module (ice-9 string-fun)
|
2022-04-11 23:15:51 -07:00
|
|
|
|
#: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)
|
2025-02-03 22:03:48 -08:00
|
|
|
|
#:use-module ((oni packages atuin)
|
|
|
|
|
#:select (rust-atuin-18))
|
2023-08-23 10:57:10 -07:00
|
|
|
|
#:use-module (oni packages zsh)
|
2022-04-11 23:15:51 -07:00
|
|
|
|
|
|
|
|
|
#:export (home-zsh-autosuggestions-service-type
|
|
|
|
|
home-zsh-autosuggestions-configuration
|
|
|
|
|
home-zsh-syntax-highlighting-service-type
|
2023-08-23 10:57:10 -07:00
|
|
|
|
home-zsh-syntax-highlighting-configuration
|
|
|
|
|
home-zsh-contextual-abbrevs-service-type
|
2023-08-29 22:24:25 -07:00
|
|
|
|
home-zsh-contextual-abbrevs-configuration
|
|
|
|
|
home-zsh-autopair-service-type
|
2025-02-03 22:03:48 -08:00
|
|
|
|
home-zsh-autopair-configuration
|
|
|
|
|
home-zsh-atuin-service-type
|
|
|
|
|
home-zsh-atuin-configuration))
|
2022-04-11 23:15:51 -07:00
|
|
|
|
|
|
|
|
|
(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")))))
|
|
|
|
|
|
2022-04-11 23:44:19 -07:00
|
|
|
|
(define (add-zsh-autosuggestions-packages config)
|
|
|
|
|
(list (home-zsh-autosuggestions-configuration-package config)))
|
|
|
|
|
|
2022-04-11 23:15:51 -07:00
|
|
|
|
(define home-zsh-autosuggestions-service-type
|
|
|
|
|
(service-type
|
|
|
|
|
(name 'home-zsh-autosuggestions)
|
|
|
|
|
(extensions
|
|
|
|
|
(list (service-extension
|
|
|
|
|
home-zsh-service-type
|
2022-04-11 23:44:19 -07:00
|
|
|
|
add-zsh-autosuggestions)
|
|
|
|
|
(service-extension
|
|
|
|
|
home-profile-service-type
|
|
|
|
|
add-zsh-autosuggestions-packages)))
|
2022-04-11 23:15:51 -07:00
|
|
|
|
(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")))))
|
|
|
|
|
|
2022-04-11 23:44:19 -07:00
|
|
|
|
(define (add-zsh-syntax-highlighting-packages config)
|
|
|
|
|
(list (home-zsh-syntax-highlighting-configuration-package config)))
|
|
|
|
|
|
2022-04-11 23:15:51 -07:00
|
|
|
|
(define home-zsh-syntax-highlighting-service-type
|
|
|
|
|
(service-type
|
|
|
|
|
(name 'home-zsh-syntax-highlighting)
|
|
|
|
|
(extensions
|
|
|
|
|
(list (service-extension
|
|
|
|
|
home-zsh-service-type
|
2022-04-11 23:44:19 -07:00
|
|
|
|
add-zsh-syntax-highlighting)
|
|
|
|
|
(service-extension
|
|
|
|
|
home-profile-service-type
|
|
|
|
|
add-zsh-syntax-highlighting-packages)))
|
2022-04-11 23:15:51 -07:00
|
|
|
|
(compose identity)
|
|
|
|
|
(default-value (home-zsh-syntax-highlighting-configuration))
|
|
|
|
|
(description "Install and configure zsh-syntax-highlighting.")))
|
2023-08-23 10:57:10 -07:00
|
|
|
|
|
|
|
|
|
(define-configuration/no-serialization home-zsh-contextual-abbrevs-configuration
|
|
|
|
|
(package
|
|
|
|
|
(package zsh-contextual-abbrevs)
|
|
|
|
|
"Package to use for setting zsh-contexual-abbrevs."))
|
|
|
|
|
|
|
|
|
|
(define (add-zsh-contextual-abbrevs config)
|
|
|
|
|
(home-zsh-extension
|
|
|
|
|
(zshrc
|
|
|
|
|
(list
|
|
|
|
|
(mixed-text-file
|
|
|
|
|
"zshrc"
|
|
|
|
|
"source " (home-zsh-contextual-abbrevs-configuration-package config) "/share/zsh/plugins/zsh-contextual-abbrevs/contextual-abbrevs.zsh")))))
|
|
|
|
|
|
|
|
|
|
(define (add-zsh-contextual-abbrevs-packages config)
|
|
|
|
|
(list (home-zsh-contextual-abbrevs-configuration-package config)))
|
|
|
|
|
|
|
|
|
|
(define home-zsh-contextual-abbrevs-service-type
|
|
|
|
|
(service-type
|
|
|
|
|
(name 'home-zsh-contextual-abbrevs)
|
|
|
|
|
(extensions
|
|
|
|
|
(list (service-extension
|
|
|
|
|
home-zsh-service-type
|
|
|
|
|
add-zsh-contextual-abbrevs)
|
|
|
|
|
(service-extension
|
|
|
|
|
home-profile-service-type
|
|
|
|
|
add-zsh-contextual-abbrevs-packages)))
|
|
|
|
|
(compose identity)
|
|
|
|
|
(default-value (home-zsh-contextual-abbrevs-configuration))
|
|
|
|
|
(description "Install and configure zsh-contextual-abbrevs.")))
|
2023-08-29 22:24:25 -07:00
|
|
|
|
|
2023-08-29 22:30:36 -07:00
|
|
|
|
(define-configuration/no-serialization home-zsh-autopair-configuration
|
|
|
|
|
(package
|
|
|
|
|
(package zsh-autopair)
|
|
|
|
|
"Package to use for setting zsh-autopair."))
|
|
|
|
|
|
2023-08-29 22:24:25 -07:00
|
|
|
|
(define (add-zsh-autopair config)
|
|
|
|
|
(home-zsh-extension
|
|
|
|
|
(zshrc
|
|
|
|
|
(list
|
|
|
|
|
(mixed-text-file
|
|
|
|
|
"zshrc"
|
|
|
|
|
"source " (home-zsh-autopair-configuration-package config) "/share/zsh/plugins/zsh-autopair/zsh-autopair.zsh")))))
|
|
|
|
|
|
|
|
|
|
(define (add-zsh-autopair-packages config)
|
|
|
|
|
(list (home-zsh-autopair-configuration-package config)))
|
|
|
|
|
|
|
|
|
|
(define home-zsh-autopair-service-type
|
|
|
|
|
(service-type
|
|
|
|
|
(name 'home-zsh-autopair)
|
|
|
|
|
(extensions
|
|
|
|
|
(list (service-extension
|
|
|
|
|
home-zsh-service-type
|
|
|
|
|
add-zsh-autopair)
|
|
|
|
|
(service-extension
|
|
|
|
|
home-profile-service-type
|
|
|
|
|
add-zsh-autopair-packages)))
|
|
|
|
|
(compose identity)
|
|
|
|
|
(default-value (home-zsh-autopair-configuration))
|
|
|
|
|
(description "Install and configure zsh-autopair.")))
|
2025-02-03 22:03:48 -08:00
|
|
|
|
|
|
|
|
|
(define (serialize-integer field value)
|
|
|
|
|
(format #f "~a = ~a" (string-replace-substring (symbol->string field) "-" "_") value))
|
|
|
|
|
|
2025-02-03 22:33:13 -08:00
|
|
|
|
(define (serialize-filter-mode field value)
|
|
|
|
|
(format #f "~a = ~s~%" (string-replace-substring (symbol->string field) "-" "_")
|
|
|
|
|
(symbol->string value)))
|
|
|
|
|
|
|
|
|
|
(define (filter-mode? value)
|
|
|
|
|
(memq value '(global host session directory workspace)))
|
|
|
|
|
|
2025-02-03 22:03:48 -08:00
|
|
|
|
(define-configuration home-zsh-atuin-configuration
|
|
|
|
|
(package
|
|
|
|
|
(package rust-atuin-18)
|
|
|
|
|
"Package to use for setting atuin.")
|
|
|
|
|
(inline-height
|
|
|
|
|
(integer 40)
|
2025-02-03 22:33:13 -08:00
|
|
|
|
"Set the maximum number of lines Atuin’s interface should take up.")
|
|
|
|
|
(filter-mode
|
|
|
|
|
(filter-mode 'global)
|
|
|
|
|
"The default filter to use when searching"))
|
2025-02-03 22:03:48 -08:00
|
|
|
|
|
|
|
|
|
(define (add-zsh-atuin config)
|
|
|
|
|
(home-zsh-extension
|
|
|
|
|
(zshrc
|
|
|
|
|
(list
|
|
|
|
|
(mixed-text-file
|
|
|
|
|
"zshrc"
|
|
|
|
|
"eval \"$(" (home-zsh-atuin-configuration-package config) "/bin/atuin init zsh)\"\n")))))
|
|
|
|
|
|
|
|
|
|
(define (add-zsh-atuin-configuration config)
|
|
|
|
|
`(("atuin/config.toml"
|
|
|
|
|
,(mixed-text-file
|
|
|
|
|
"config.toml"
|
|
|
|
|
(serialize-configuration config home-zsh-atuin-configuration-fields)))))
|
|
|
|
|
|
|
|
|
|
(define (add-zsh-atuin-packages config)
|
|
|
|
|
(list (home-zsh-atuin-configuration-package config)))
|
|
|
|
|
|
|
|
|
|
(define home-zsh-atuin-service-type
|
|
|
|
|
(service-type
|
|
|
|
|
(name 'home-zsh-atuin)
|
|
|
|
|
(extensions
|
|
|
|
|
(list (service-extension
|
|
|
|
|
home-zsh-service-type
|
|
|
|
|
add-zsh-atuin)
|
|
|
|
|
(service-extension
|
|
|
|
|
home-profile-service-type
|
|
|
|
|
add-zsh-atuin-packages)
|
|
|
|
|
(service-extension
|
|
|
|
|
home-xdg-configuration-files-service-type
|
|
|
|
|
add-zsh-atuin-configuration)))
|
|
|
|
|
(compose identity)
|
|
|
|
|
(default-value (home-zsh-atuin-configuration))
|
|
|
|
|
(description "Install and configure atuin.")))
|