mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-11 19:41:08 +01:00
starship: build-time nushell config generation
This commit is contained in:
parent
81f38986a2
commit
98d718b46d
3 changed files with 11 additions and 16 deletions
|
|
@ -6,8 +6,6 @@ let
|
||||||
|
|
||||||
tomlFormat = pkgs.formats.toml { };
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
|
||||||
starshipCmd = "${config.home.profileDirectory}/bin/starship";
|
|
||||||
|
|
||||||
initFish =
|
initFish =
|
||||||
if cfg.enableInteractive then "interactiveShellInit" else "shellInitLast";
|
if cfg.enableInteractive then "interactiveShellInit" else "shellInitLast";
|
||||||
in {
|
in {
|
||||||
|
|
@ -100,26 +98,26 @@ in {
|
||||||
|
|
||||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||||
if [[ $TERM != "dumb" ]]; then
|
if [[ $TERM != "dumb" ]]; then
|
||||||
eval "$(${starshipCmd} init bash --print-full-init)"
|
eval "$(${lib.getExe cfg.package} init bash --print-full-init)"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
programs.zsh.initContent = mkIf cfg.enableZshIntegration ''
|
programs.zsh.initContent = mkIf cfg.enableZshIntegration ''
|
||||||
if [[ $TERM != "dumb" ]]; then
|
if [[ $TERM != "dumb" ]]; then
|
||||||
eval "$(${starshipCmd} init zsh)"
|
eval "$(${lib.getExe cfg.package} init zsh)"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
programs.fish.${initFish} = mkIf cfg.enableFishIntegration ''
|
programs.fish.${initFish} = mkIf cfg.enableFishIntegration ''
|
||||||
if test "$TERM" != "dumb"
|
if test "$TERM" != "dumb"
|
||||||
${starshipCmd} init fish | source
|
${lib.getExe cfg.package} init fish | source
|
||||||
${lib.optionalString cfg.enableTransience "enable_transience"}
|
${lib.optionalString cfg.enableTransience "enable_transience"}
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
programs.ion.initExtra = mkIf cfg.enableIonIntegration ''
|
programs.ion.initExtra = mkIf cfg.enableIonIntegration ''
|
||||||
if test $TERM != "dumb"
|
if test $TERM != "dumb"
|
||||||
eval $(${starshipCmd} init ion)
|
eval $(${lib.getExe cfg.package} init ion)
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
@ -128,15 +126,12 @@ in {
|
||||||
# conditionally setting (global) environment variables, which is why the
|
# conditionally setting (global) environment variables, which is why the
|
||||||
# check for terminal compatibility (as seen above for the other shells) is
|
# check for terminal compatibility (as seen above for the other shells) is
|
||||||
# not done here.
|
# 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 = ''
|
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 GOT="$(tail -n 5 `_abs home-files/.config/fish/config.fish`)"
|
||||||
export NOT_EXPECTED="
|
export NOT_EXPECTED="
|
||||||
if test \"\$TERM\" != dumb
|
if test \"\$TERM\" != dumb
|
||||||
/home/hm-user/.nix-profile/bin/starship init fish | source
|
@starship@/bin/starship init fish | source
|
||||||
|
|
||||||
end"
|
end"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
export GOT="$(tail -n 5 `_abs home-files/.config/fish/config.fish`)"
|
export GOT="$(tail -n 5 `_abs home-files/.config/fish/config.fish`)"
|
||||||
export EXPECTED="
|
export EXPECTED="
|
||||||
if test \"\$TERM\" != dumb
|
if test \"\$TERM\" != dumb
|
||||||
/home/hm-user/.nix-profile/bin/starship init fish | source
|
@starship@/bin/starship init fish | source
|
||||||
|
|
||||||
end"
|
end"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue