mirror of
				https://codeberg.org/hako/Rosenthal.git
				synced 2025-11-04 11:44:48 +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-1)
 | 
				
			||||||
  #:use-module (srfi srfi-26)
 | 
					  #:use-module (srfi srfi-26)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #:use-module (guix deprecation)
 | 
				
			||||||
 | 
					  #:use-module (guix diagnostics)
 | 
				
			||||||
  #:use-module (guix gexp)
 | 
					  #:use-module (guix gexp)
 | 
				
			||||||
 | 
					  #:use-module (guix i18n)
 | 
				
			||||||
  #:use-module (guix records)
 | 
					  #:use-module (guix records)
 | 
				
			||||||
  #:use-module (rosenthal utils packages)
 | 
					  #:use-module (rosenthal utils packages)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -17,18 +20,20 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  #:use-module (rosenthal packages rust-apps)
 | 
					  #:use-module (rosenthal packages rust-apps)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  #:export (home-atuin-configuration
 | 
					  #:export (home-fish-plugin-atuin-service-type
 | 
				
			||||||
            home-atuin-service-type
 | 
					            home-atuin-configuration
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            home-fish-plugin-direnv-service-type
 | 
				
			||||||
            home-direnv-configuration
 | 
					            home-direnv-configuration
 | 
				
			||||||
            home-direnv-service-type
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            home-zoxide-configuration
 | 
					            home-fish-plugin-zoxide-service-type
 | 
				
			||||||
            home-zoxide-service-type))
 | 
					            home-zoxide-configuration))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (shells? val)
 | 
					(define (warn-deprecated-shells-field configuration)
 | 
				
			||||||
  (every (cut member <> '(bash zsh fish))
 | 
					  (lambda (value)
 | 
				
			||||||
         val))
 | 
					    (when (maybe-value-set? value)
 | 
				
			||||||
 | 
					      (warning #f (G_ "'~a': '~a' field is deprecated~%")
 | 
				
			||||||
 | 
					               configuration 'shells))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;; atuin
 | 
					;;; atuin
 | 
				
			||||||
@ -39,27 +44,30 @@
 | 
				
			|||||||
   (file-like atuin)
 | 
					   (file-like atuin)
 | 
				
			||||||
   "")
 | 
					   "")
 | 
				
			||||||
  (shells
 | 
					  (shells
 | 
				
			||||||
   shells
 | 
					   list
 | 
				
			||||||
   ""))
 | 
					   "Deprecated."
 | 
				
			||||||
 | 
					   (sanitizer (warn-deprecated-shells-field 'home-atuin-configuration))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define %home-atuin-fish
 | 
					(define %home-atuin-fish
 | 
				
			||||||
  (match-record-lambda <home-atuin-configuration>
 | 
					  (match-record-lambda <home-atuin-configuration>
 | 
				
			||||||
      (atuin shells)
 | 
					      (atuin)
 | 
				
			||||||
    (home-fish-extension
 | 
					    (home-fish-extension
 | 
				
			||||||
      (config
 | 
					      (config
 | 
				
			||||||
       (if (member 'fish shells)
 | 
					       (list (mixed-text-file "atuin.fish"
 | 
				
			||||||
           (list (mixed-text-file "atuin.fish"
 | 
					               atuin "/bin/atuin init fish | source\n"))))))
 | 
				
			||||||
                   atuin "/bin/atuin init fish | source\n"))
 | 
					 | 
				
			||||||
           '())))))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define home-atuin-service-type
 | 
					(define home-fish-plugin-atuin-service-type
 | 
				
			||||||
  (service-type
 | 
					  (service-type
 | 
				
			||||||
    (name 'atuin)
 | 
					    (name 'atuin)
 | 
				
			||||||
    (extensions
 | 
					    (extensions
 | 
				
			||||||
     (list (service-extension home-fish-service-type
 | 
					     (list (service-extension home-fish-service-type
 | 
				
			||||||
                              %home-atuin-fish)))
 | 
					                              %home-atuin-fish)))
 | 
				
			||||||
 | 
					    (default-value (home-atuin-configuration))
 | 
				
			||||||
    (description "")))
 | 
					    (description "")))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define-deprecated/public-alias home-atuin-service-type
 | 
				
			||||||
 | 
					  home-fish-plugin-atuin-service-type)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;; direnv
 | 
					;;; direnv
 | 
				
			||||||
@ -70,27 +78,30 @@
 | 
				
			|||||||
   (file-like (spec->pkg "direnv"))
 | 
					   (file-like (spec->pkg "direnv"))
 | 
				
			||||||
   "")
 | 
					   "")
 | 
				
			||||||
  (shells
 | 
					  (shells
 | 
				
			||||||
   shells
 | 
					   list
 | 
				
			||||||
   ""))
 | 
					   "Deprecated."
 | 
				
			||||||
 | 
					   (sanitizer (warn-deprecated-shells-field 'home-atuin-configuration))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define %home-direnv-fish
 | 
					(define %home-direnv-fish
 | 
				
			||||||
  (match-record-lambda <home-direnv-configuration>
 | 
					  (match-record-lambda <home-direnv-configuration>
 | 
				
			||||||
      (direnv shells)
 | 
					      (direnv)
 | 
				
			||||||
    (home-fish-extension
 | 
					    (home-fish-extension
 | 
				
			||||||
      (config
 | 
					      (config
 | 
				
			||||||
       (if (member 'fish shells)
 | 
					       (list (mixed-text-file "direnv.fish"
 | 
				
			||||||
           (list (mixed-text-file "direnv.fish"
 | 
					               direnv "/bin/direnv hook fish | source\n"))))))
 | 
				
			||||||
                   direnv "/bin/direnv hook fish | source\n"))
 | 
					 | 
				
			||||||
           '())))))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define home-direnv-service-type
 | 
					(define home-fish-plugin-direnv-service-type
 | 
				
			||||||
  (service-type
 | 
					  (service-type
 | 
				
			||||||
    (name 'direnv)
 | 
					    (name 'direnv)
 | 
				
			||||||
    (extensions
 | 
					    (extensions
 | 
				
			||||||
     (list (service-extension home-fish-service-type
 | 
					     (list (service-extension home-fish-service-type
 | 
				
			||||||
                              %home-direnv-fish)))
 | 
					                              %home-direnv-fish)))
 | 
				
			||||||
 | 
					    (default-value (home-direnv-configuration))
 | 
				
			||||||
    (description "")))
 | 
					    (description "")))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define-deprecated/public-alias home-direnv-service-type
 | 
				
			||||||
 | 
					  home-fish-plugin-direnv-service-type)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;; zoxide
 | 
					;;; zoxide
 | 
				
			||||||
@ -101,23 +112,26 @@
 | 
				
			|||||||
   (file-like (spec->pkg "zoxide"))
 | 
					   (file-like (spec->pkg "zoxide"))
 | 
				
			||||||
   "")
 | 
					   "")
 | 
				
			||||||
  (shells
 | 
					  (shells
 | 
				
			||||||
   shells
 | 
					   list
 | 
				
			||||||
   ""))
 | 
					   "Deprecated."
 | 
				
			||||||
 | 
					   (sanitizer (warn-deprecated-shells-field 'home-atuin-configuration))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define %home-zoxide-fish
 | 
					(define %home-zoxide-fish
 | 
				
			||||||
  (match-record-lambda <home-zoxide-configuration>
 | 
					  (match-record-lambda <home-zoxide-configuration>
 | 
				
			||||||
      (zoxide shells)
 | 
					      (zoxide)
 | 
				
			||||||
    (home-fish-extension
 | 
					    (home-fish-extension
 | 
				
			||||||
      (config
 | 
					      (config
 | 
				
			||||||
       (if (member 'fish shells)
 | 
					       (list (mixed-text-file "zoxide.fish"
 | 
				
			||||||
           (list (mixed-text-file "zoxide.fish"
 | 
					               zoxide "/bin/zoxide init --cmd cd fish | source\n"))))))
 | 
				
			||||||
                   zoxide "/bin/zoxide init --cmd cd fish | source\n"))
 | 
					 | 
				
			||||||
           '())))))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define home-zoxide-service-type
 | 
					(define home-fish-plugin-zoxide-service-type
 | 
				
			||||||
  (service-type
 | 
					  (service-type
 | 
				
			||||||
    (name 'zoxide)
 | 
					    (name 'zoxide)
 | 
				
			||||||
    (extensions
 | 
					    (extensions
 | 
				
			||||||
     (list (service-extension home-fish-service-type
 | 
					     (list (service-extension home-fish-service-type
 | 
				
			||||||
                              %home-zoxide-fish)))
 | 
					                              %home-zoxide-fish)))
 | 
				
			||||||
 | 
					    (default-value (home-zoxide-configuration))
 | 
				
			||||||
    (description "")))
 | 
					    (description "")))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define-deprecated/public-alias home-zoxide-service-type
 | 
				
			||||||
 | 
					  home-fish-plugin-zoxide-service-type)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user