mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-31 04:04:32 +00:00
starship: build-time nushell config generation
This commit is contained in:
parent
ce287a5cd3
commit
96cf7faf35
3 changed files with 11 additions and 16 deletions
|
@ -8,8 +8,6 @@ let
|
|||
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
|
||||
starshipCmd = "${config.home.profileDirectory}/bin/starship";
|
||||
|
||||
initFish =
|
||||
if cfg.enableInteractive then "interactiveShellInit" else "shellInitLast";
|
||||
in {
|
||||
|
@ -102,26 +100,26 @@ in {
|
|||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||
if [[ $TERM != "dumb" ]]; then
|
||||
eval "$(${starshipCmd} init bash --print-full-init)"
|
||||
eval "$(${lib.getExe cfg.package} init bash --print-full-init)"
|
||||
fi
|
||||
'';
|
||||
|
||||
programs.zsh.initContent = mkIf cfg.enableZshIntegration ''
|
||||
if [[ $TERM != "dumb" ]]; then
|
||||
eval "$(${starshipCmd} init zsh)"
|
||||
eval "$(${lib.getExe cfg.package} init zsh)"
|
||||
fi
|
||||
'';
|
||||
|
||||
programs.fish.${initFish} = mkIf cfg.enableFishIntegration ''
|
||||
if test "$TERM" != "dumb"
|
||||
${starshipCmd} init fish | source
|
||||
${lib.getExe cfg.package} init fish | source
|
||||
${lib.optionalString cfg.enableTransience "enable_transience"}
|
||||
end
|
||||
'';
|
||||
|
||||
programs.ion.initExtra = mkIf cfg.enableIonIntegration ''
|
||||
if test $TERM != "dumb"
|
||||
eval $(${starshipCmd} init ion)
|
||||
eval $(${lib.getExe cfg.package} init ion)
|
||||
end
|
||||
'';
|
||||
|
||||
|
@ -130,15 +128,12 @@ in {
|
|||
# conditionally setting (global) environment variables, which is why the
|
||||
# check for terminal compatibility (as seen above for the other shells) is
|
||||
# not done here.
|
||||
extraEnv = ''
|
||||
let starship_cache = "${config.xdg.cacheHome}/starship"
|
||||
if not ($starship_cache | path exists) {
|
||||
mkdir $starship_cache
|
||||
}
|
||||
${starshipCmd} init nu | save --force ${config.xdg.cacheHome}/starship/init.nu
|
||||
'';
|
||||
extraConfig = ''
|
||||
use ${config.xdg.cacheHome}/starship/init.nu
|
||||
use ${
|
||||
pkgs.runCommand "starship-nushell-config" { } ''
|
||||
${lib.getExe cfg.package} init nu >> "$out"
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
export GOT="$(tail -n 5 `_abs home-files/.config/fish/config.fish`)"
|
||||
export NOT_EXPECTED="
|
||||
if test \"\$TERM\" != dumb
|
||||
/home/hm-user/.nix-profile/bin/starship init fish | source
|
||||
@starship@/bin/starship init fish | source
|
||||
|
||||
end"
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
export GOT="$(tail -n 5 `_abs home-files/.config/fish/config.fish`)"
|
||||
export EXPECTED="
|
||||
if test \"\$TERM\" != dumb
|
||||
/home/hm-user/.nix-profile/bin/starship init fish | source
|
||||
@starship@/bin/starship init fish | source
|
||||
|
||||
end"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue