mirror of
				https://codeberg.org/hako/Rosenthal.git
				synced 2025-11-03 19:24:37 +00:00 
			
		
		
		
	services: shellutils: Define separate service types for different shells.
* modules/rosenthal/services/shellutils.scm (warn-deprecated-shells-field): New procedure. (home-atuin-configuration, home-direnv-configuration) (home-zoxide-configuration): Deprecate shells field. (shells?): Delete procedure. (home-fish-plugin-atuin-service-type): Renamed and adjusted from... (home-atuin-service-type): ...this deprecated variable. (home-fish-plugin-direnv-service-type): Renamed and adjusted from... (home-direnv-service-type): ...this deprecated variable. (home-fish-plugin-zoxide-service-type): Renamed and adjusted from... (home-zoxide-service-type): ...this deprecated variable.
This commit is contained in:
		
							parent
							
								
									f1f47b6e2d
								
							
						
					
					
						commit
						930e6262af
					
				@ -6,7 +6,10 @@
 | 
			
		||||
  #:use-module (srfi srfi-1)
 | 
			
		||||
  #:use-module (srfi srfi-26)
 | 
			
		||||
 | 
			
		||||
  #:use-module (guix deprecation)
 | 
			
		||||
  #:use-module (guix diagnostics)
 | 
			
		||||
  #:use-module (guix gexp)
 | 
			
		||||
  #:use-module (guix i18n)
 | 
			
		||||
  #:use-module (guix records)
 | 
			
		||||
  #:use-module (rosenthal utils packages)
 | 
			
		||||
 | 
			
		||||
@ -17,18 +20,20 @@
 | 
			
		||||
 | 
			
		||||
  #:use-module (rosenthal packages rust-apps)
 | 
			
		||||
 | 
			
		||||
  #:export (home-atuin-configuration
 | 
			
		||||
            home-atuin-service-type
 | 
			
		||||
  #:export (home-fish-plugin-atuin-service-type
 | 
			
		||||
            home-atuin-configuration
 | 
			
		||||
 | 
			
		||||
            home-fish-plugin-direnv-service-type
 | 
			
		||||
            home-direnv-configuration
 | 
			
		||||
            home-direnv-service-type
 | 
			
		||||
 | 
			
		||||
            home-zoxide-configuration
 | 
			
		||||
            home-zoxide-service-type))
 | 
			
		||||
            home-fish-plugin-zoxide-service-type
 | 
			
		||||
            home-zoxide-configuration))
 | 
			
		||||
 | 
			
		||||
(define (shells? val)
 | 
			
		||||
  (every (cut member <> '(bash zsh fish))
 | 
			
		||||
         val))
 | 
			
		||||
(define (warn-deprecated-shells-field configuration)
 | 
			
		||||
  (lambda (value)
 | 
			
		||||
    (when (maybe-value-set? value)
 | 
			
		||||
      (warning #f (G_ "'~a': '~a' field is deprecated~%")
 | 
			
		||||
               configuration 'shells))))
 | 
			
		||||
 | 
			
		||||
;;;
 | 
			
		||||
;;; atuin
 | 
			
		||||
@ -39,27 +44,30 @@
 | 
			
		||||
   (file-like atuin)
 | 
			
		||||
   "")
 | 
			
		||||
  (shells
 | 
			
		||||
   shells
 | 
			
		||||
   ""))
 | 
			
		||||
   list
 | 
			
		||||
   "Deprecated."
 | 
			
		||||
   (sanitizer (warn-deprecated-shells-field 'home-atuin-configuration))))
 | 
			
		||||
 | 
			
		||||
(define %home-atuin-fish
 | 
			
		||||
  (match-record-lambda <home-atuin-configuration>
 | 
			
		||||
      (atuin shells)
 | 
			
		||||
      (atuin)
 | 
			
		||||
    (home-fish-extension
 | 
			
		||||
      (config
 | 
			
		||||
       (if (member 'fish shells)
 | 
			
		||||
           (list (mixed-text-file "atuin.fish"
 | 
			
		||||
                   atuin "/bin/atuin init fish | source\n"))
 | 
			
		||||
           '())))))
 | 
			
		||||
       (list (mixed-text-file "atuin.fish"
 | 
			
		||||
               atuin "/bin/atuin init fish | source\n"))))))
 | 
			
		||||
 | 
			
		||||
(define home-atuin-service-type
 | 
			
		||||
(define home-fish-plugin-atuin-service-type
 | 
			
		||||
  (service-type
 | 
			
		||||
    (name 'atuin)
 | 
			
		||||
    (extensions
 | 
			
		||||
     (list (service-extension home-fish-service-type
 | 
			
		||||
                              %home-atuin-fish)))
 | 
			
		||||
    (default-value (home-atuin-configuration))
 | 
			
		||||
    (description "")))
 | 
			
		||||
 | 
			
		||||
(define-deprecated/public-alias home-atuin-service-type
 | 
			
		||||
  home-fish-plugin-atuin-service-type)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
;;;
 | 
			
		||||
;;; direnv
 | 
			
		||||
@ -70,27 +78,30 @@
 | 
			
		||||
   (file-like (spec->pkg "direnv"))
 | 
			
		||||
   "")
 | 
			
		||||
  (shells
 | 
			
		||||
   shells
 | 
			
		||||
   ""))
 | 
			
		||||
   list
 | 
			
		||||
   "Deprecated."
 | 
			
		||||
   (sanitizer (warn-deprecated-shells-field 'home-atuin-configuration))))
 | 
			
		||||
 | 
			
		||||
(define %home-direnv-fish
 | 
			
		||||
  (match-record-lambda <home-direnv-configuration>
 | 
			
		||||
      (direnv shells)
 | 
			
		||||
      (direnv)
 | 
			
		||||
    (home-fish-extension
 | 
			
		||||
      (config
 | 
			
		||||
       (if (member 'fish shells)
 | 
			
		||||
           (list (mixed-text-file "direnv.fish"
 | 
			
		||||
                   direnv "/bin/direnv hook fish | source\n"))
 | 
			
		||||
           '())))))
 | 
			
		||||
       (list (mixed-text-file "direnv.fish"
 | 
			
		||||
               direnv "/bin/direnv hook fish | source\n"))))))
 | 
			
		||||
 | 
			
		||||
(define home-direnv-service-type
 | 
			
		||||
(define home-fish-plugin-direnv-service-type
 | 
			
		||||
  (service-type
 | 
			
		||||
    (name 'direnv)
 | 
			
		||||
    (extensions
 | 
			
		||||
     (list (service-extension home-fish-service-type
 | 
			
		||||
                              %home-direnv-fish)))
 | 
			
		||||
    (default-value (home-direnv-configuration))
 | 
			
		||||
    (description "")))
 | 
			
		||||
 | 
			
		||||
(define-deprecated/public-alias home-direnv-service-type
 | 
			
		||||
  home-fish-plugin-direnv-service-type)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
;;;
 | 
			
		||||
;;; zoxide
 | 
			
		||||
@ -101,23 +112,26 @@
 | 
			
		||||
   (file-like (spec->pkg "zoxide"))
 | 
			
		||||
   "")
 | 
			
		||||
  (shells
 | 
			
		||||
   shells
 | 
			
		||||
   ""))
 | 
			
		||||
   list
 | 
			
		||||
   "Deprecated."
 | 
			
		||||
   (sanitizer (warn-deprecated-shells-field 'home-atuin-configuration))))
 | 
			
		||||
 | 
			
		||||
(define %home-zoxide-fish
 | 
			
		||||
  (match-record-lambda <home-zoxide-configuration>
 | 
			
		||||
      (zoxide shells)
 | 
			
		||||
      (zoxide)
 | 
			
		||||
    (home-fish-extension
 | 
			
		||||
      (config
 | 
			
		||||
       (if (member 'fish shells)
 | 
			
		||||
           (list (mixed-text-file "zoxide.fish"
 | 
			
		||||
                   zoxide "/bin/zoxide init --cmd cd fish | source\n"))
 | 
			
		||||
           '())))))
 | 
			
		||||
       (list (mixed-text-file "zoxide.fish"
 | 
			
		||||
               zoxide "/bin/zoxide init --cmd cd fish | source\n"))))))
 | 
			
		||||
 | 
			
		||||
(define home-zoxide-service-type
 | 
			
		||||
(define home-fish-plugin-zoxide-service-type
 | 
			
		||||
  (service-type
 | 
			
		||||
    (name 'zoxide)
 | 
			
		||||
    (extensions
 | 
			
		||||
     (list (service-extension home-fish-service-type
 | 
			
		||||
                              %home-zoxide-fish)))
 | 
			
		||||
    (default-value (home-zoxide-configuration))
 | 
			
		||||
    (description "")))
 | 
			
		||||
 | 
			
		||||
(define-deprecated/public-alias home-zoxide-service-type
 | 
			
		||||
  home-fish-plugin-zoxide-service-type)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user