home-services: shells: Move home-shell-profile to fish-xdg branch
parent
82ff5a9150
commit
5575f64918
|
@ -24,72 +24,6 @@
|
||||||
|
|
||||||
fish-function))
|
fish-function))
|
||||||
|
|
||||||
;;;
|
|
||||||
;;; Shell profile.
|
|
||||||
;;;
|
|
||||||
|
|
||||||
(define path? string?)
|
|
||||||
(define (serialize-path field-name val) val)
|
|
||||||
|
|
||||||
(define-configuration home-shell-profile-configuration
|
|
||||||
(location
|
|
||||||
(path ".config/profile")
|
|
||||||
#f)
|
|
||||||
(profile
|
|
||||||
(text-config '())
|
|
||||||
"\
|
|
||||||
@code{home-shell-profile} is instantiated automatically by
|
|
||||||
@code{home-environment}, DO NOT create this service manually, it can
|
|
||||||
only be extended.
|
|
||||||
|
|
||||||
@code{profile} is a list of file-like objects, which will go in
|
|
||||||
@code{location}, which is relative to the users @env{HOME}, and
|
|
||||||
defaults to @file{~/.profile}. By default @code{profile} contains
|
|
||||||
the initialization code, which have to be evaluated by login shell
|
|
||||||
to make home-environment's profile available to the user, but other
|
|
||||||
commands can be added to the file if it is really necessary.
|
|
||||||
|
|
||||||
In most cases shell's configuration files are preferred places for
|
|
||||||
user's customizations. Extend home-shell-profile service only if you
|
|
||||||
really know what you do."))
|
|
||||||
|
|
||||||
(define (add-shell-profile-file config)
|
|
||||||
`((,(home-shell-profile-configuration-location config)
|
|
||||||
,(mixed-text-file
|
|
||||||
"shell-profile"
|
|
||||||
"\
|
|
||||||
HOME_ENVIRONMENT=$HOME/.guix-home
|
|
||||||
. $HOME_ENVIRONMENT/setup-environment
|
|
||||||
$HOME_ENVIRONMENT/on-first-login\n"
|
|
||||||
(serialize-configuration
|
|
||||||
config
|
|
||||||
(filter-configuration-fields
|
|
||||||
home-shell-profile-configuration-fields '(profile)))))))
|
|
||||||
|
|
||||||
(define (add-profile-extensions config extensions)
|
|
||||||
(home-shell-profile-configuration
|
|
||||||
(inherit config)
|
|
||||||
(profile
|
|
||||||
(append (home-shell-profile-configuration-profile config)
|
|
||||||
extensions))))
|
|
||||||
|
|
||||||
(define home-shell-profile-service-type
|
|
||||||
(service-type (name 'home-shell-profile)
|
|
||||||
(extensions
|
|
||||||
(list (service-extension
|
|
||||||
home-files-service-type
|
|
||||||
add-shell-profile-file)))
|
|
||||||
(compose concatenate)
|
|
||||||
(extend add-profile-extensions)
|
|
||||||
(default-value (home-shell-profile-configuration))
|
|
||||||
(description "Create a shell profile file, which is used
|
|
||||||
for environment initialization of POSIX compliant login shells. This
|
|
||||||
service type can be extended with a list of file-like objects.")))
|
|
||||||
|
|
||||||
(define (serialize-boolean field-name val) "")
|
|
||||||
(define (serialize-posix-env-vars field-name val)
|
|
||||||
(environment-variable-shell-definitions val))
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; Fish.
|
;;; Fish.
|
||||||
;;;
|
;;;
|
||||||
|
@ -206,12 +140,7 @@ hooks, and/or abbreviations for fish."))
|
||||||
status --is-login; and not set -q __fish_login_config_sourced
|
status --is-login; and not set -q __fish_login_config_sourced
|
||||||
and begin
|
and begin
|
||||||
|
|
||||||
set --prepend fish_function_path "
|
set --prepend fish_function_path " #$fish-foreign-env "/share/fish/functions
|
||||||
#$fish-foreign-env
|
|
||||||
"/share/fish/functions
|
|
||||||
if test -f $HOME/.config/profile
|
|
||||||
fenv source $HOME/.config/profile
|
|
||||||
else
|
|
||||||
fenv source $HOME/.profile
|
fenv source $HOME/.profile
|
||||||
set -e fish_function_path[1]
|
set -e fish_function_path[1]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue